Package de.erichseifert.gral.graphics
The drawing primitives that every visible part of a plot is built from.
Drawable is a lightweight component:
it has bounds, a preferred size, and a
draw method. It deliberately does not extend
java.awt.Component, which is what allows the same object to be
painted into a Swing panel, an image, a PDF, or a printer page.
AbstractDrawable implements the bounds
handling, so subclasses only have to supply draw and usually
getPreferredSize.
Drawable cross = new AbstractDrawable() {
public void draw(DrawingContext context) {
Graphics2D g = context.getGraphics();
g.draw(new Line2D.Double(getX(), getY(),
getX() + getWidth(), getY() + getHeight()));
}
};
cross.setBounds(0.0, 0.0, 100.0, 50.0);
cross.draw(new DrawingContext(graphics2D));
DrawingContext carries the
Graphics2D to paint on together with two hints: a
DrawingContext.Target that says whether
the output is a pixel raster or a vector document, and a
DrawingContext.Quality level. Renderers
check the target to decide, for example, whether a gradient can be emitted as
vector data or has to be rasterized first.
DrawableContainer holds child
drawables and positions them with a
Layout; this is the base class of
AbstractPlot.
Label draws a rotatable, alignable
piece of text and is used for plot titles, axis labels and legend entries.
Insets2D,
Dimension2D,
Location and
Orientation are the small geometry
types that the AWT lacks in double precision or at all.
- Siehe auch:
-
KlasseBeschreibungBase class for
Drawableimplementations.A width and a height indoubleprecision.Class that stores double values.Something that can paint itself into a rectangle.Everything aDrawableneeds in order to paint itself: theGraphics2Dto paint on, plus two hints about where the output is going.How much effort should be spent on drawing.What kind of output the drawing ends up in.Space to be kept free at the four edges of a container, indoubleprecision.Class that stores insets as double values.ADrawablethat draws a piece of text.One of the nine anchor points of a rectangle: the center, the four edges and the four corners.The direction along which elements are arranged, for example the entries of a legend, the components of aStackedLayout, or the bars of a bar plot.