de.caff.vic

## Class DynamicallyScaledIcon

- java.lang.Object
- - de.caff.vic.DynamicallyScaledIcon

- All Implemented Interfaces:
    RecolorableIcon, javax.swing.Icon

      public class DynamicallyScaledIcon
      extends java.lang.Object
      implements RecolorableIcon

  Dynamically scaled icon depending on an UI font resource.

  This makes the size of the icon depend on a UI font resource.

  Since:
    October 26, 2017
  Author:
    Rammi

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DynamicallyScaledIcon(VectorImage image, java.lang.String uiFontResource, double scaling)` Constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getIconHeight()`
    `int` | `getIconWidth()`
    `DynamicallyScaledIcon` | `getRecoloredIcon(Function1<java.awt.Color,java.awt.Color> recolor)` Get a recolored version of this icon.
    `void` | `paintIcon(java.awt.Component c, java.awt.Graphics g, int x, int y)`

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

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

- - ### Constructor Detail

    - #### DynamicallyScaledIcon

          public DynamicallyScaledIcon(@NotNull
                                       VectorImage image,
                                       @NotNull
                                       java.lang.String uiFontResource,
                                       double scaling)

      Constructor.
      Parameters:
        `image` - vector image
        `uiFontResource` - name of an UI font resource
        `scaling` - scaling of the icon relative to the font size

  - ### Method Detail

    - #### getRecoloredIcon

          @NotNull
          public DynamicallyScaledIcon getRecoloredIcon(@NotNull
                                                                 Function1<java.awt.Color,java.awt.Color> recolor)

      Get a recolored version of this icon.
      Specified by:
        `getRecoloredIcon` in interface `RecolorableIcon`
      Parameters:
        `recolor` - recolor function defining the mapping between old and new colors
      Returns:
        recolored version of this icon

    - #### paintIcon

          public void paintIcon(java.awt.Component c,
                                java.awt.Graphics g,
                                int x,
                                int y)

      Specified by:
        `paintIcon` in interface `javax.swing.Icon`

    - #### getIconWidth

          public int getIconWidth()

      Specified by:
        `getIconWidth` in interface `javax.swing.Icon`

    - #### getIconHeight

          public int getIconHeight()

      Specified by:
        `getIconHeight` in interface `javax.swing.Icon`