Class CharacterShape
- java.lang.Object
-
- org.pepstock.charba.client.colors.tiles.ShapeDrawer
-
- org.pepstock.charba.client.colors.tiles.CharacterShape
-
public final class CharacterShape extends ShapeDrawer
This is a shape which can draw a character on the tile.
This object is also a shape drawer.
The font size is calculated automatically based on tile size.
It designs a char in the following tile sections (A and B):
+---------+---------+ | | | | A | | | | | +---------+---------+ | | | | | B | | | | +---------+---------+
- Author:
- Andrea "Stock" Stocchero
-
-
Field Summary
Fields Modifier and Type Field Description static String
CHARACTER_SHAPE_NAME
Name of shape to draw a character, "char".
-
Constructor Summary
Constructors Constructor Description CharacterShape(String character)
Creates a shape with a character as shape, using the default font familyCharacterShape(String character, String fontFamily)
Creates a shape with a character as shape using passed font family.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
drawTile(Context2dItem context, String backgroundColor, String shapeColor, int size)
Draws the tile applying the requested shape.ShapeDrawer
getDrawer()
Returns the instance of shape drawer.String
getKeyPrefix()
Returns a unique key prefix for shape to use in the cache.protected void
setKeyPrefix(String keyPrefix)
Sets the key prefix for caching.String
value()
Returns the name value of property-
Methods inherited from class org.pepstock.charba.client.colors.tiles.ShapeDrawer
applyFillProperties, applyStrokeProperties, applyStrokeProperties, initCanvas
-
-
-
-
Field Detail
-
CHARACTER_SHAPE_NAME
public static final String CHARACTER_SHAPE_NAME
Name of shape to draw a character, "char".- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CharacterShape
public CharacterShape(String character)
Creates a shape with a character as shape, using the default font family- Parameters:
character
- character to draw in the tile as shape
-
-
Method Detail
-
drawTile
protected void drawTile(Context2dItem context, String backgroundColor, String shapeColor, int size)
Description copied from class:ShapeDrawer
Draws the tile applying the requested shape.- Specified by:
drawTile
in classShapeDrawer
- Parameters:
context
- context of canvas to design the shapebackgroundColor
- background of tileshapeColor
- color of shapesize
- the size of tile, which is a square
-
value
public final String value()
Description copied from interface:Key
Returns the name value of property
-
getDrawer
public final ShapeDrawer getDrawer()
Description copied from interface:IsShape
Returns the instance of shape drawer.
-
getKeyPrefix
public final String getKeyPrefix()
Description copied from interface:IsShape
Returns a unique key prefix for shape to use in the cache.- Specified by:
getKeyPrefix
in interfaceIsShape
- Returns:
- a unique key prefix for shape to use in the cache
-
setKeyPrefix
protected void setKeyPrefix(String keyPrefix)
Sets the key prefix for caching.- Parameters:
keyPrefix
- the key prefix for caching to set
-
-