gdk bitmap drawing?
Okay, so I'm trying to implement a rounded window in Gtk (gtkmm specifically). The standing answer on the web seems to be that Gtk themes should be used for this task, but it doesn't really fit this task, as I need both rounded and non-rounded windows in the same UI. Additionally, I would like the corners rounded more than I've seen any theme do. (This is for a Screenlet/Applet/Widget thingy.)
Now, my current attempt at an implementation is to pack a table into the window, put drawing areas in the border, and put whatever would have gone in the window into the center of the table. The rounded effect is then created via shaped windows (via gdk_window_shape_combine_mask).
My biggest trouble right now is that I can't seem to draw on the Gdk::Bitmap which would be my shape mask. Previously, I've always gotten these Bitmaps from gdk_pixmap_render_alpha_threshold, but there isn't a pixmap backing the window, and since the window can change size, I need to be able to draw on the Gdk::Bitmap to get the desired effect.
I create the Bitmap with gdk_bitmap_create_from_data, then get it's GC and try to draw on it with that GC and standard GdkDrawable functions (gdk_drawable_draw_arc and gdk_drawable_draw_rectangle). When I do this though, the window I get out is always absent. That is, the window manager decorations appear, but it seems the mask was set to all pixels off.
I suspect that the problem is that my GC's foreground is set to the value which indicates transparent (I assume 0, but maybe 1). Trouble is, I don't see any way to change the foreground color without using a GdkColor, which can't be used until it is allocated, which can only be allocated if my Bitmap has a colormap, which it seems that Bitmaps never do.
So, has anyone here ever had to draw on a Bitmap before? How did you get it done?
|