Class ImageShape
- java.lang.Object
-
- org.pepstock.charba.client.colors.tiles.ShapeDrawer
-
- org.pepstock.charba.client.colors.tiles.ImageShape
-
public final class ImageShape extends ShapeDrawer
This is a shape which can draw an image on the tile.
This object is also a shape drawer.
The image is scaled to the size of the tile. It designs an image in the following tile sections (only A):
+-------------------+ | | | | | | | A | | | | | | | +-------------------+
- Author:
- Andrea "Stock" Stocchero
-
-
Field Summary
Fields Modifier and Type Field Description static String
IMAGE_SHAPE_NAME
Name of shape to draw an image, "image".
-
Constructor Summary
Constructors Constructor Description ImageShape(Img image)
Creates a shape with an image.
-
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
-
IMAGE_SHAPE_NAME
public static final String IMAGE_SHAPE_NAME
Name of shape to draw an image, "image".- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ImageShape
public ImageShape(Img image)
Creates a shape with an image.- Parameters:
image
- image to draw on tile
-
-
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
-
-