Class ImageShape

  • All Implemented Interfaces:
    IsShape, Key

    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 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 class ShapeDrawer
        Parameters:
        context - context of canvas to design the shape
        backgroundColor - background of tile
        shapeColor - color of shape
        size - the size of tile, which is a square
      • value

        public final String value()
        Description copied from interface: Key
        Returns the name value of property
        Specified by:
        value in interface Key
        Returns:
        the name value of property
      • getDrawer

        public final ShapeDrawer getDrawer()
        Description copied from interface: IsShape
        Returns the instance of shape drawer.
        Specified by:
        getDrawer in 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 interface IsShape
        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