[cairo] How to generate a 1bit opacity bitmask from a canvas with 8bit alpha channel?

Zhe Su james.su at gmail.com
Thu Sep 4 03:13:44 PDT 2008


Does anyone know how to solve this problem?

James Su

On Mon, May 5, 2008 at 12:31 PM, Zhe Su <james.su at gmail.com> wrote:

> Hi,
>   I want to generate a 1bit opacity bitmask from a canvas with 8bit alpha
> channel, converting all pixels with non-zero alpha value to 1, and pixels
> with zero alpha value to 0. The result bitmask will be used as event mask to
> mask out the mouse event for all fully transparent pixels.
>   I tried to create a canvas with format CAIRO_FORMAT_A1 and draw the
> source canvas onto it, but it always converts all pixels with alpha value
> less than 128 to 0. Unfortunately, it's not what I want. So the question is:
> is it possible to draw a canvas with 8bit alpha channel(eg. ARGB32) onto a
> canvas with only 1bit alpha channel (A1), converting all pixels with
> non-zero alpha value to 1, while others to 0?
>
> Regards
> James Su
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cairographics.org/archives/cairo/attachments/20080904/97d2906e/attachment.html 


More information about the cairo mailing list