[cairo] drawing into GDK bitmap (pixmap of depth 1)?

Eric Smith eric at brouhaha.com
Sun Feb 19 23:38:49 PST 2006


MacSlow wrote:
> There's the catch. You'll need to use
> gtk_widget_input_shape_combine_mask() instead.

Why wouldn't you expect gtk_widget_shape_combine_mask() to work?

If I use gdk to clear the mask bitmap before drawing into it
with Cairo, then pass the result to gtk_widget_shape_combine_mask(),
I get a perfectly fine round window.  My problem is just that I
don't seem to be able to get cairo_fill() to fill a black rectangle
in my bitmap.  It seems to stroke and fill in white regardless of
the color values I pass into cairo_set_source_rgb().

Could Cairo be confused about the "color map" of my bitmap, in
such a way that (0, 0, 0) and (1, 1, 1) both map to the same
pixel value?

> What a funny coincidence. I just solved that problem myself for
> cairo-clock 0.3.1.

I wasn't aware of your cairo-clock; it looks quite nice.  I was trying
to upgrade glock, my crude analog clock program, which was actually
originally written only as a test to figure out how to use
non-rectangular windows with GTK:
    http://www.brouhaha.com/~eric/software/glock/

I've been wanting to switch to Cairo and SVG for a while, but getting
all the necessary components to build on Fedora Core 4 was too much
of a hassle for me, so I waited for FC5test2.

I just tried compiling and running your cairo-clock 0.3 on my
x86_64 system.  I had to change the rsvg_cairo_render() calls to
rsvg_handle_render_cairo() to get it to compile, as the librsvg
folks have renamed the function.  When I run it I get a brief flash
of a window then a segfault.  I haven't yet had time to debug it,
but it could just be some problem with my FC5test2 installation.

Best regards,
Eric



More information about the cairo mailing list