XP is just a number | |
PerlMonks |
Re^3: Pixel-based Plotting in Perl?by mr_mischief (Monsignor) |
on Sep 02, 2008 at 21:40 UTC ( [id://708613]=note: print w/replies, xml ) | Need Help?? |
Basically, Perl doesn't do graphics directly. In order to do so, it would need to be tied to the specifics of the host device. The language itself is more than sufficient to hold and manipulate the data structures involved, although in some complicated cases it might be a little slow.
What is needed is a way to get the shape and color data (or pixel data) into hardware for it to be rendered. That's where these libraries come in. GD, ImageMagick, and Cairo take instructions about shapes, colors, lines, and such and put out graphics formats other systems already understand. They are libraries that are used by your application (C/C++ libraries with Perl wrappers in this case). Tk, Gtk, Qt, SDL, WxWidgets, and OpenGL are APIs for external libraries that are built to actually draw into the windows on various OSes. They each allow you to write to their API and they write to the Windows, X11, Cocoa, or whatever API on the actual OS and device. Each of them is a separate API apart from the others on the list except that a couple of them can use OpenGL as an intermediate back end. All of them AFAIK work on Windows and OS X as well as Linux, Irix, and Solaris. Tk, Gtk, Gtk2, Qt, and WxWidgets are "graphical toolkits". They're made for bringing applications to GUIs without having to write all the windowing code and such. SDL and OpenGL are more general graphics things. There are implementations of those for framebuffer devices and for windowed GUIs (I think Qt has a framebuffer backend for embedded devices, too). In order to just write to the pixels being shown, you'd have to have fairly direct (driver level or lower) access to the video subsystem. In a protected, multi-user OS that's a bad idea. That's why these libraries exist, aside from also making many things easier and more uniform than everyone reinventing their own wheels with incompatible hubs and tires. On a sufficiently single-user system with a smallish single-user OS, one could write to video memory or to the framebuffer device provided by the OS directly still today. The trick is finding such a device.
In Section
Seekers of Perl Wisdom
|
|