Package jcckit.renderer
Class Graphics2DRenderer
- java.lang.Object
-
- jcckit.renderer.Graphics2DRenderer
-
- All Implemented Interfaces:
GraphicalCompositeRenderer,OvalRenderer,PolygonRenderer,RectangleRenderer,Renderer,TextRenderer
public class Graphics2DRenderer extends java.lang.Object implements GraphicalCompositeRenderer, PolygonRenderer, OvalRenderer, TextRenderer, RectangleRenderer
Renderer who draws theGraphicalElementsinto a java.awt.Graphics2D context.The default color for lines and texts is determined by the current color of the Graphics2D context when a new instance of Graphics2DRenderer is created.
The default font is SansSerif-12.
- Author:
- Franz-Josef Elmer
-
-
Constructor Summary
Constructors Constructor Description Graphics2DRenderer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidfinishRendering(GraphicalComposite composite)Finishes rendering of the specified composite.Graphics2DRendererinit(java.awt.Graphics2D graphics)Initializes this instance.voidrender(Oval oval)Paints the specified oval into the current Graphics context.voidrender(Polygon polygon)Paints the specified polygon into the Graphics2D context.voidrender(Rectangle rectangle)Paints the specified rectangle into the current Graphics context.voidrender(Text text)Paints the specified text into the current Graphics context.voidstartRendering(GraphicalComposite composite)Starts rendering of the specified composite.
-
-
-
Method Detail
-
init
public Graphics2DRenderer init(java.awt.Graphics2D graphics)
Initializes this instance. During renderering the current transformation will be leaved unchanged. But the current Clip may be cleared.- Parameters:
graphics- Graphics2D context into which theBaiscGraphicalElementsare painted.- Returns:
- this instance.
-
startRendering
public void startRendering(GraphicalComposite composite)
Starts rendering of the specified composite. Does nothing except if composite has aClippingShape. In this case the Clip of the Graphics2D context becomes the clipping rectangle determined by the bounding box of the ClippingShape.- Specified by:
startRenderingin interfaceGraphicalCompositeRenderer
-
finishRendering
public void finishRendering(GraphicalComposite composite)
Finishes rendering of the specified composite. Does nothing except if composite has aClippingShape. In this case the Clip of the Graphics2D context will be cleared.- Specified by:
finishRenderingin interfaceGraphicalCompositeRenderer
-
render
public void render(Polygon polygon)
Paints the specified polygon into the Graphics2D context.- Specified by:
renderin interfacePolygonRenderer
-
render
public void render(Rectangle rectangle)
Paints the specified rectangle into the current Graphics context.- Specified by:
renderin interfaceRectangleRenderer
-
render
public void render(Oval oval)
Paints the specified oval into the current Graphics context.- Specified by:
renderin interfaceOvalRenderer
-
render
public void render(Text text)
Paints the specified text into the current Graphics context.If the font size is zero the default font size will be used.
If the orientation angle is unequal zero the text will first be painted into an off-screen image and rotated. Finally, it will be drawn into the current Graphics context. Note, that only integer multiples of 90 degree rotation are performed. Other orientation angles will be adjusted to the nearest integer multiple of 90 degree.
- Specified by:
renderin interfaceTextRenderer
-
-