• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: precomputing alpha + color accuracy ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: precomputing alpha + color accuracy ?


  • Subject: Re: precomputing alpha + color accuracy ?
  • From: David Remahl <email@hidden>
  • Date: Sun, 23 Dec 2001 13:33:53 +0100

Could someone possibly post code that premultiplies a NSBitmapRep? With no
samples premultiplied? Is it simply a matter of doing something on the line
of:

newPxlRed = pxlRed * pxlAlpha (where pxlAlpha is a number from .0-1.0, 1
being opaque)

For all colour samples of all pixels?

/ david

> Thanks, found that text in AppKit functions (MarshmallowLibrarian):
>
> file://localhost/System/Library/Frameworks/AppKit.framework/Versions/C/Resourc
> es/
> 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


References: 
 >Re: precomputing alpha + color accuracy ? (From: Raphael Sebbe <email@hidden>)

  • Prev by Date: Re: precomputing alpha + color accuracy ?
  • Next by Date: Succeeded?
  • Previous by thread: Re: precomputing alpha + color accuracy ?
  • Next by thread: Re: Cross platform Cocoa/Obj-C
  • Index(es):
    • Date
    • Thread