Re: GtkImage programming advice required



On Fri, 2005-12-16 at 13:30 +1000, Mike Durham wrote:
> Hi,
> 
> I'm struggling a bit with my first gtkmm prog and need a bit of advice.
> 
> I 'm using Anjuta on Linux and have a main window with buttons, sliders 
> etc created in Glade and also a placeholder for an image. A GtkImage (is 
> this correct?). The image will be an analogue meter indicating signal 
> strength. I have the background bitmap to put into the GtkImage but I 
> have to draw a black line for the needle, and of course update it as and 
> when the signal strength changes.
> 
> So, I guess my question is how do I blit a bitmap image into the 
> GtkImage placeholder?
> 
> I have attempted to find examples of this but they just show simple 
> writing to the whole main window or just loading a bitmap from a file. 
> This of course is not what I want.
> 
> Any help would be much appreciated.

Forget about GtkImage. Create a Gtk::Pixmap. Draw the background,
possibly with the Gdk::Drawable::draw_pixbuf() function to put some kind
of image background into the pixmap, then use Gdk::Drawable::draw_XXXX
to draw your line. pick XXXX to suit how you intend to draw it (anti-
aliased, etc. etc)

the pixmap will be double buffered by GTK.

do the drawing only in an expose handler. do not draw into the pixmap at
other times.

--p





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