Re: Persistence with GDK



"Robert A. Knop Jr." <rknop@lilys.lbl.gov> writes: 
> Both, actually.  GtkPreview does keep the RGB data around, but then the
> annotations and such I draw on top of it (by getting the GdkDrawable from
> the Preview widget) go away when the window is hidden and re-exposed.
> 
> I'm looking at using a backing pixmap for the stuff on top (a la the
> Scribble example). However, to do this, I need to be able to copy the
> pixmap on to the window with a transparent color (so that the underlying
> image written to the GtkPreview doesn't get overwritten with the pixmap's 
> background color), but I haven't figured out how to do this.
> 

Ah, I get it now.

I think you'll find that the code is not significantly larger if you
just use GdkDrawingArea instead of preview, and draw the RGB data to
your backing pixmap yourself using the stuff in gdkrgb.h.  Also you
should eliminate all flicker with this tactic, if you were getting
flicker.

GtkPreview is basically useless in this case, all it's doing for you
is a g_malloc() of an RGB buffer and gdk_draw_rgb_image() in the
expose handler.

I guess GtkPreview is pretty useless in general, it barely makes more
sense than a GtkCircles widget that draws circles on the drawing area
for you. I'm told GtkPreview used to make sense because GdkRGB didn't
exist and rendering RGB stuff was much harder than drawing circles,
but now you might as well use drawing area and ignore the preview
widget.

Havoc




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]