> Date: Sat, 25 Oct 2008 13:02:24 +0200 > From: kaffeetisch gmx de > To: gtk-perl-list gnome org > Subject: Re: Using Pixbufs and Pixmaps > > Travis Boucher wrote: > > > My imaginary API would look something similar to this: > > > > my $graph = MyGraphClass->new(); $window->add($graph); > > > > $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. > > This sounds like you want to reinvent a canvas. Take a look at Gnome2::Canvas > or Goo::Canvas. Or maybe you can even use an existing charting library? Take a > look at Chart::Clicker, for example. > > -Torsten > I looked at Goo::Canvas and Gnome2::Canvas previously. Although they may work as a base, there are a few reasons I'd prefer to re-invent the wheel. I am still in the process of learning GTK. Most of it I understand or can figure out easy enough, but the Pixmap/Pixbuf stuff is still sorta voodoo, and how they relate to widgets and to each other is also voodoo. I figure a custom graphing widget would be a decent way to learn them. I'd also like to avoid Gnome and Goo::Canvas to make porting to C and other platforms easier. (I find prototyping in PERL alot easier and faster then starting with C). |