Class StringOverlay

java.lang.Object
is.galia.operation.overlay.Overlay
is.galia.operation.overlay.StringOverlay
All Implemented Interfaces:
Operation

public class StringOverlay extends Overlay implements Operation

Encapsulates a string overlay applied to an image.

Instances should be obtained from the OverlayFactory.

  • Constructor Details

    • StringOverlay

      public StringOverlay(String string, Position position, int inset, Font font, int minSize, Color color, Color backgroundColor, Color strokeColor, float strokeWidth, boolean wordWrap)
  • Method Details

    • getBackgroundColor

      public Color getBackgroundColor()
    • getColor

      public Color getColor()
    • getFont

      public Font getFont()
    • getMinSize

      public int getMinSize()
    • getString

      public String getString()
    • getStrokeColor

      public Color getStrokeColor()
    • getStrokeWidth

      public float getStrokeWidth()
    • hasEffect

      public boolean hasEffect()
      Description copied from interface: Operation
      Simpler but less-accurate counterpart of Operation.hasEffect(Size, OperationList).
      Specified by:
      hasEffect in interface Operation
      Overrides:
      hasEffect in class Overlay
      Returns:
      True if the string length is greater than 0; false if not.
    • isWordWrap

      public boolean isWordWrap()
    • setBackgroundColor

      public void setBackgroundColor(Color color)
      Parameters:
      color - Background color to set.
      Throws:
      IllegalStateException - If the instance is frozen.
    • setColor

      public void setColor(Color color)
      Parameters:
      color - Color to set.
      Throws:
      IllegalStateException - If the instance is frozen.
    • setFont

      public void setFont(Font font)
      Parameters:
      font - Font to set.
      Throws:
      IllegalStateException - If the instance is frozen.
    • setMinSize

      public void setMinSize(int minSize)
      Parameters:
      minSize - Minimum size in pixels
      Throws:
      IllegalStateException - If the instance is frozen.
    • setString

      public void setString(String string)
      Parameters:
      string - String to set.
      Throws:
      IllegalStateException - If the instance is frozen.
    • setStrokeColor

      public void setStrokeColor(Color color)
      Parameters:
      color - Color to set.
      Throws:
      IllegalStateException - If the instance is frozen.
    • setStrokeWidth

      public void setStrokeWidth(float width)
      Parameters:
      width - Width in pixels.
      Throws:
      IllegalStateException - If the instance is frozen.
    • setWordWrap

      public void setWordWrap(boolean wordWrap)
      Parameters:
      wordWrap - Whether to auto-wrap text.
      Throws:
      IllegalStateException - If the instance is frozen.
    • toMap

      public Map<String,Object> toMap(Size fullSize, ScaleConstraint scaleConstraint)
      Specified by:
      toMap in interface Operation
      Parameters:
      fullSize - Full size of the source image on which the operation is being applied.
      scaleConstraint - Scale constraint applied to the given full size.
      Returns:
      Map with background_color, class, color, font, font_size, font_weight, glyph_spacing, inset, position, string, stroke_color, and stroke_width keys.
    • toString

      public String toString()
      Overrides:
      toString in class Object
      Returns:
      String representation of the instance, guaranteed to uniquely represent it, but not guaranteed to be in any particular format.