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

Gerdus van Zyl gerdusvanzyl at gmail.com
Thu Sep 4 04:42:14 PDT 2008


My only though would be to use an image surface and
cairo_image_surface_get_data to get at the pixel values then generate
a bitmask yourself in code.

~Gerdus

On Thu, Sep 4, 2008 at 12:13 PM, Zhe Su <james.su at gmail.com> wrote:
> 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
>
>
> _______________________________________________
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo
>


More information about the cairo mailing list