Interface GraphicsContext2D
-
- All Known Implementing Classes:
GDXGraphics2D,Java2DGraphicsContext,TeaGraphicsContext
public interface GraphicsContext2DProvides access to the renderer's 2D drawing operations. The renderer only allows drawing operations to be performed when the frame is rendered.All drawing operations use X and Y coordinates that are relative to the canvas, with the (0, 0) coordinate representing the top left corner. When drawing objects, the X and Y coordinates indicate where the object's center will be drawn. There is no explicit Z coordinate, depth ordering is based on the order in which the graphics are drawn: graphics that are drawn later will overlap graphics that were drawn earlier.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voiddrawBackground(ColorRGB backgroundColor)default voiddrawCircle(Circle circle, ColorRGB color)default voiddrawCircle(Circle circle, ColorRGB color, int alpha)voiddrawCircle(Circle circle, ColorRGB color, AlphaTransform alpha)default voiddrawImage(Image image, float x, float y)voiddrawImage(Image image, float x, float y, Transform transform)default voiddrawPolygon(Polygon polygon, ColorRGB color)default voiddrawPolygon(Polygon polygon, ColorRGB color, int alpha)voiddrawPolygon(Polygon polygon, ColorRGB color, AlphaTransform alpha)default voiddrawRect(Rect rect, ColorRGB color)default voiddrawRect(Rect rect, ColorRGB color, int alpha)voiddrawRect(Rect rect, ColorRGB color, AlphaTransform alpha)default voiddrawSprite(Sprite sprite)default voiddrawText(java.lang.String text, TTFont font, float x, float y)default voiddrawText(java.lang.String text, TTFont font, float x, float y, Align align)voiddrawText(java.lang.String text, TTFont font, float x, float y, Align align, AlphaTransform alpha)default voidfillImage(Image image)Draws an image and stretches it so that it fills the entire canvas.CanvasgetCanvas()default intgetCanvasHeight()default intgetCanvasWidth()
-
-
-
Method Detail
-
getCanvas
Canvas getCanvas()
-
getCanvasWidth
default int getCanvasWidth()
-
getCanvasHeight
default int getCanvasHeight()
-
drawBackground
void drawBackground(ColorRGB backgroundColor)
-
drawRect
void drawRect(Rect rect, ColorRGB color, AlphaTransform alpha)
-
drawCircle
void drawCircle(Circle circle, ColorRGB color, AlphaTransform alpha)
-
drawPolygon
void drawPolygon(Polygon polygon, ColorRGB color, AlphaTransform alpha)
-
drawImage
default void drawImage(Image image, float x, float y)
-
drawSprite
default void drawSprite(Sprite sprite)
-
fillImage
default void fillImage(Image image)
Draws an image and stretches it so that it fills the entire canvas. Note that depending on the canvas size this might mean that the image will be drawn at a different aspect ratio.
-
drawText
void drawText(java.lang.String text, TTFont font, float x, float y, Align align, AlphaTransform alpha)
-
drawText
default void drawText(java.lang.String text, TTFont font, float x, float y)
-
-