Re: Creating a NSBitmapImageRep
Re: Creating a NSBitmapImageRep
- Subject: Re: Creating a NSBitmapImageRep
- From: Dave Hayden <email@hidden>
- Date: Tue, 2 Jul 2002 22:52:10 -0700 (PDT)
On Tue, 2 Jul 2002, Richard Schreyer wrote:
>
The problem is the image isn't getting created correctly. If I give it
>
an alpha of 255, everything works, and I get the desired color. If I
>
set the alpha to 254, and then display the image, it draws black lines
>
across the color in-line with the white portions of the pinstripes
>
behind it. If I set the alpha to 253 or lower, I end up with
>
transparent gray, it's transparency varying with the alpha.
>
>
Does anyone know what might be causing this?
Note this line from the initWithBitmapDataPlanes:... docs:
If a coverage plane exists, the bitmap's color components must be
premultiplied with it.
That means your legal RGB values range from 0 up to alpha, not 255. If
you change your inner loop to
imageBytes[pixIndex] = 0; // red
imageBytes[pixIndex+1] = 0; // green
imageBytes[pixIndex+2] = 128; // blue
imageBytes[pixIndex+3] = 128; // alpha
you'll get a half-transparent fully saturated blue image.
-D
_______________________________________________
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.