Class Java2DGraphicsContext
java.lang.Object
nl.colorize.multimedialib.renderer.java2d.Java2DGraphicsContext
- All Implemented Interfaces:
StageVisitor
Uses Java 2D to render graphics. Because of Java 2D's flexibility this class
supports several graphics contexts: drawing can be either directly to a
window using active rendering, but also to a Swing component, or to an image.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedJava2DGraphicsContext(Canvas canvas, nl.colorize.util.stats.Cache<FontFace, Font> fontCache) -
Method Summary
Modifier and TypeMethodDescriptionvoidbind(Graphics2D g2) voiddispose()voiddrawBackground(ColorRGB backgroundColor) voiddrawCircle(Primitive graphic, Circle circle, Transform globalTransform) voiddrawLight(Light light, Transform3D globalTransform) voidvoiddrawMesh(Mesh mesh, Transform3D globalTransform) voiddrawPolygon(Primitive graphic, Polygon polygon, Transform globalTransform) voidvoiddrawSegmentedLine(Primitive graphic, SegmentedLine line, Transform globalTransform) voiddrawSprite(Sprite sprite, Transform globalTransform) voidvoidprepareStage(Stage stage) Prepares visiting the stage.booleanIndicates whether this visitor should visit all graphics, or only graphics that are currently visible.voidvisitContainer(Container container, Transform globalTransform) voidvisitGroup(Group group, Transform3D globalTransform) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface nl.colorize.multimedialib.stage.StageVisitor
finalize2D, finalize3D
-
Constructor Details
-
Java2DGraphicsContext
-
-
Method Details
-
getCanvas
-
bind
-
dispose
public void dispose() -
prepareStage
Description copied from interface:StageVisitorPrepares visiting the stage. This method is called before any of the stage's graphics are visited. It can be used to add initialization logic that should be performed before any graphics can be drawn.- Specified by:
prepareStagein interfaceStageVisitor
-
shouldVisitAllNodes
public boolean shouldVisitAllNodes()Description copied from interface:StageVisitorIndicates whether this visitor should visit all graphics, or only graphics that are currently visible.- Specified by:
shouldVisitAllNodesin interfaceStageVisitor
-
visitContainer
- Specified by:
visitContainerin interfaceStageVisitor
-
drawBackground
- Specified by:
drawBackgroundin interfaceStageVisitor
-
drawLine
- Specified by:
drawLinein interfaceStageVisitor
-
drawSegmentedLine
- Specified by:
drawSegmentedLinein interfaceStageVisitor
-
drawRect
- Specified by:
drawRectin interfaceStageVisitor
-
drawCircle
- Specified by:
drawCirclein interfaceStageVisitor
-
drawPolygon
- Specified by:
drawPolygonin interfaceStageVisitor
-
drawSprite
- Specified by:
drawSpritein interfaceStageVisitor
-
drawText
- Specified by:
drawTextin interfaceStageVisitor
-
visitGroup
- Specified by:
visitGroupin interfaceStageVisitor
-
drawMesh
- Specified by:
drawMeshin interfaceStageVisitor
-
drawLight
- Specified by:
drawLightin interfaceStageVisitor
-