Re: premultiplying alpha
Re: premultiplying alpha
- Subject: Re: premultiplying alpha
- From: Ken Ferry <email@hidden>
- Date: Tue, 4 May 2010 22:05:23 -0700
On Tue, May 4, 2010 at 9:30 AM, David Duncan <email@hidden> wrote:
> On May 4, 2010, at 8:57 AM, Thomas Davie wrote:
>
> > After much searching about, I discovered (contrary to what the docs say),
> that NSBitmapImageReps do not always premultiply their r/g/b by their alpha.
>
>
I think you're misreading something. NSAlphaNonpremultipliedBitmapFormat
exists. :-)
Other than that, what David said. You should never be calling -bitmapData
on an NSBitmapImageRep that you did not create explicitly yourself in a
known pixel format.
The 10.6 AppKit release
notes<http://developer.apple.com/mac/library/releasenotes/cocoa/appkit.html>have
a long discussion of such things, concerning performance and
correctness.
-Ken
> Because of this, I've dived in, and attempted to write my own
> premultiplication, but something is going very wrong. Some images are
> coming out a quarter of the width they went in, others coming out completely
> empty...
>
>
> Before diving too deeply into you code, why do you want to do this
> manually? Why not just create a second NSBitmapImageRep with the geometry
> that you desire, then draw the first into the second? This should do the
> premultiplication for you as well as cover any format that NSBitmapImageRep
> supports, rather than the ones that you manually code (as well as being more
> efficient since we've spent the effort to performance optimize those
> conversions).
> --
> David Duncan
> Apple DTS Animation and Printing
>
> _______________________________________________
>
> 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
>
_______________________________________________
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