• 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: CGImageRef to bitmap context? [SOLVED]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: CGImageRef to bitmap context? [SOLVED]
      • From: David Duncan <email@hidden>
References: 
 >CGImageRef to bitmap context? (From: Mike McNamara <email@hidden>)
 >Re: CGImageRef to bitmap context? (From: Scott Thompson <email@hidden>)
 >Re: CGImageRef to bitmap context? [SOLVED] (From: Mike McNamara <email@hidden>)

  • Prev by Date: Re: CGImageRef to bitmap context? [SOLVED]
  • Next by Date: Re: Cocoa and PICT
  • Previous by thread: Re: CGImageRef to bitmap context? [SOLVED]
  • Next by thread: Re: CGImageRef to bitmap context? [SOLVED]
  • Index(es):
    • Date
    • Thread