Re: Obtaining unpremultiplied bitmap from PNG file
Re: Obtaining unpremultiplied bitmap from PNG file
- Subject: Re: Obtaining unpremultiplied bitmap from PNG file
- From: David Duncan <email@hidden>
- Date: Thu, 14 Jun 2007 11:30:42 -0700
On Jun 14, 2007, at 11:08 AM, Steve Christensen wrote:
kCGImageAlphaLast is implemented and fully supported for creating
a CGImageRef. What is not implemented is creating a bitmap context
(via CGBitmapContextCreate) that does not use pre-multiplied
alpha. The distinction is subtle, but practically it means that
you can create an image that does not used pre-multiplied alpha,
but in the current API you cannot obtain the pixel data from that
image into your own buffer without getting it pre-multiplied.
And since this seems to come repeatedly, check out <http://
developer.apple.com/qa/qa2001/qa1037.html>, which lists the various
supported parameter combinations for CGBitmapContextCreate. If you
use any others, it fails and returns a null CGContextRef.
Unfortunately, that list is slightly incomplete, as it doesn't
describe the floating point pixel modes that are supported on 10.4 or
later. Specifically:
Gray Colorspace:
32 bbp, 32 bpc, kCGImageAlphaNone | kCGBitmapFloatComponents
RGB Colorspace:
128 bpp, 32 bpc, kCGImageAlphaNoneSkipLast | kCGBitmapFloatComponents
128 bpp, 32 bpc, kCGImageAlphaPremultipliedLast |
kCGBitmapFloatComponents
CMYK Colorspace:
128 bpp, 32 bpc, kCGImageAlphaNone | kCGBitmapFloatComponents
(These are documented in the Quartz 2D Programming Guide currently).
--
David Duncan
Apple DTS Quartz and Printing
email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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