Interface Drawable

All Known Implementing Classes:
AbstractDrawable

public interface Drawable
A drawable is a visual representation of an object of type T. It contains of a list of shapes that can have different visual properties.
  • Method Details

    • getId

      String getId()
    • isPaintTransformable

      boolean isPaintTransformable(Drawable.PaintMode paintMode, int index)
      This can return false to indicate that the paint cannot be transformed in any way for this shape, e.g. if the user has created a color scheme and this is one of the shapes in a drawable for a vertex it will have the same color regardless of the settings in the color scheme if true is returned.
      Parameters:
      paintMode - The paint mode used.
      index - The index of the shape.
      Returns:
      true to never transform the paint of the given paint mode, of the shape at the given index, false to allow paint transformation of the given paint mode and shape.
      See Also:
    • hasShadow

      boolean hasShadow()
      Returns true if a shadow should be rendered below the drawable.
      Returns:
      true if a shadow should be rendered below the drawable.
    • getShapeCount

      int getShapeCount(Rectangle bounds)
      Returns the number of shapes that this drawable contains (not counting the outline shape).
      Parameters:
      bounds - The outer bounds that this drawable should fill up.
      Returns:
      the number of shapes in the drawable
    • getOutline

      Shape getOutline(Rectangle bounds)
      Returns the outline of the drawable. This is the area that marks the outer limit of the drawable, where edges will stop.
      Parameters:
      bounds - The outer bounds that the drawable should fill up
      Returns:
      The outline of the drawable.
    • getShape

      Shape getShape(int index, Rectangle bounds)
      Returns a shape in the drawable.
      Parameters:
      index - the index of the shape, 0 <= i < getShapeCount()
      bounds - The outer bounds that the drawable should fill up
      Returns:
      a shape that is part of the drawable
    • isBorder

      boolean isBorder(int index)
      Returns true if the shape is a border. A border's outline can be changed if the user indicates that this drawable should have another border or if the drawable is selected in the UI. If isBorder() is true getOutlinePaint() and getOutlineStroke() can be ignored by the renderer.
      Parameters:
      index - the index of the shape, 0 <= i < getShapeCount()
      Returns:
      true if the shape is a border
    • isFillImage

      boolean isFillImage(int index)
      Returns true if the shape has a fill image.
      Parameters:
      index - the index of the shape, 0 <= i < getShapeCount()
      Returns:
      true if the shape has a fill image
    • getPaint

      Paint getPaint(Drawable.PaintMode paintMode, int index, Rectangle bounds)
      Returns a paint for a given shape and paint mode.
      Parameters:
      index - the index of the shape, 0 <= i < getShapeCount()
      paintMode - The paint mode.
      bounds - The bounds in which the drawable will be drawn.
      Returns:
      the fill paint of the shape, null if no fill paint
      See Also:
    • getStroke

      Stroke getStroke(int index)
      Returns the stroke of the edge around the shape.
      Parameters:
      index - the index of the shape, 0 <= i < getShapeCount()
      Returns:
      the outline stroke of the shape or null for no stroking of the shape.
    • getFillImage

      Image getFillImage(int index, MTLanguage lang)
      Returns the image that fills the shape. The shape will be stretched to fill the shape.
      Parameters:
      index - the index of the shape, 0 <= i < getShapeCount()
      lang - The language to get the image for.
      Returns:
      the shape's fill image
    • hasText

      boolean hasText(int index)
      Returns true if the shape has text in it.
      Parameters:
      index - the index of the shape, 0 <= i < getShapeCount()
      Returns:
      true if the shape has text.
    • getText

      String getText(int index, MTLanguage lang)
      Returns the text that lies in the shape.
      Parameters:
      index - the index of the shape, 0 <= i < getShapeCount()
      lang - The language to get the text for.
      Returns:
      the shape's text, or null if no text is available
    • getTextFont

      Font getTextFont(int index)
      Returns the font of the shape's text.
      Parameters:
      index - the index of the shape, 0 <= i < getShapeCount()
      Returns:
      the shape's font
    • getTextDirection

      Drawable.TextDirection getTextDirection(int index)
    • getTextHorizontalAlign

      Drawable.TextHorizontalAlign getTextHorizontalAlign(int index)
    • getTextVerticalAlign

      Drawable.TextVerticalAlign getTextVerticalAlign(int index)
    • useHyphenation

      default boolean useHyphenation(int index)
      Returns true if the text at index should be hyphenated. Hyphenation will occur at '-', soft-hyphens or if a hyphenation dictionary is installed.
      Parameters:
      index - the index of the shape, 0 <= i < getShapeCount()
      Returns:
      see method description