Graphics in GNOME

What is GTK+?

GTK+ is the Gimp Toolkit. It was originally written as part of the Gimp project, but it has grown into an excellent general purpose widget set. Find out more at http://www.gtk.org

What role does GTK+ play in GNOME?

GTK+ is the interface which GNOME applications use to interact with the user. It is similar to the role of Motif in CDE, Qt in KDE or the-widget-set-which-has-no-name in Win32.

What languages does GTK+ support?

You can write GTK+ programs in tons of languages! Your humble FAQ author knows of the following bindings:

C (original)
C++
Objective C
Python
Perl 5
Scheme (Guile)
TOM
Gwydion Dylan
Ada95
Pike
Pascal (Free Pascal Compiler)

If there are others, then please let us know about them. (See Contact the FAQ Maintainer)

You are encouraged to add bindings to other languages should the fancy strike you. N.b., that the Scheme bindings already have a formalized representation of the API, so if you want to start working on new bindings, then you might want to start from here.

Having written that, I have to wonder if we can't somehow use CORBA to cut this Gordian knot. If the ORBit developers can get the cost of a local CORBA call down to that of a normal shared-library call, then why not CORBify GTK and work on adding bindings for new languages to ORBit? I know, the conventional wisdom is that CORBA is too heavyweight for high-volume stuff like X calls. Hey, don't blame me for throwing out crazy ideas: the reason I maintain the FAQ is that I can't program!

What is imlib?

Along with GTK, GNOME uses imlib, an image library for X which supports multiple image formats transparently to the programmer. Imlib can even use external converter programs like ImageMagick or pmbplus to convert unknown image formats to known formats, so if a converter exists for an image type, you can almost certainly use that image type in your application! Imlib also supports multiple bit-depths, from 24-bit down to 1-bit monochrome, again transparently to the programmer, and does intelligent color map allocation and automatic dithering to get the best possible performance out of your display. Anyone who has ever tried to do this in their X apps, or who has had to endure their screen flashing when apps have to allocate a private color map, you will especially like this feature.

You can find out more about imlib at http://www.labs.redhat.com/imlib.

What's the deal with themes?

Themes let you change the look and feel of GTK+ applications without recompiling them. With themes, you are able to change the theme of all GTK+ apps on a given display at the same time.

There are actually two parts of a theme in GTK+, the engine and the configuration. The engine is a specially constructed shared library with instructions on the themes way to draw the widgets (the controls of a window, like the buttons, scrollbars and menus). The configuration includes information like fonts, colors, which engine to use, and sometimes graphic images to incorporate into the theme. Together, the two make the Theme, and give GTK+ its flexible appearance.

To see some examples of what themed GTK+ apps look like, take a look at: http://gtk.themes.org.

How do I get themes working?

First, you need a recent version of GTK+, I recommend version 1.2.1 at the moment, but 1.2.0 works fine as well. You then get the themes you want. A good selection of themes is available in the gtk-engines module. Even more are available at http://gtk.themes.org.

Many of the themes include an engine. You need to compile the engine, and install it. In gtk-engines, this is done the same way as any GNOME module. The themes from the website might have different instructions, check their documentation. Some of the themes on the website are merely alternate configurations for another engine, many of them are for the pixmap engine in gtk-engines.

Once the theme is installed, you can select them through the GNOME Control Center, under Desktop->Theme Selector. The selector will allow you to choose between all the themes installed on the fly, preview what the the theme will look like, and in version 1.04 or later even let you select the font.

What is OpenGL?

OpenGL is a 2D and 3D rendering API developed by Silicon Graphics that has become a de facto industry standard. Basically, it is a tool to take a viewpoint of 3D space, and produce a 2D image of it suitable for drawing on a screen. To quote SGI's FAQ:

OpenGL is a rendering only, vendor neutral API providing 2D and 3D graphics functions, including modeling, transformations, color, lighting, smooth shading, as well as advanced features like texture mapping, NURBS, fog, alpha blending and motion blur. OpenGL works in both immediate and retained (display list) graphics modes.

GNOME uses an implementation of the OpenGL API called Mesa. Mesa is not OpenGL per se, since it is a Free Software project that has not gone through the OpenGL trademark licensing process, but it is a faithful representation of the OpenGL API. Mesa is not OpenGL(tm) in precisely the same way that GNU/Linux and FreeBSD are not Unix(tm).

What about Drag and Drop support?

GNOME currently uses the Xde Drag and Drop protocol. XDE is being replaced with an implementation of the X Windows Drag-And-Drop Protocol to inter-operate with other toolkits. Find out more at http://www.cco.caltech.edu/~jafl/xdnd/.