[cairo] How to generate a 1bit opacity bitmask from a canvas with 8bit alpha channel?
james.su at gmail.com
Sun May 4 21:31:49 PDT 2008
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?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cairo