Next: Canvas Items and the
Up: The GNOME Canvas: a
Previous: Introduction
The GNOME canvas was originally based on the canvas widget in the Tk
toolkit[9], which is in turn based on Joel Bartlett's ezd
program, which provides structured graphics in a Scheme environment.
The main enhancements that the GNOME canvas provides to the original
Tk design are integration with the GTK+ object and signal/slot
system[5], nested groups of items, generalized affine
transformations, and a high-quality antialiased rendering mode. From
the standpoint of the user, the canvas presents the following
characteristics:
- The user is able to create graphical items like lines, boxes,
ellipses, and text, place them on the canvas, and refer to them later
for manipulation. The attributes of an object can be changed at any
time; these include the color if the item, its line style, and its
position.
- Canvas items receive events just as if they were normal X
windows or other GTK+ widgets. Applications receive these events
with the normal signal/slot system in GTK+. An application can then
connect to the event signals of its canvas items and define the
particular behavior it requires. Common actions include moving an
item when the user clicks and drags it with the mouse, or highlighting
an item by changing its color when the mouse pointer enters the area
occupied by the item.
- Items can be grouped together in canvas item groups, and these
groups can be nested within each other to form a tree structure. A
canvas has a single root group which does not have a parent.
Operations such as deleting or moving a group apply to all its items,
thus making it easy to create hierarchical drawings. It also has
performance advantages since the canvas can use recursive bounding
boxes to cull out items for drawing and hit testing operations.
- Items support arbitrary affine transformations, so they can be
translated, scaled, rotated, and sheared in any way. Affine
transformations apply to item groups as a whole, so the children of a
group will obtain the same base transformation as its parent.
- The zooming factor of the canvas can be changed at any time, and
the canvas will handle all scrolling issues by itself.
- The canvas takes care of all drawing operations so that it never
flickers, and so that the user does not have to worry about repainting
the items he wants to display.
Subsections
Next: Canvas Items and the
Up: The GNOME Canvas: a
Previous: Introduction
Federico Mena Quintero
2000-05-08