Re: CGImageRef to bitmap context? [SOLVED]
Re: CGImageRef to bitmap context? [SOLVED]
- Subject: Re: CGImageRef to bitmap context? [SOLVED]
- From: Scott Thompson <email@hidden>
- Date: Mon, 13 Aug 2007 12:00:12 -0500
CGImageRef is certainly a "bitmap style image". All CGImages
represent a rectangular array of color samples (i.e. pixels).
I think I was thrown off by the fact the documentation says that the
only way to guarantee access to equivalent bits is to create a
bitmap context. Which, in my sleep deprived, under-caffeinated
state meant the image were something aside from bitmap images for
some reason!
You should realize that, even though a CGImage represents a
rectangular array of color samples, the object does not have to store
it's contents in a Pixmap.
For example, if you create a CGImage using
CGImageCreateWithJPEGDataProvider
then the computer could store the JPEG data and decompress it
whenever you draw the image.
(This is what CGImage does in practice the last time I checked, but as
that is not documented behavior you should probably not rely on it)
In short, then, the backing store behind a CGImage may not allow for
ready access to any of the pixels in the image. Therefore, that's the
reason you have to draw an image into a CGBitmapContext before you can
get at the pixels. This also gives you a chance to get the pixels in
the pixel format you require.
Scott
_______________________________________________
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