Check out the new USENIX Web site. next up previous
Next: Behavior of Items Up: Architecture of the Canvas Previous: Canvas Items and the

Grouping of Items

Items in the canvas are organized in a tree hierarchy. Items can be groups, which are nodes in the tree, or terminal items, which are leaves in the tree. Groups can contain any number of children, which can in turn be terminal items or other groups. Items can thus be nested to an arbitrary depth inside the canvas, making it easy to create hierarchical drawings.

A canvas has a single root group. For very simple drawings or diagrams, the programmer may want to put all items directly under the root group. For more complicated, structured drawings, it will be convenient to create a hierarchical organization -- a circuit editor may want to represent an adder as a group of basic logic gates, which in can in turn be groups of primitive canvas items like lines and rectangles.

The bounding box of a canvas group surrounds all of its children, so drawing and hit testing operations can be made more efficient by recursive culling of items.

Items inside a group are stacked on top of each other, and items that are higher up in the stack obscure the items below them. The canvas provides functions to change the stacking order of items by raising or lowering them within their parent group's stack.


next up previous
Next: Behavior of Items Up: Architecture of the Canvas Previous: Canvas Items and the
Federico Mena Quintero
2000-05-08