[cairo] How to render 1bpp bitmaps normally & selected (in GTK+ 3)
mleisher at gmail.com
Mon Jul 11 13:20:28 PDT 2011
On 07/11/2011 12:40 PM, Maarten Bosmans wrote:
> 2011/7/11 Mark Leisher<mleisher at gmail.com>:
>> It took a while to piece this together, so for future reference.
>> Is there a more elegant solution?
> From the subject it seems that you want the bitmap to draw inverted
> when the widget is selected. Why don't you just give the right
> GtkStateFlags to gtk_style_context_get_color? That would take care of
> the right forground/background colors for normal/selected and gives a
> result more consistent with the current theme.
What I'm working on is porting
http://www.math.nmsu.edu/~mleisher/Software/gbdfed to Gtk+ 3. I need to
be able to select/deselect individual glyph bitmaps in discrete
rectangular areas. Sort of like a spreadsheet for glyph bitmaps.
Selected is not really a state that applies to this custom widget as a
In response to your reply on gtk-list:
1. You mention the XOR operator. I never could get it to work (OpenSuSE
11.4 32-bit/Gtk+ 3.0.10/cairo 1.10.2) and never managed to dig up any
examples that did. The DIFFERENCE operator worked exactly as advertised,
but it wasn't quite what I was looking for. Before I dig into the cairo
sources, any pointers to XOR examples that work?
2. The rectangle geometry and bitmap offsets are just chosen as an
example "cell" in the "spreadsheet."
More information about the cairo