Re: [gtkmm] Any hints on drawing a pixmap on a drawing area in Gtkmm as in the Gtk+ tutorial?



Mark Jones <mark jones106 verizon net> writes:

> On Sun, 2002-12-29 at 04:45, Ainsley Pereira wrote:
> > In message <1041137435 2469 23 camel localhost 1515RioGrande net>
> >           Mark Jones <mark jones106 verizon net> wittered:
> > 
> > > I would like to do something very similar to the Gtk+ tutorial where
> > > they draw on a pixmap and then copy that to their drawing area (for
> > > speed of redraw), but I'm unsure of how to do that in gtkmm.
> > 
> > Look at the pixbuf demo in the gtkmm/demos directory - it shows you exactly
> > what you want.
> 
> I'm not sure that is what I want actually.  :)  Looking through the API
> docs I do not see how to draw lines or points on a pixbuf.  Did I miss
> seeing something?

Pixbufs are client-side pixel-based images. If you want to change the
contents of a pixbuf, you have to deal with the raw data yourself (you
simply get a 'char *'). This is somewhat of a pain sometimes. But
usually you simply load the pixbufs from .png files.

Pixmaps are server-side resources (i.e. stored on the X server to
ensure fast drawing). The X server has facilites to draw on them -
lines, points, etc.:

  http://www.gtkmm.org/gtkmm2/docs/reference/html/classGdk_1_1Drawable.html

Take a look at the examples in the 'examples/drawingarea' directory.

However, instead of dealing with all these things manually, it is much
easier to use the Gnome::Canvas. That's what I do.

-- 
Ole Laursen
http://www.cs.auc.dk/~olau/



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