Re: precomputing alpha + color accuracy ?
Re: precomputing alpha + color accuracy ?
- Subject: Re: precomputing alpha + color accuracy ?
- From: Raphael Sebbe <email@hidden>
- Date: Sun, 23 Dec 2001 09:43:48 +0100
Thanks, found that text in AppKit functions (MarshmallowLibrarian):
file://localhost/System/Library/Frameworks/AppKit.framework/Versions/C/Resources/
English.lproj/Documentation/Reference/ObjC_classic/Functions/AppKitFunctions.
html
BTW, and on the content this time, it seems to me premultiplying implies
loss of color accuracy. As an example, an image with 0.5 alpha all over
will have all its color components coded on 7 bits instead of 8 (image
is 29 bits), 0.25 -> 6 bits (image is 26 bits) and so on...
So my next question naturally is: is there a way to generate not
premultiplied transparent images (actually, tell NSBitmapImageRep that
the samples are not premultiplied) ? It is really embarrassing not being
able to use all 32 bits in a 32 bits image, especially when you need
high quality output.
Raphael
On Sunday, December 23, 2001, at 04:17 AM, Gregory Weston wrote:
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
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.