public class G2DTextureDrawingTools extends java.lang.Object implements TextureDrawingTools
TextureDrawingTools
.
This implementation create a TextureBufferedImage
an fill it with sprite drawing.Constructor and Description |
---|
G2DTextureDrawingTools(java.awt.Graphics2D g2d)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
accept(Texture texture) |
void |
accept(Texture texture,
java.awt.Color borderColor,
java.awt.Color fillColor) |
void |
accept(TextureDrawer textureDrawer,
int width,
int height,
java.awt.Color borderColor,
java.awt.Color fillColor)
Ask this image to accept a sprite drawer.
|
void |
clear(Color color)
Clear the sprite with the given color.
|
void |
draw(javax.swing.Icon icon,
int x,
int y)
Draw the given
Icon at the given position. |
void |
draw(TextEntity textEntity,
int x,
int y)
Draw the given text at the given position with the given appearance.
|
void |
drawCircle(int x,
int y,
int diameter,
Appearance appearance)
Draw a circle.
|
void |
drawPlus(int size,
Appearance appearance)
Draw a plus.
|
void |
drawPolyline(int[] coordinates,
Appearance appearance)
Draw a polyline.
|
void |
fillDisc(int x,
int y,
int diameter,
Color color)
Fill a disc of given diameter, centered at (x, y) with the given appearance.
|
void |
fillPolygon(int[] coordinates,
Appearance appearance)
Fill a polygon.
|
java.awt.Color |
getColor(Color color) |
void |
setGraphics(java.awt.Graphics2D g2d) |
public G2DTextureDrawingTools(java.awt.Graphics2D g2d)
width
- the image width.height
- the image height.useSquareTexture
- true if square texture is needed.public void setGraphics(java.awt.Graphics2D g2d)
public void accept(Texture texture)
public void accept(Texture texture, java.awt.Color borderColor, java.awt.Color fillColor)
public void accept(TextureDrawer textureDrawer, int width, int height, java.awt.Color borderColor, java.awt.Color fillColor)
spriteDrawer
- the given sprite drawer.public void drawPlus(int size, Appearance appearance)
TextureDrawingTools
drawPlus
in interface TextureDrawingTools
size
- the plus size.appearance
- the used appearance.public void drawPolyline(int[] coordinates, Appearance appearance)
TextureDrawingTools
drawPolyline
in interface TextureDrawingTools
coordinates
- polyline's point coordinates.appearance
- the used appearance.public void fillPolygon(int[] coordinates, Appearance appearance)
TextureDrawingTools
fillPolygon
in interface TextureDrawingTools
coordinates
- polygon's point coordinates.appearance
- the used appearance.public void drawCircle(int x, int y, int diameter, Appearance appearance)
TextureDrawingTools
drawCircle
in interface TextureDrawingTools
x
- the x coordinate of the circle center.y
- the y coordinate of the circle center.diameter
- the circle diameter.appearance
- the circle appearance.public void fillDisc(int x, int y, int diameter, Color color)
TextureDrawingTools
fillDisc
in interface TextureDrawingTools
x
- the x coordinate of the disc center.y
- the y coordinate of the disc center.diameter
- the disc diameter.color
- the disc color.public void draw(TextEntity textEntity, int x, int y)
TextureDrawingTools
draw
in interface TextureDrawingTools
textEntity
- the text entity to draw.x
- the x text position.y
- the y text position.public void draw(javax.swing.Icon icon, int x, int y)
TextureDrawingTools
Icon
at the given position.draw
in interface TextureDrawingTools
icon
- the given icon to paint.x
- the x text position.y
- the y text position.public void clear(Color color)
TextureDrawingTools
clear
in interface TextureDrawingTools
color
- the new background color.public java.awt.Color getColor(Color color)