Package generic.theme

# Class IconModifier

java.lang.Object
generic.theme.IconModifier

public class IconModifier extends Object
Class that can transform one icon into another. Useful for scaling, translating, disabling, or overlaying an icon.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `IconModifier(Dimension size, Point translation, Integer rotation, boolean disabled, boolean mirror, boolean flip)`
  Creates an IconModifier that can scale, translate, or disable an icon.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getSerializationString()`
  Returns a string that can be parsed by the `parse(String)` method of this class
  `Icon`
  `modify(Icon icon, GThemeValueMap values)`
  Modifies the given icon by the any of the modifiers set.
  `static IconModifier`
  `parse(String iconModifierString)`
  Parses the given string as one or more icon modifiers
  `void`
  `setDisabled()`
  Sets this modifier to disable an icon
  `void`
  `setFlip()`
  Sets the modifier to flip the icon side to side
  `void`
  `setMirror()`
  Sets the modifier to flip the icon side to side
  `void`
  `setMoveModifier(Point point)`
  Sets the translation for this modifier.
  `void`
  `setRotationModifer(int degrees)`
  Sets the rotation for this modifier.
  `void`
  `setSizeModifier(Dimension size)`
  Sets size modifier.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### IconModifier

    public IconModifier(Dimension size, Point translation, Integer rotation, boolean disabled, boolean mirror, boolean flip)
    Creates an IconModifier that can scale, translate, or disable an icon.
    Parameters:
      `size` - if non-null, scales an icon to this size.
      `translation` - if non-null, translates an icon by this amount
      `rotation` - if non-null, the amount in degrees to rotate the icon
      `disabled` - if true, creates a disabled version of the icon
      `mirror` - if true, the image will have its x values swapped (left to right)
      `flip` - if true, the image will have its y values swapped (turned upside down)

- ## Method Details

  - ### setSizeModifier

    public void setSizeModifier(Dimension size)
    Sets size modifier. Icons that are modified by this IconModifier will be scaled to this size.
    Parameters:
      `size` - the size to scale modified icons.

  - ### setMoveModifier

    public void setMoveModifier(Point point)
    Sets the translation for this modifier. Icons that are modified by this IconModifier will be translated by the amount of the given point.
    Parameters:
      `point` - the x,y amount to translate an image

  - ### setRotationModifer

    public void setRotationModifer(int degrees)
    Sets the rotation for this modifier. Icons that are modified by this IconModifier will be rotated by the given amount (in degrees)
    Parameters:
      `degrees` - the rotation amount;

  - ### setDisabled

    public void setDisabled()
    Sets this modifier to disable an icon

  - ### setMirror

    public void setMirror()
    Sets the modifier to flip the icon side to side

  - ### setFlip

    public void setFlip()
    Sets the modifier to flip the icon side to side

  - ### modify

    public Icon modify(Icon icon, GThemeValueMap values)
    Modifies the given icon by the any of the modifiers set.
    Parameters:
      `icon` - the icon to be modified
      `values` - the ThemeValueMap needed if the modify action is to overlay other icons. The values are used to resolve indirect overlay icon references
    Returns:
      A new Icon that is a modified version of the given icon

  - ### getSerializationString

    public String getSerializationString()
    Returns a string that can be parsed by the `parse(String)` method of this class
    Returns:
      a string that can be parsed by the `parse(String)` method of this class

  - ### parse

    public static IconModifier parse(String iconModifierString) throws ParseException
    Parses the given string as one or more icon modifiers
    Parameters:
      `iconModifierString` - the string to parse as modifiers
    Returns:
      an IconModifier as specified by the given string
    Throws:
      `ParseException` - if the iconModifierString in not properly formatted icon modifier