|
Layers
Each canvas pane contains a "stack" of layers laid one on top of the
next. The Diva canvas provides a useful set of layers. A layer will
generally implement the EventAcceptor interface, the VisibleComponent
interface, or both. If it implements EventAcceptor, then the canvas
pane will pass events from the JCanvas to it; if it implements
VisibleComponent, then the canvas pane will ask it to paint itself
when appropriate.
FigureLayer contains a collection of figures, and implements both
EventAcceptor and FigureContainer (and therefore VisibleComponent).
Each of the contained figures has the layer as its parent. Because
there may be a large number of figures, the storage of figures is done
by an implementation of the ZList interface. Currently there is only
one implementation of ZList, BasicZList, but in future an optimized
version will be written.
EventLayer implements EventAccepter, and responds to events by
passing them to any registered LayerListeners or LayerMotionListeners.
This layer is shown in full in the section on events.
OverlayLayer implements VisibleComponent, and is a simple layer
that draws shapes on the screen. All the shapes are drawn with the
same stroke and paint. This layer is intended for use in interactive
applications where "rubber-banding" is required. GridLayer implements
VisibleComponent, and draws a grid according to various parameters.
|