[GLLUG] Cross Platform Graphics Library
Jeremy Bowers
jerf at jerf.org
Sat Oct 2 20:22:38 EDT 2004
Frank Louis Tuma wrote:
>
> I am looking for a cross platform c++ graphics library. I am aware of
> GTK+, but not all that familiar with what it has to offer. Is is
> relatively easy to make Visio-style functionality from GTK+ or do I
> have to do a bunch of work to get an interface like that up and running?
> I am already familiar with the windows SDK and plan on coding my
> application in C++. If anybody knows of other graphic libraries or has
> any more info please let me know.
> Thanks!
> /:Frank
GTK+ is better referred to as a "widget library". A "graphics library"
is something like OpenGL (for 3D graphics) or the graphics part of the
SDL (comparable to screen handling in DirectX). In Windows terms, GTK+
is more like the Windows widget set.
Visio-like functionality, at least in the general case, is intrinsically
hard. It is easy to plop a few shapes down, it gets harder if you are
responsible for manipulating them, it gets downright tough if you start
wanting to zoom, automatically re-organize, or do anything else
complicated. It is certainly possible, but no fun.
What are you trying to do, exactly? If all you want is a Visio-like
program that draws things, but you want custom symbols, I'd recommend
looking into Dia and seeing how hard it is to add you custom symbols to
a functional drawing program.
http://www.gnome.org/projects/dia/
Depending on your needs, you may even be able to implement whatever
other advanced features you want as either hacks in Dia, or as filters
on the files Dia outputs.
Failing that, the best toolkit support I've heard of for this sort of
thing is Tk's Canvas widget. However, I don't think you can use that
from C++; Tcl, Python, or Perl seem to be the choices for that. The
Canvas supports dropping objects on it and remembering what they are, so
you can create event handlers for them and such, where most current
Canvas objects only support drawing. From what I gather, both of the
major next versions of GTK+ and QT are going to have much better support
for that, but in the meantime my understanding is they don't.
It is impossible to stay on top of all the major widget sets
capabilities so I welcome correction on any of these points :-)... but
make sure you understand what the Tk Canvas widget can do before
claiming that GTK or QT can match it; it's a rather nice widget to work
with. At least as of about 6 months ago they can not.
More information about the linux-user
mailing list