Re: [NSBitmapImageRep getBitmapDataPlanes] copying data?
Re: [NSBitmapImageRep getBitmapDataPlanes] copying data?
- Subject: Re: [NSBitmapImageRep getBitmapDataPlanes] copying data?
- From: Jonathan Taylor <email@hidden>
- Date: Mon, 21 Feb 2011 21:53:19 +0000
On 21 Feb 2011, at 21:29, Quincey Morris wrote:
> On Feb 21, 2011, at 13:19, Jonny Taylor wrote:
>
>> So do I understand it correctly that there is no way at all of peeking (read only) at the pixels of a NSBitmapImageRep without triggering a copy? That's a bit of a shame if so - guess I'll have to look into CoreImage.
>
> If I understand the release notes properly, there are 3 choices:
>
> 1. Draw from the NSBitmapImageRep into some kind of drawing context. This may not be as expensive as it sounds. You could draw into a 1-pixel rect if you wanted.
>
> 2. Get the underlying NSBitmapImageRep data, thus causing a copy. If you're going to be accessing multiple pixel values, this is also not be as expensive as it sounds, so long as you don't do anything that forces the frameworks to copy the data for every pixel.
>
> 3. Use something else, such as CGImage, instead.
Thanks. In this case I need to access every single pixel value unfortunately. I was using NSImages for convenience since I do display some images in the GUI, etc, but the main work of the program involves image processing on the pixel values. Sounds like CGImage is probably what I need if I really want to maximise performance in this case. I'm actually doing a fair amount of work with the pixel data, but nevertheless this one copy (specifically the zero fills as well as memcpy) at the start takes considerably longer than the analysis itself.
Jonny_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden