de.caff.vic

## Class VectorImage

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

- All Implemented Interfaces:
    PaintableCollector

      public class VectorImage
      extends java.lang.Object
      implements PaintableCollector

  Image based on vector forms..
  Author:
    Rammi

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.util.Map<java.awt.RenderingHints.Key,java.lang.Object>` | `RENDERING_HINTS_QUALITY` Best quality rendering hints.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `VectorImage(java.awt.geom.Dimension2D virtualSize)` Constructor.
    `VectorImage(double virtualSize)` Constructor.
    `VectorImage(double virtualWidth, double virtualHeight)` Constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addPaintable(Paintable paintable)` Add a paintable.
    `java.awt.Image` | `getImage(int size)` Get a square image from this icon.
    `java.awt.Image` | `getImage(int width, int height)` Get an image with the given width and height from this icon.
    `java.util.Collection<Paintable>` | `getPaintables()` Get the paintables of the vector image.
    `VectorImage` | `getRecoloredImage(Function1<java.awt.Color,java.awt.Color> recolor)` Get a recolored version of this vector image.
    `java.awt.geom.Dimension2D` | `getVirtualSize()` Get the virtual size of this icon.
    `void` | `paintTo(java.awt.Graphics2D g2)` Paint this object to the given graphics context.
    `void` | `paintTo(java.awt.Graphics2D g2, double x, double y, double width, double height)` Paint this icon to the given graphics context into the given rectangle.
    `void` | `paintToRect(java.awt.Graphics2D g2, int x, int y, int width, int height)` Paint this object to the given integer rectangle.
    `void` | `paintToRect(java.awt.Graphics2D g2, java.awt.Rectangle rectangle)` Paint this object to the given integer rectangle.
    `void` | `prepareGraphics(java.awt.Graphics2D g2, double x, double y, double width, double height)` Prepare a graphics context so this icon would be placed in a given rectangle

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

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

- - ### Field Detail

    - #### RENDERING_HINTS_QUALITY

          public static final java.util.Map<java.awt.RenderingHints.Key,java.lang.Object> RENDERING_HINTS_QUALITY

      Best quality rendering hints.

  - ### Constructor Detail

    - #### VectorImage

          public VectorImage(@NotNull
                             java.awt.geom.Dimension2D virtualSize)

      Constructor.
      Parameters:
        `virtualSize` - virtual size of this item

    - #### VectorImage

          public VectorImage(double virtualSize)

      Constructor.
      Parameters:
        `virtualSize` - virtual size (width and height) of this icon (positive value expected)

    - #### VectorImage

          public VectorImage(double virtualWidth,
                             double virtualHeight)

      Constructor.
      Parameters:
        `virtualWidth` - virtual width of this icon (positive value expected)
        `virtualHeight` - virtual height of this icon (positive value expected)

  - ### Method Detail

    - #### addPaintable

          public void addPaintable(@NotNull
                                   Paintable paintable)

      Add a paintable.
      Specified by:
        `addPaintable` in interface `PaintableCollector`
      Parameters:
        `paintable` - paintable to add

    - #### getPaintables

          @NotNull
          public java.util.Collection<Paintable> getPaintables()

      Get the paintables of the vector image.
      Returns:
        paintables as unmodifiable collection

    - #### getRecoloredImage

          @NotNull
          public VectorImage getRecoloredImage(@NotNull
                                                        Function1<java.awt.Color,java.awt.Color> recolor)

      Get a recolored version of this vector image.
      Parameters:
        `recolor` - recolor function which substitutes one color with another
      Returns:
        recolored version of this image

    - #### getVirtualSize

          @NotNull
          public java.awt.geom.Dimension2D getVirtualSize()

      Get the virtual size of this icon.
      Returns:
        virtual size

    - #### getImage

          @NotNull
          public java.awt.Image getImage(int size)

      Get a square image from this icon.
      Parameters:
        `size` - image size (positive value expected)
      Returns:
        square image with given size

    - #### getImage

          @NotNull
          public java.awt.Image getImage(int width,
                                                  int height)

      Get an image with the given width and height from this icon.
      Parameters:
        `width` - image width (positive value expected)
        `height` - image height (positive value expected)
      Returns:
        image with given width and height

    - #### prepareGraphics

          public void prepareGraphics(@NotNull
                                      java.awt.Graphics2D g2,
                                      double x,
                                      double y,
                                      double width,
                                      double height)

      Prepare a graphics context so this icon would be placed in a given rectangle
      Parameters:
        `g2` - graphics context (changed after return)
        `x` - x (minimal coordinate) of rectangle
        `y` - y (minimal coordinate) of rectangle
        `width` - width of rectangle (positive)
        `height` - height of rectangle (positive)

    - #### paintTo

          public void paintTo(@NotNull
                              java.awt.Graphics2D g2)

      Paint this object to the given graphics context.
      Parameters:
        `g2` - graphics context (unchanged after return)

    - #### paintTo

          public void paintTo(@NotNull
                              java.awt.Graphics2D g2,
                              double x,
                              double y,
                              double width,
                              double height)

      Paint this icon to the given graphics context into the given rectangle.
      Parameters:
        `g2` - graphics context (not changed)
        `x` - x (minimal coordinate) of rectangle
        `y` - y (minimal coordinate) of rectangle
        `width` - width of rectangle (positive)
        `height` - height of rectangle (positive)

    - #### paintToRect

          public void paintToRect(@NotNull
                                  java.awt.Graphics2D g2,
                                  int x,
                                  int y,
                                  int width,
                                  int height)

      Paint this object to the given integer rectangle. This method takes care of the special pecularities of integer rectangles.
      Parameters:
        `g2` - graphics context (not changed)
        `x` - x coordinate to paint to
        `y` - y coordinate to paint to
        `width` - width to use for painting
        `height` - height to use for painting

    - #### paintToRect

          public void paintToRect(@NotNull
                                  java.awt.Graphics2D g2,
                                  @NotNull
                                  java.awt.Rectangle rectangle)

      Paint this object to the given integer rectangle. This method takes care of the special pecularities of integer rectangles.
      Parameters:
        `g2` - graphics context (not changed)
        `rectangle` - rectangle to draw to (has to be sane, i.e. width and height needs to be positive)