public class ThickShapes extends Object
ThickShapes
class offers advanced drawing facilities, to render thick lines, circles etc. ThickShapes
instance holds a global state (thickness) for all drawings. Several ThickShapes
instances can be created at same time. However a default instance is created by MicroUI framework and is always
available.Modifier and Type | Field and Description |
---|---|
static ThickShapes |
Singleton
Default
ThickShapes instance. |
Constructor and Description |
---|
ThickShapes()
Creates a new
ThickShapes instance. |
Modifier and Type | Method and Description |
---|---|
void |
drawCircle(GraphicsContext gc,
int x,
int y,
int diameter)
Draws the outline of a circle covering the rectangle specified by its diameter, using the
GraphicsContext
's current color.The center of the circle is defined as the center of the rectangle whose origin is at (x,y)
(upper-left corner) and whose dimension is given by diameter .If diameter is negative, nothing is drawn. |
void |
drawCircleArc(GraphicsContext gc,
int x,
int y,
int diameter,
int startAngle,
int arcAngle)
Draws the outline of a circular arc covering the specified square, using the
GraphicsContext 's current
color.The arc is drawn from startAngle up to arcAngle degrees. |
void |
drawLine(GraphicsContext gc,
int x1,
int y1,
int x2,
int y2)
|
int |
getThickness()
Returns the current
thickness . |
void |
reset()
Resets the
ThickShapes global state to its initial values. |
void |
setThickness(int thickness)
Apply a new
thickness . |
public static ThickShapes Singleton
ThickShapes
instance.public ThickShapes()
ThickShapes
instance. The global state is set to its initial value.reset()
public void reset()
ThickShapes
global state to its initial values. Default thickness
is 1.public int getThickness()
thickness
.thickness
.public void setThickness(int thickness)
thickness
.thickness
- the new thickness to apply.IllegalArgumentException
- when given thickness is negativepublic void drawLine(GraphicsContext gc, int x1, int y1, int x2, int y2)
gc
- the GraphicsContext
where render the drawing.x1
- the x coordinate of the start of the line.y1
- the y coordinate of the start of the line.x2
- the x coordinate of the end of the line.y2
- the y coordinate of the end of the line.public void drawCircle(GraphicsContext gc, int x, int y, int diameter)
GraphicsContext
's current color.(x,y)
(upper-left corner) and whose dimension is given by diameter
.diameter
is negative, nothing is drawn.gc
- the GraphicsContext
where render the drawing.x
- the x coordinate of the upper-left corner of the rectangle where the circle is drawn.y
- the y coordinate of the upper-left corner of the rectangle where the circle is drawn.diameter
- the diameter of the circle to draw.public void drawCircleArc(GraphicsContext gc, int x, int y, int diameter, int startAngle, int arcAngle)
GraphicsContext
's current
color.startAngle
up to arcAngle
degrees. The center of the arc is
defined as the center of the rectangle whose origin is at (x,y)
(upper-left corner) and whose
dimension is given by diameter
.diameter
is negative, nothing is drawn.gc
- the GraphicsContext
where render the drawing.x
- the x coordinate of the upper-left corner of the rectangle where the arc is drawn.y
- the y coordinate of the upper-left corner of the rectangle where the arc is drawn.diameter
- the diameter of the arc to draw.startAngle
- the beginning angle of the arc to draw.arcAngle
- the angular extent of the arc from startAngle
.