Using Pixbufs and Pixmaps

I am fairly new to GTK and I am having problems wrapping my head Pixmaps and Pixbufs and how to use them effectively.

What I am trying to do is create a special purpose custom graphing widget (mainly for financial-type data).  I know how to use Gtk2::Gdk::Drawable objects for my rendering, however I'd like to structure my graphs similar to how GIMP handles layering.  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.

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).

I have read through both the C references and the Gtk2::Perl references, but still find it confusing.

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

My imaginary API would look something similar to this:

my $graph = MyGraphClass->new();

$graph->add_object(MyGraphClass::Candlestick->new($graph, $open, $close, $high, $low, $timestamp));
$graph->add_object(MyGraphClass::TrendLine->new($graph, $ts1, $val1, $ts2, $val2));
$graph->add_object(MyGraphClass::Text->new($graph, "Hello World", $timestamp_anchor, $value_anchor));
... for every object on the graph

Each MyGraphClass::XXX class would inherit from a base 'MyGraphClass::Item' class which would emit events for mouse overs, clicks, etc.

The main MyGraphClass class would call a render method for each object, which would pass back a Pixmap?/Pixbuf? which would then be rendered onto the main drawable widget for the graph.  I'd like to extend this eventually to include a number of different types of objects on the graph including animations.

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