[cairo] render in grayscale

Behdad Esfahbod behdad at behdad.org
Wed Sep 23 11:01:02 PDT 2009

You are absolutely right Soeren.  My bad.


On 09/22/2009 03:52 PM, Soeren Sandmann wrote:
> Behdad Esfahbod<behdad at behdad.org>  writes:
>> I think we need to do instead:
>>     1) render to a RGB24 surface
>>     2) render that to an A8 surface
>>     3) use the A8 surface as a mask
>> So, another step needs to be added.
> Will that actually work? I would have thought that rendering an rgb24
> surface to a8 would simply result in an opaque mask (ie,. the opaque
> alpha channel is copied directly and the color information is
> unused). If you set "algorithm" to USE_ALPHA in the attached program,
> it will do this, and it does not work as far as I can tell.
> In cairo master, the HSL_LUMINOSITY operator can be used to get a
> grayscale conversion: compositing the RGB24 on top of opaque white
> using this operator will generate a properly converted grayscale
> image. The attached program will demonstrate this if you set
> "algorithm" to USE_LUMINOSITY.
> If you run it as is, it will just show the color drawing.
> Soren

More information about the cairo mailing list