de.caff.vic

## Class RecoloringVisitor

- java.lang.Object
- - java.awt.image.ImageFilter
  - - java.awt.image.RGBImageFilter
    - - de.caff.vic.RecoloringVisitor

- All Implemented Interfaces:
    PaintableVisitor, java.awt.image.ImageConsumer, java.lang.Cloneable

      public class RecoloringVisitor
      extends java.awt.image.RGBImageFilter
      implements PaintableVisitor

  A visitor which creates a recolored version of a paintable.
  Since:
    November 01, 2017
  Author:
    Rammi

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static Function1<java.awt.Color,java.awt.Color>` | `TO_ALPHA_GRAY`
    `static Function1<java.awt.Color,java.awt.Color>` | `TO_GRAY` Recolor function which returns the physiological gray value of a given color.
    `static Function1<java.awt.Color,java.awt.Color>` | `TO_LIGHTER_GRAY` Recolor function which returns a brightened physological gray value of a given color.

    - ### Fields inherited from class java.awt.image.RGBImageFilter

      `canFilterIndexColorModel, newmodel, origmodel`

    - ### Fields inherited from class java.awt.image.ImageFilter

      `consumer`

    - ### Fields inherited from interface java.awt.image.ImageConsumer

      `COMPLETESCANLINES, IMAGEABORTED, IMAGEERROR, RANDOMPIXELORDER, SINGLEFRAME, SINGLEFRAMEDONE, SINGLEPASS, STATICIMAGEDONE, TOPDOWNLEFTRIGHT`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `RecoloringVisitor(Function1<java.awt.Color,java.awt.Color> recolor)` Constructor.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `filterRGB(int x, int y, int rgb)`
    `Paintable` | `getRecoloredPaintable()` Get the recolored paintable.
    `static java.util.Collection<Paintable>` | `recoloredCopy(java.util.Collection<Paintable> paintables, Function1<java.awt.Color,java.awt.Color> recolor)` Get a recolored copy of a collection of paintables.
    `void` | `visit(PaintableClipShape shape)` Visit a clip shape.
    `void` | `visit(PaintableComposite composite)` Visit a paintable composite.
    `void` | `visit(PaintableGroup group)` Visit a paintable group.
    `void` | `visit(PaintableImage image)` Visit a paintable image.
    `void` | `visit(PaintableRestoreTransform restoreTrafo)` Visit a paintable restore transformation.
    `void` | `visit(PaintableShape shape)` Visit a paintable shape.
    `void` | `visit(PaintableStoreTransform storeTrafo)` Visit a paintable store transformation.
    `void` | `visit(PaintableTransform transform)` Visit a paintable transform.

    - ### Methods inherited from class java.awt.image.RGBImageFilter

      `filterIndexColorModel, filterRGBPixels, setColorModel, setPixels, setPixels, substituteColorModel`

    - ### Methods inherited from class java.awt.image.ImageFilter

      `clone, getFilterInstance, imageComplete, resendTopDownLeftRight, setDimensions, setHints, setProperties`

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

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

- - ### Field Detail

    - #### TO_GRAY

          public static final Function1<java.awt.Color,java.awt.Color> TO_GRAY

      Recolor function which returns the physiological gray value of a given color.

    - #### TO_LIGHTER_GRAY

          public static final Function1<java.awt.Color,java.awt.Color> TO_LIGHTER_GRAY

      Recolor function which returns a brightened physological gray value of a given color.

    - #### TO_ALPHA_GRAY

          public static final Function1<java.awt.Color,java.awt.Color> TO_ALPHA_GRAY

  - ### Constructor Detail

    - #### RecoloringVisitor

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

      Constructor.
      Parameters:
        `recolor` - recolor function

  - ### Method Detail

    - #### getRecoloredPaintable

          @NotNull
          public Paintable getRecoloredPaintable()

      Get the recolored paintable. This may only be called after this visitor has visited a paintable.
      Returns:
        recolored paintable created during the last visit

    - #### visit

          public void visit(@NotNull
                            PaintableShape shape)

      Description copied from interface: `PaintableVisitor`
      Visit a paintable shape.
      Specified by:
        `visit` in interface `PaintableVisitor`
      Parameters:
        `shape` - paintable shape

    - #### visit

          public void visit(@NotNull
                            PaintableImage image)

      Description copied from interface: `PaintableVisitor`
      Visit a paintable image.
      Specified by:
        `visit` in interface `PaintableVisitor`
      Parameters:
        `image` - paintable image

    - #### visit

          public void visit(@NotNull
                            PaintableClipShape shape)

      Description copied from interface: `PaintableVisitor`
      Visit a clip shape.
      Specified by:
        `visit` in interface `PaintableVisitor`
      Parameters:
        `shape` - clip shape

    - #### visit

          public void visit(@NotNull
                            PaintableComposite composite)

      Description copied from interface: `PaintableVisitor`
      Visit a paintable composite.
      Specified by:
        `visit` in interface `PaintableVisitor`
      Parameters:
        `composite` - composite

    - #### visit

          public void visit(@NotNull
                            PaintableTransform transform)

      Description copied from interface: `PaintableVisitor`
      Visit a paintable transform.
      Specified by:
        `visit` in interface `PaintableVisitor`
      Parameters:
        `transform` - transform

    - #### visit

          public void visit(@NotNull
                            PaintableStoreTransform storeTrafo)

      Description copied from interface: `PaintableVisitor`
      Visit a paintable store transformation.
      Specified by:
        `visit` in interface `PaintableVisitor`
      Parameters:
        `storeTrafo` - store transformation

    - #### visit

          public void visit(@NotNull
                            PaintableRestoreTransform restoreTrafo)

      Description copied from interface: `PaintableVisitor`
      Visit a paintable restore transformation.
      Specified by:
        `visit` in interface `PaintableVisitor`
      Parameters:
        `restoreTrafo` - restore transformation

    - #### visit

          public void visit(@NotNull
                            PaintableGroup group)

      Description copied from interface: `PaintableVisitor`
      Visit a paintable group.
      Specified by:
        `visit` in interface `PaintableVisitor`
      Parameters:
        `group` - paintable group

    - #### filterRGB

          public int filterRGB(int x,
                               int y,
                               int rgb)

      Specified by:
        `filterRGB` in class `java.awt.image.RGBImageFilter`

    - #### recoloredCopy

          @NotNull
          public static java.util.Collection<Paintable> recoloredCopy(@NotNull
                                                                               java.util.Collection<Paintable> paintables,
                                                                               @NotNull
                                                                               Function1<java.awt.Color,java.awt.Color> recolor)

      Get a recolored copy of a collection of paintables.
      Parameters:
        `paintables` - paintables
        `recolor` - recolorer
      Returns:
        recolored copy of the paintables