The GnomeCanvas widget

Introduction

The GnomeCanvas widget is a high-level engine for creating structured graphics. A canvas displays a collection of items, which can be lines, rectangles, ellipses, and text. Items have attributes associated to them that you can change, like fill color, position, and size. Items may be moved and re-stacked in the canvas, and organized in hierarchical groups. You can receive mouse and keyboard events from the items and perform actions on them based on these events.

The canvas is useful for when you want to create interactive graphics displays which would be hard or cumbersome to implement with raw calls to Gdk, or when writing a custom widget for Gtk is inconvenient.

The canvas is also useful to create displays of graphs, diagrams, and many other types of structured drawings. It can even be used as a general display engine — for example, the Gnumeric spreadsheet and the Achtung presentations program both use the GnomeCanvas widget as their display engine.

If the predefined canvas item types do not suit your needs, you can easily write new item types. These can be primitive items, which paint their own displays, or composite items, which are built on top of canvas item groups.