java2d
Java2d
This package provides a 2D scene graph api based on the rendering
capabilities of java.awt.Graphics2D.
The basic element in the 2D scene is a SceneNode that can provide
all ingredients necessary to draw it: a Shape that can be filled
with a certain Paint, whose outline can be drawn using a certain
Stroke etc.
A Stroke in Java2D provides a way to create a 2-dimensional
shape (that can be filled with a paint) out of the (in principle infinitely
thin) 1-dimensional outline of a shape, in order to make it visible. Thus,
Java2D provides ways to render 2- and 1-dimensional objects. In technical or
mathematical drawings often also 0-dimensional geometries (points) need
graphical representation. Therefore this package introduces (in analogy to a
Stroke) the concept of a Stamp. A Stamp
can generate paintable shapes out of a finite collection of points.
A SceneNode also can have a textual Annotation which
is a collection of strings to be drawn at certain positions.
In addition, a SceneNode can have children, which allows for a
scene that is a directed acyclic graph. Each scene node can have an affine
transformation that describes its orientation with respect to its parents. All
attributes like paint, stroke, font etc. can be null, which means
that they are inherited from the scene hierarchy.
To support dynamic and interactive behaviour, three event types are provided
with this package:
- An
AppearanceChangeEvent can be passed along the hierarchy to
inform viewers that some scene node has changed its look and therefore the scene
needs repainting.
- One can register with a scene node for being informed when a
DragEvent occurs, which means that the user is attempting to
manipulate the node's geometry with some input device (like using a mouse
drag).
- One can register with a viewer for the occurance of a
ViewportChangeEvent. This can be used to create viewport-dependent
geometry like coordinate axes.
|