Class ShapeDrawer
- java.lang.Object
-
- org.pepstock.charba.client.colors.tiles.ShapeDrawer
-
- Direct Known Subclasses:
CharacterShape
,ImageShape
public abstract class ShapeDrawer extends Object
Base class for all shape drawer, classes which must designer on canvas the shape.
A tile is always a square and for some shapes is divided in 4 sections and not all sections are designed.
A tile is designed as following:
+---------+---------+ | | | | | | | | | +---------+---------+ | | | | | | | | | +---------+---------+
Depending on shape, the parts can be designed or not.- Author:
- Andrea "Stock" Stocchero
-
-
Constructor Summary
Constructors Constructor Description ShapeDrawer()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
applyFillProperties(Context2dItem context, String shapeColor)
Applies the common configuration to context for fill designing.protected void
applyStrokeProperties(Context2dItem context, String shapeColor, int size)
Applies the common configuration to context for stroke designing.protected void
applyStrokeProperties(Context2dItem context, String shapeColor, int size, CapStyle lineCap, JoinStyle lineJoin)
Applies the common configuration to context for stroke designing.protected abstract void
drawTile(Context2dItem context, String backgroundColor, String shapeColor, int size)
Draws the tile applying the requested shape.protected Canvas
initCanvas(Canvas outerCanvas, int size)
Initialized the internal canvas to use for drawing.
-
-
-
Method Detail
-
initCanvas
protected final Canvas initCanvas(Canvas outerCanvas, int size)
Initialized the internal canvas to use for drawing.- Parameters:
outerCanvas
- canvas instance of tile factorysize
- dimension of internal canvas- Returns:
- a created and configured canvas element element to use for drawing.
-
drawTile
protected abstract void drawTile(Context2dItem context, String backgroundColor, String shapeColor, int size)
Draws the tile applying the requested shape.- Parameters:
context
- context of canvas to design the shapebackgroundColor
- background of tileshapeColor
- color of shapesize
- the size of tile, which is a square
-
applyStrokeProperties
protected final void applyStrokeProperties(Context2dItem context, String shapeColor, int size)
Applies the common configuration to context for stroke designing.- Parameters:
context
- context of canvas to design the shapeshapeColor
- color of shapesize
- the size of tile, which is a square
-
applyStrokeProperties
protected final void applyStrokeProperties(Context2dItem context, String shapeColor, int size, CapStyle lineCap, JoinStyle lineJoin)
Applies the common configuration to context for stroke designing.- Parameters:
context
- context of canvas to design the shapeshapeColor
- color of shapesize
- the size of tile, which is a squarelineCap
- determines the shape used to draw the end points of lineslineJoin
- determines the shape used to join two line segments where they meet
-
applyFillProperties
protected final void applyFillProperties(Context2dItem context, String shapeColor)
Applies the common configuration to context for fill designing.- Parameters:
context
- context of canvas to design the shapeshapeColor
- color of shape
-
-