Re: NSBitmapImageRep, precomputing alpha
Re: NSBitmapImageRep, precomputing alpha
- Subject: Re: NSBitmapImageRep, precomputing alpha
- From: Gregory Weston <email@hidden>
- Date: Sat, 22 Dec 2001 22:17:44 -0500
On 12/22/01, Raphael Sebbe <email@hidden> wrote:
>
I just would like to have the confirmation that when manually setting
>
pixel colors of an NSBitmapImageRep with an alpha channel, you MUST
>
manually premultiply the color components by the alpha value (per
>
pixel). It took me hours to figure that out, debugging... Assuming this
>
is correct, it should definitely appear in the doc.
It does. I remember being annoyed when I read that I'd have to do it myself. I'm
not sure how stable the docs have been since 10.0 shipped, but March'd be about
when I read it. You can find a couple of notes to this effect if you look for
"premultiply" or "premultiplied" in Apple's docs.
| A sample is data that describes one component of a pixel. In an RGB color
| system, the red, green, and blue components of a color are specified as
| separate samples, as are the cyan, magenta, yellow, and black components in a
| CMYK system. Color values in a gray scale are a single sample. Alpha values
| that determine transparency and opaqueness are specified as a coverage sample
| separate from color. In bitmap images with alpha, the color (or gray)
| components have to be premultiplied with the alpha. This is the way images
| with alpha are displayed, this is the way they are read back, and this is the
| way they are stored in TIFFs.
I'd agree that there should be more attention drawn to this in the
NSBitmapImageRep documentation.
G