• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSImage get / set Pixels
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSImage get / set Pixels


  • Subject: Re: NSImage get / set Pixels
  • From: Ricky Sharp <email@hidden>
  • Date: Thu, 16 Mar 2006 09:18:03 -0600

On Thursday, March 16, 2006, at 08:58AM, goessly <email@hidden> wrote:

>I'd like to copy a pixel to an NSImage *outputImage (at the NSPoint
>*targetCoordinates).
>The pixel is to be read from another NSImage *inputImage (at the
>NSPoint *sourceCoordinates).
>
>Something like
>[outputImage drawAt: targetCoordinates copiedPixelFrom: [inputImage
>pixelAt: sourceCoordinates] ]
>
>How can I accomplish this? NSImage seems to lack getters / setters
>for pixels at given coordinates.

NSImage is just a container.  I'm going to assume that all your images have a bitmap image rep.  If so, obtain the bitmap image reps from the NSImage instances.  Then, use getPixel:atX:y: and setPixel:atX:y.

If you're only doing a few pixels at a time, this should be OK.  However, if you're doing work with many pixels, you may want to consider using direct pixel access to do the reads/writes for better performance.  There's an example of this in the TransformedImage sample code.

--
Rick Sharp
Instant Interactive(tm)

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: NSImage get / set Pixels
      • From: goessly <email@hidden>
References: 
 >NSImage get / set Pixels (From: goessly <email@hidden>)

  • Prev by Date: Re: fetch request with compound predicate doesn't sort properly
  • Next by Date: Subclassing a NSMutableArray
  • Previous by thread: Re: NSImage get / set Pixels
  • Next by thread: Re: NSImage get / set Pixels
  • Index(es):
    • Date
    • Thread