Re: Using Pixbufs and Pixmaps



Travis Boucher <i9169345 hotmail com> writes:

This will require knowledge of how to use Gtk2::Gdk::Pixbuf and
Gtk2::Gdk::Pixmap, but I am unable to wrap my head around these 2
classes and how to apply the properly to a widget (or any drawable for
that matter).

Pixbuf is client-side pixel data, there's not much you can do to draw
into one of them.  They're mostly for loading up .png files into memory
and stuff like that.

Pixmap is server-side, you can draw into it then copy to a window, or
make it the background of a window and stuff like that.  (And "Bitmap"
is just a pixmap with depth==1.)

Once you've got your underlying data versus draw-it notions nice and
clean you can usually just draw straight into the window.

Does anyone have any suggestions for other reference material that
covers these 2 topics in detail, or have any suggestions on how to
proceed?

Most of the gdk docs are pretty poor on the basics.  Start with some of
X and figure how gdk has mangled it :-)

The main MyGraphClass class would call a render method for each
object, which would pass back a Pixmap?/Pixbuf?

You might be better off asking them to draw into a given drawable, with
some global scaling factor or whatnot.

I'd draw a base 'grid' which would contain my X & Y axis labels and
ticks, then have seperate modules draw layers which would overlay to
create the overall graph.

For myself I've been using separate widgets for the axis ticks and
numbers, with the slight idea they might be re-usable.  I guess it
depends whether you want lines and whatnot to extend into and over the
axis bits.



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