[cairo] Dealing with 1bpp bitmaps in cairo

Mark Leisher mleisher at gmail.com
Thu Dec 22 08:35:20 PST 2011


In updating http://www.math.nmsu.edu/~mleisher/Software/gbdfed to use 
GTK+ 3 and cairo, I needed to render a moderate number (128 to 256) of 
discrete 1bpp images. After lots of experimentation, I finally settled 
on the code below.

Please note that this code has not been tested for endian issues yet, so 
some tweaking may be necessary.

FYI: once you have the surface, you can call cairo_mask_surface() to 
actually render the bitmap. Took me a while to figure that one out.

If there is any better way to deal with this, please let me know.
-- 
Mark Leisher
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cbm.c
Type: text/x-csrc
Size: 1651 bytes
Desc: not available
URL: <http://lists.cairographics.org/archives/cairo/attachments/20111222/d107acb7/attachment.c>


More information about the cairo mailing list