Re: Obtaining unpremultiplied bitmap from PNG file
Re: Obtaining unpremultiplied bitmap from PNG file
- Subject: Re: Obtaining unpremultiplied bitmap from PNG file
- From: Steve Christensen <email@hidden>
- Date: Thu, 14 Jun 2007 11:08:26 -0700
On Jun 14, 2007, at 10:57 AM, David Duncan wrote:
On Jun 13, 2007, at 2:28 PM, Shamyl Zakariya wrote:
As far as I can tell, Cocoa simply won't give you non-
premultiplied bitmap data. The CG constant kCGImageAlphaLast
( IIRC ) is there, but isn't actually implemented.
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.
On Jun 14, 2007, at 2:34 AM, Barry wrote:
How do I access the pixel data of a CGImage object?
at
http://developer.apple.com/qa/qa2007/qa1509.html
Is this a solution ???
This Q&A demonstrates obtaining the pixel data via a bitmap
context, which as above requires you to work with pre-multiplied data.
_______________________________________________
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