Class Java2DGraphicsContext
- java.lang.Object
-
- nl.colorize.multimedialib.renderer.java2d.Java2DGraphicsContext
-
- All Implemented Interfaces:
GraphicsContext
public class Java2DGraphicsContext extends java.lang.Object implements GraphicsContext
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
Constructors Modifier Constructor Description protectedJava2DGraphicsContext(Canvas canvas, StandardMediaLoader mediaLoader)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbind(java.awt.Graphics2D g2)voiddispose()voiddrawBackground(ColorRGB backgroundColor)voiddrawCircle(Circle circle, ColorRGB color, AlphaTransform alpha)voiddrawImage(Image image, float x, float y, Transform transform)voiddrawPolygon(Polygon polygon, ColorRGB color, AlphaTransform alpha)voiddrawRect(Rect rect, ColorRGB color, AlphaTransform alpha)voiddrawText(java.lang.String text, TTFont font, float x, float y, Align align, AlphaTransform alpha)CanvasgetCanvas()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface nl.colorize.multimedialib.renderer.GraphicsContext
drawSprite, drawText, drawText, getCanvasHeight, getCanvasWidth
-
-
-
-
Constructor Detail
-
Java2DGraphicsContext
protected Java2DGraphicsContext(Canvas canvas, StandardMediaLoader mediaLoader)
-
-
Method Detail
-
getCanvas
public Canvas getCanvas()
- Specified by:
getCanvasin interfaceGraphicsContext
-
bind
public void bind(java.awt.Graphics2D g2)
-
dispose
public void dispose()
-
drawBackground
public void drawBackground(ColorRGB backgroundColor)
- Specified by:
drawBackgroundin interfaceGraphicsContext
-
drawRect
public void drawRect(Rect rect, ColorRGB color, AlphaTransform alpha)
- Specified by:
drawRectin interfaceGraphicsContext
-
drawCircle
public void drawCircle(Circle circle, ColorRGB color, AlphaTransform alpha)
- Specified by:
drawCirclein interfaceGraphicsContext
-
drawPolygon
public void drawPolygon(Polygon polygon, ColorRGB color, AlphaTransform alpha)
- Specified by:
drawPolygonin interfaceGraphicsContext
-
drawImage
public void drawImage(Image image, float x, float y, Transform transform)
- Specified by:
drawImagein interfaceGraphicsContext
-
drawText
public void drawText(java.lang.String text, TTFont font, float x, float y, Align align, AlphaTransform alpha)- Specified by:
drawTextin interfaceGraphicsContext
-
-