"be consistent" | |
PerlMonks |
Re: Pixel-based Plotting in Perl?by mr_mischief (Monsignor) |
on Sep 02, 2008 at 20:55 UTC ( [id://708600]=note: print w/replies, xml ) | Need Help?? |
There are a few options, none of which are AFAICT perfect for what you're wanting.
GD, GD::Simple and Image::Magick will let you work with graphics files and save them. Then you'll need something to display those files. Tk, The GIMP (perhaps with Gimp::Fu managing it), a browser, Prima (particularly Prima::Image perhaps), wxWidgets (with Wx, or something could take care of the display. Some of those graphics loaders and GUI toolkits let you draw point by point in them, too. See Prima::Drawable and Tk::Canvas. You can also tie into SDL and OpenGL (perhaps OpenGL::Simple). Those will give you even more graphics control than you're probably looking to use. You can even use SDL n conjunction with OpenGL or WxWidgets in conjunction with OpenGL. There are Gtk and Qt, which are the graphics toolkits for Gnome and KDE. Perhaps you're looking for something like Graphics::Simple, which is much like what some languages close to the metal of their platforms used to handle. It's marked as alpha and uses GTK or Postscript back ends. You don't really say whether you want to show the drawing in progress on the screen or to show the result. Some of these options only really fit well into the completed image work flow. Others work well with updating the graphics on screen as you add or change elements. SDL, OpenGL, Tk, Prima, Gtk, Qt, and Graphics::Simple seem to be among those. Portability is another issue. Tk, SDL, OpenGL, Qt, and Gtk can be used on most platforms but require the relevant libraries to be there. Prima is an option in Perl, but the others have bindings for other languages. Your main issue here is that Perl is widget/toolkit/canvas ambivalent. The dialect of Basic you mentioned was tied tightly to the nature of the computer that drew the pixels for it. Once you pick a way to display your pixels, your application will be tied to some library unless you go the extra mile to make a handle of them interchangeable back ends. (That would be a neat trick, and many people would appreciate a module that wrapped Qt, Gtk, Prima, Tk, and SDL's graphics with a unified API. I doubt you're interested in doing that much work on it, though).
In Section
Seekers of Perl Wisdom
|
|