jv.number

## Class PdColor

- java.lang.Object
- - jv.object.PsObject
  - - jv.number.PdColor

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, PsUpdateIf

      public final class PdColor
      extends PsObject

  RGBA color class with info panel and update functionality.

  The class is derived from PsObject rather than java.awt.Color since the focus of this class is the update functionality and handling of an info panel for interactive modifications. This class allows interactive modification of a color similar to the class PuDouble and PuInteger allow for double and integer numbers. Also, java.awt.Color cannot be modified after construction.

  See Also:
    `PdColor_IP`, `PdColor_Dialog`, Serialized Form

- - ### Field Summary

    - ### Fields inherited from class jv.object.PsObject

      `HAS_BOUNDARY_PANEL, HAS_CONFIG_PANEL, HAS_INFO_PANEL, HAS_LABEL_PANEL, HAS_MATERIAL_PANEL, HAS_TEXTURE_PANEL, HAS_VECTOR_PANEL, INSPECTOR_INFO, INSPECTOR_INFO_EXT, IS_DELETED, IS_FIXED, IS_FOCUSSED, IS_PICKED, IS_SELECTED, IS_USED, NUM_TAGS`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PdColor()` Constructor of color in RGB mode with alpha disabled.
    `PdColor(int size, boolean bAlpha)` Constructor of color in RGB mode with number of color components and possible alpha channel.
    `PdColor(java.lang.String name, PsUpdateIf parent)` Constructor of color in RGB mode with alpha disabled.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static java.awt.Color` | `blend(double a, java.awt.Color v, double b, java.awt.Color w)` Interpolate between two colors with given weights.
    `static int` | `blend(double a, int v, double b, int w)` Interpolate between two colors with given weights.
    `void` | `blend(double a, PdColor v, double b, PdColor w)` Interpolate between two colors with given weights.
    `void` | `blendBase(PdColor v, double b, PdColor w)` Interpolate between two colors with given weights.
    `static java.awt.Color` | `brighter(java.awt.Color color)` Modified against official Java implementation to ensure that the brighter color is visually different.
    `java.lang.Object` | `clone()` Duplicate color and data array.
    `static java.awt.Color` | `cmyk2rgb(int c, int m, int y, int k)` Convert a set of (cyan, magenta, yellow, black) to RGB color.
    `static boolean` | `copy(java.awt.Color[] dataDest, int destInd, java.awt.Color[] dataSrc, int srcInd, int size)` Assign some colors of a given array of colors to an existing destination array.
    `void` | `copy(double[] anArray, int aSize)` Copy color components excluding alpha.
    `void` | `copy(int[] anArray, int aSize)` Copy color components excluding alpha.
    `void` | `copy(PdColor v)` Copy color components including alpha.
    `static boolean` | `copy(PdColor[] dataDest, int destInd, PdColor[] dataSrc, int srcInd, int size)` Copies some colors of a given array of colors into an existing destination array.
    `static java.awt.Color[]` | `copyNew(java.awt.Color[] data)` Create an new array with copies of all colors of a given array of colors.
    `static java.awt.Color[]` | `copyNew(java.awt.Color[] data, int size)` Create an new array with copies of the first 'size' colors of a given array of colors.
    `static PdColor` | `copyNew(PdColor v)` Create a new color as clone of argument color.
    `static PdColor[]` | `copyNew(PdColor[] data)` Create an new array with copies of all colors of a given array of colors.
    `static PdColor[]` | `copyNew(PdColor[] data, int size)` Create an new array with copies of the first 'size' colors of a given array of colors.
    `void` | `enableAlpha(boolean flag)` Enable or disable alpha channel.
    `boolean` | `equals(java.awt.Color col)` Determines whether another color is equal to this color.
    `boolean` | `equals(PdColor col)` Determines whether another color is equal to this color.
    `int` | `getAlpha()` Get alpha component if alpha is enabled, otherwise result is 0.
    `int` | `getBlue()` Get blue color component if `size==3`, otherwise result is 0.
    `java.awt.Color` | `getColor()` Convert color components in a java.awt.Color instance.
    `static int` | `getColor(int a, int[] rgb)` Convert RGBA color components in range [0,255] to integer color.
    `static int` | `getColor(int a, int r, int g, int b)` Convert RGBA color components in range [0,255] to integer color.
    `static java.awt.Color` | `getColorFromID(int colorID, boolean bDirect)` Returns an indexed color, either red, green, blue in direct mode, or cyan, magenta, yellow in indirect mode based in incrementable numbers 0, 1, 2.
    `static java.awt.Color` | `getColorFromName(java.lang.String color)` Convert a verbal color descriptor into a color instance.
    `static java.awt.Color` | `getDimmedColor(java.awt.Color col, double dim)` Get a color whose components are dimmed by a factor.
    `static java.awt.Color` | `getDimmedColor(java.awt.Color col, double dim, double offset)` Get a color whose components are dimmed by a factor and shifted by an offset.
    `static java.awt.Color` | `getDimmedColor(java.awt.Color col, int dim)` Get a color whose components are dimmed by a factor.
    `static int` | `getDimmedColor(int[] rgb, int dim)` Get a color whose components are dimmed by a factor.
    `static int` | `getDimmedColor(int rgb, double dim)` Get a color whose components are dimmed by a factor.
    `static int` | `getDimmedColor(int rgb, double dim, double offset)` Get a color whose components are dimmed by a factor and shifted by an offset.
    `static int` | `getDimmedColor(int rgb, int dim)` Get a color whose components are dimmed by a factor.
    `int` | `getEntry(int ind)` Get a color component with given index.
    `int` | `getGreen()` Get green color component if `size==3`, otherwise result is 0.
    `int` | `getGrey()` Get grey color if `size==1`, otherwise result is 0.
    `static int` | `getMax(int rgb)` Get maximal value of all components.
    `static int` | `getMin(int rgb)` Get minimal value of all components.
    `int` | `getRed()` Get red color component if `size==3`, otherwise result is 0.
    `int` | `getSize()` Return number of components excluding alpha.
    `static java.awt.Color` | `getXORColor(java.awt.Color colCurr, java.awt.Color colPref, java.awt.Color colAlt, int eps)` Choose a new color depending on the distance to an existing color.
    `boolean` | `hasAlpha()` Check whether alpha channel is used.
    `static java.awt.Color` | `hsl2rgb(int hi, int li, int si)`
    `static java.awt.Color` | `hsv2rgb(java.awt.Color hsv)` Conversion of color spaces.
    `static java.awt.Color` | `hsv2rgb(int h, int s, int v)` Conversion of color spaces.
    `static void` | `hsv2rgb(PdColor rgb, PdColor hsv)` Conversion of color spaces.
    `static int` | `hsv2rgbAsInt(int h, int s, int v)` Conversion of color spaces.
    `int` | `indexOfMax()` Find component in color with maximal value.
    `int` | `indexOfMin()` Find component in color with minimal value.
    `void` | `init()` Initialize and reset components to 0.
    `boolean` | `isEnabled()` Check whether color dialog is enabled or disabled.
    `int` | `max()` Find maximal value of component in color.
    `int` | `min()` Find minimal value of component in color.
    `static java.awt.Color` | `parseColor(java.lang.String colorString)` Parse rgb color from a given string where each component is integer in the range 0..255 or a float in the range [0.,1.], or the whole color string is in Html HEX representation such as "#FF0039".
    `static java.awt.Color` | `parseNamedColor(java.lang.String str)` Parse a named color string into a java.awt.Color.
    `static java.awt.Color[]` | `realloc(java.awt.Color[] data, int arraySize)` Allocate an array of Java colors and assign default color black.
    `static PdColor[]` | `realloc(PdColor[] data, int arraySize, int colorSize)` Allocate an array of colors, where all colors have the same dimension.
    `static PdColor[]` | `realloc(PdColor[] data, int arraySize, int colorSize, boolean bAlpha)` Allocate an array of colors, where all colors have the same dimension.
    `static int[]` | `rgb2cmyk(int r, int g, int b)` Convert a set of (cyan, magenta, yellow, black) to RGB color.
    `static java.awt.Color` | `rgb2hsl(int ri, int gi, int bi)`
    `static void` | `rgb2hsv(PdColor hsv, PdColor rgb)` Conversion of color spaces.
    `static java.awt.Color` | `rgb2yiq(int ri, int gi, int bi)`
    `void` | `set(double grey)` Set grey component of this color using double arguments in [0., 1.].
    `void` | `set(double red, double green, double blue)` Set components of this color using double arguments in [0., 1.].
    `void` | `set(double red, double green, double blue, double alpha)` Set components of this color using double arguments in [0., 1.].
    `void` | `set(int grey)` Set grey component of this color using integer argument in [0, 255].
    `void` | `set(int red, int green, int blue)` Set components of this color using integer argument in [0, 255].
    `void` | `set(int red, int green, int blue, int alpha)` Set components of this color using double arguments in [0, 255].
    `void` | `setAlpha(double alpha)` Set alpha component of this color using double argument in [0., 1.].
    `void` | `setAlpha(int alpha)` Set alpha component of this color using integer argument in [0, 255].
    `void` | `setColor(java.awt.Color aColor)` Set color components to components of argument color.
    `void` | `setConstant(int value)` Set all color components excluding alpha to the same value.
    `void` | `setEnabled(boolean flag)` Enable or disable the color dialog for interactive use.
    `void` | `setEntry(int ind, double value)` Set a color component with given index to value.
    `void` | `setEntry(int ind, int value)` Set a color component with given index to value.
    `void` | `setSize(int aSize)` Set number of components of color excluding alpha.
    `static java.lang.String` | `toString(java.awt.Color col, java.lang.String sep)` Get string representation of color components with given separator string.
    `static java.lang.String` | `toStringAsFloat(java.awt.Color col, java.lang.String sep)` Get string representation of color components with given separator string and range of color components scaled to interval [0.,1.].
    `static java.awt.Color` | `yiq2rgb(int yi, int ii, int qi)`

    - ### Methods inherited from class jv.object.PsObject

      `addInspector, addUpdateListener, assureInspector, clearTag, clone, clone, copy, getFather, getInfoPanel, getInspector, getName, getNumObjects, getSymbol, hasInspector, hasTag, hasUpdateListener, instanceOf, instanceOf, newInspector, newInspector, removeInspector, removeInspector, removeUpdateListener, setName, setParent, setSymbol, setTag, toString, update, updatePanels`

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

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

- - ### Constructor Detail

    - #### PdColor

          public PdColor()

      Constructor of color in RGB mode with alpha disabled. Calls PdColor(m_numDefColors, false).

    - #### PdColor

          public PdColor(int size,
                 boolean bAlpha)

      Constructor of color in RGB mode with number of color components and possible alpha channel.
      Parameters:
        `size` - number of color components excluding alpha
        `bAlpha` - `true` to enable alpha channel

    - #### PdColor

          public PdColor(java.lang.String name,
                 PsUpdateIf parent)

      Constructor of color in RGB mode with alpha disabled.
      Parameters:
        `name` - name of color, e.g. used as header in info panel
        `parent` - parent receives update events, e.g. when color changes through info panel

  - ### Method Detail

    - #### init

          public void init()

      Initialize and reset components to 0.
      Overrides:
        `init` in class `PsObject`

    - #### isEnabled

          public boolean isEnabled()

      Check whether color dialog is enabled or disabled.

    - #### setEnabled

          public void setEnabled(boolean flag)

      Enable or disable the color dialog for interactive use. If disabled, the color variable can still be modified by calls `setValue(double)`, and the color dialog is always updated.

    - #### getColor

          public static int getColor(int a,
                     int r,
                     int g,
                     int b)

      Convert RGBA color components in range [0,255] to integer color.
      Returns:
        integer color representation in RGBA format

    - #### getColor

          public static int getColor(int a,
                     int[] rgb)

      Convert RGBA color components in range [0,255] to integer color.
      Returns:
        integer color representation in RGBA format

    - #### getColorFromName

          public static java.awt.Color getColorFromName(java.lang.String color)

      Convert a verbal color descriptor into a color instance. Currently all static names in java.awt.Color supported.
      Parameters:
        `color` - Name of color, e.g. white, gray, orange
      Returns:
        instance of java.awt.Color representing the color

    - #### getColorFromID

          public static java.awt.Color getColorFromID(int colorID,
                                      boolean bDirect)

      Returns an indexed color, either red, green, blue in direct mode, or cyan, magenta, yellow in indirect mode based in incrementable numbers 0, 1, 2.
      Parameters:
        `colorID` - ID of color in {0, 1, 2}
        `bDirect` - Mode determines if direct or complementary colors.
      Returns:
        instance of java.awt.Color representing the color

    - #### getSize

          public int getSize()

      Return number of components excluding alpha.

    - #### setSize

          public void setSize(int aSize)

      Set number of components of color excluding alpha. Note, alpha must be enabled separately. Note, alpha should be enabled before this method is called to allow this method to allocate alpha channel simultaneously with of other channels. All memory allocations are done in this method.
      Parameters:
        `aSize` - number of color components, e.g. 3 in rgb mode.

    - #### equals

          public boolean equals(java.awt.Color col)

      Determines whether another color is equal to this color. The result is `true` if both colors have same color components excluding alpha. Result is also `true` if argument color is null and this color has no entries.

      Alpha is not compared since Java1.1 does not support alpha in java.awt.Color.

      Parameters:
        `col` - the color to compare with
      Returns:
        `true` if the color component are the same; `false` otherwise.

    - #### equals

          public boolean equals(PdColor col)

      Determines whether another color is equal to this color. The result is `true` if both colors have same size and equal components including alpha. Result is also `true` if argument color is null and this color has no entries.
      Parameters:
        `col` - the color to compare with
      Returns:
        `true` if the objects are the same; `false` otherwise.

    - #### getGrey

          public int getGrey()

      Get grey color if `size==1`, otherwise result is 0.

    - #### getRed

          public int getRed()

      Get red color component if `size==3`, otherwise result is 0.

    - #### getGreen

          public int getGreen()

      Get green color component if `size==3`, otherwise result is 0.

    - #### getBlue

          public int getBlue()

      Get blue color component if `size==3`, otherwise result is 0.

    - #### getAlpha

          public int getAlpha()

      Get alpha component if alpha is enabled, otherwise result is 0.

    - #### getMax

          public static int getMax(int rgb)

      Get maximal value of all components.
      Since:
        JavaView 3.54.001

    - #### getMin

          public static int getMin(int rgb)

      Get minimal value of all components.
      Since:
        JavaView 3.54.001

    - #### brighter

          public static java.awt.Color brighter(java.awt.Color color)

      Modified against official Java implementation to ensure that the brighter color is visually different. Each color component `x` is mapped to `127+x/2`. As a consequence we have: 1. black.brighter() returns grey=(128,128,128) 2. applying brighter to blue returns lighter blue = (128,128,255) 3. non pure color (non zero rgb) will eventually return white

      This method is intended as a replacement of java.awt.Color#brighter. The original method simply multiplies each component with something like 1.4 which has no visual consequences for dark colors.

      Since:
        JavaView 2.86.000

    - #### getDimmedColor

          public static int getDimmedColor(int[] rgb,
                           int dim)

      Get a color whose components are dimmed by a factor. Product of factor and color component is constraint to interval [0,255]. Method does not change components of this color.
      Parameters:
        `rgb` - color to modify.
        `dim` - factor in [0,255] to be multiplied to all color components.
      Returns:
        new color value
      Since:
        JavaView 3.54.000

    - #### getDimmedColor

          public static int getDimmedColor(int rgb,
                           int dim)

      Get a color whose components are dimmed by a factor. Product of factor and color component is constraint to interval [0,255]. Method does not change components of this color.
      Parameters:
        `rgb` - color to modify.
        `dim` - factor in [0,255] to be multiplied to all color components.
      Returns:
        new color value
      Since:
        JavaView 3.54.000

    - #### getDimmedColor

          public static int getDimmedColor(int rgb,
                           double dim)

      Get a color whose components are dimmed by a factor. Product of factor and color component is constraint to interval [0,255]. Method does not change components of this color.
      Parameters:
        `rgb` - color to modify.
        `dim` - factor in [0,1] to be multiplied to all color components.
      Returns:
        new color

    - #### getDimmedColor

          public static java.awt.Color getDimmedColor(java.awt.Color col,
                                      int dim)

      Get a color whose components are dimmed by a factor. Product of factor and color component is constraint to interval [0,255]. Method does not change components of this color.
      Parameters:
        `col` - color to modify.
        `dim` - factor in [0,255] to be multiplied to all color components.
      Returns:
        new color
      Since:
        JavaView 3.54.003

    - #### getDimmedColor

          public static java.awt.Color getDimmedColor(java.awt.Color col,
                                      double dim)

      Get a color whose components are dimmed by a factor. Product of factor and color component is constraint to interval [0,255]. Method does not change components of this color.
      Parameters:
        `col` - color to modify.
        `dim` - factor in [0,1] to be multiplied to all color components.
      Returns:
        new color

    - #### getDimmedColor

          public static java.awt.Color getDimmedColor(java.awt.Color col,
                                      double dim,
                                      double offset)

      Get a color whose components are dimmed by a factor and shifted by an offset. Offset plus product of factor and color component is constraint to interval [0,255]. Method does not change components of this color.
      Parameters:
        `col` - color to modify.
        `dim` - factor in [0,1] to be multiplied to all color components.
        `offset` - constant in [0,255] to be added to all color components after dimming.
      Returns:
        new color TODO: use getDimmedColor(int rgb, double dim, double offset) to avoid multiple Color instantiation.

    - #### getDimmedColor

          public static int getDimmedColor(int rgb,
                           double dim,
                           double offset)

      Get a color whose components are dimmed by a factor and shifted by an offset. Offset plus product of factor and color component is constraint to interval [0,255]. Method does not change components of this color.
      Parameters:
        `rgb` - color to modify.
        `dim` - factor in [0,1] to be multiplied to all color components.
        `offset` - constant in [0,255] to be added to all color components after dimming.
      Returns:
        new color
      Since:
        JavaView 3.54.001

    - #### getColor

          public java.awt.Color getColor()

      Convert color components in a java.awt.Color instance.
      Returns:
        java.awt.Color instance of color components, `null` if less than 3 components available.

    - #### setColor

          public void setColor(java.awt.Color aColor)

      Set color components to components of argument color. This color must have enough color components. Alpha channel remains unchanged. Info panel is updated if it exists.
      Parameters:
        `aColor` - color to be assigned.

    - #### hasAlpha

          public boolean hasAlpha()

      Check whether alpha channel is used.
      Returns:
        `true` of alpha channel is used; `false` otherwise.
      See Also:
        `enableAlpha(boolean)`

    - #### enableAlpha

          public void enableAlpha(boolean flag)

      Enable or disable alpha channel. Internally, an alpha channel is allocated or removed.
      Parameters:
        `flag` - `true` to enable alpha channel.
      See Also:
        `setSize(int)`

    - #### getEntry

          public int getEntry(int ind)

      Get a color component with given index.
      Parameters:
        `ind` - index of requested color component
      Returns:
        value in [0,255] of color component; 0 if index out of bounds

    - #### setEntry

          public void setEntry(int ind,
                      int value)

      Set a color component with given index to value.
      Parameters:
        `ind` - index of color component to be modified
        `value` - value in [0,255] for all components of color

    - #### setEntry

          public void setEntry(int ind,
                      double value)

      Set a color component with given index to value.
      Parameters:
        `ind` - index of color component to be modified
        `value` - value in [0.,1.] for all components of color
      Since:
        JavaView 2.32

    - #### setConstant

          public void setConstant(int value)

      Set all color components excluding alpha to the same value.
      Parameters:
        `value` - value in [0,255] for all components of color

    - #### setAlpha

          public void setAlpha(int alpha)

      Set alpha component of this color using integer argument in [0, 255]. Alpha must be enabled in order to be effective.
      Parameters:
        `alpha` - new alpha component in [0, 255]

    - #### setAlpha

          public void setAlpha(double alpha)

      Set alpha component of this color using double argument in [0., 1.]. Alpha must be enabled to allow assignment of new value.
      Parameters:
        `alpha` - new alpha component in [0., 1.]

    - #### set

          public void set(int grey)

      Set grey component of this color using integer argument in [0, 255]. Color must have `size == 1` excluding alpha. If this color has too few components then a warning is issued without changes.
      Parameters:
        `grey` - new grey component in [0, 255]

    - #### set

          public void set(int red,
                 int green,
                 int blue)

      Set components of this color using integer argument in [0, 255]. Color must have `size == 3` excluding alpha. If this color has too few components then a warning is issued without changes.
      Parameters:
        `red` - new red color component in [0, 255]
        `green` - new green color component in [0, 255]
        `blue` - new blue color component in [0, 255]

    - #### set

          public void set(int red,
                 int green,
                 int blue,
                 int alpha)

      Set components of this color using double arguments in [0, 255]. If this color has too few components then a warning is issued without changes. If alpha is disabled then its value is ignored.
      Parameters:
        `red` - new red color component in [0, 255]
        `green` - new green color component in [0, 255]
        `blue` - new blue color component in [0, 255]
        `alpha` - new alpha components in [0, 255]

    - #### set

          public void set(double grey)

      Set grey component of this color using double arguments in [0., 1.]. Color must have `size == 1` excluding alpha. If this color has too few components then a warning is issued without changes.
      Parameters:
        `grey` - new grey component in [0., 1.]

    - #### set

          public void set(double red,
                 double green,
                 double blue)

      Set components of this color using double arguments in [0., 1.]. If this color has too few components then a warning is issued without changes.
      Parameters:
        `red` - new red color component in [0., 1.]
        `green` - new green color component in [0., 1.]
        `blue` - new blue color component in [0., 1.]

    - #### set

          public void set(double red,
                 double green,
                 double blue,
                 double alpha)

      Set components of this color using double arguments in [0., 1.]. If this color has too few components then a warning is issued without changes. If alpha is disabled then its value is ignored.
      Parameters:
        `red` - new red color component in [0., 1.]
        `green` - new green color component in [0., 1.]
        `blue` - new blue color component in [0., 1.]
        `alpha` - new alpha components in [0., 1.]

    - #### clone

          public java.lang.Object clone()

      Duplicate color and data array.
      Overrides:
        `clone` in class `PsObject`
      See Also:
        `PsObject.copy(PsObject)`

    - #### copyNew

          public static PdColor copyNew(PdColor v)

      Create a new color as clone of argument color.
      Parameters:
        `v` - source color to clone

    - #### copy

          public void copy(PdColor v)

      Copy color components including alpha. Source and destination colors must have same size, except if destination color is empty then allocated space of size of source color.
      Parameters:
        `v` - source color to copy

    - #### copy

          public void copy(int[] anArray,
                  int aSize)

      Copy color components excluding alpha. Source and destination colors must have same size, except if destination color is empty then method allocates of size of source array.
      Parameters:
        `anArray` - new color components in [0, 255]
        `aSize` - number of entries in array

    - #### copy

          public void copy(double[] anArray,
                  int aSize)

      Copy color components excluding alpha. Source and destination colors must have same size, except if destination color is empty then method allocates space of size of source array.
      Parameters:
        `anArray` - new color components in [0., 1.]
        `aSize` - number of entries in array

    - #### max

          public int max()

      Find maximal value of component in color.
      Returns:
        value of maximal component
      See Also:
        `min()`, `indexOfMax()`

    - #### min

          public int min()

      Find minimal value of component in color.
      Returns:
        value of minimal component
      See Also:
        `min()`, `indexOfMax()`

    - #### indexOfMax

          public int indexOfMax()

      Find component in color with maximal value.
      Returns:
        index of maximal component

    - #### indexOfMin

          public int indexOfMin()

      Find component in color with minimal value.
      Returns:
        index of minimal component

    - #### blend

          public static int blend(double a,
                  int v,
                  double b,
                  int w)

      Interpolate between two colors with given weights. Uses `this = v*a + w*b` including alpha component.

      Avoid negative values, method uses absolute value of each weight.

      Parameters:
        `a` - weight of first color v
        `v` - first color
        `b` - weight of second color w
        `w` - second color
      See Also:
        `blend(double, PdColor, double, PdColor)`

    - #### blend

          public static java.awt.Color blend(double a,
                             java.awt.Color v,
                             double b,
                             java.awt.Color w)

      Interpolate between two colors with given weights. Uses `this = v*a + w*b` including alpha component. If result color 'this' is empty then its size is set to size if color v, otherwise no interpolation is performed.

      Avoid negative values, method uses absolute value of each weight.

      Parameters:
        `a` - weight of first color v
        `v` - first color
        `b` - weight of second color w
        `w` - second color
      See Also:
        `blend(double, PdColor, double, PdColor)`

    - #### blend

          public void blend(double a,
                   PdColor v,
                   double b,
                   PdColor w)

      Interpolate between two colors with given weights. Uses `this = v*a + w*b` including alpha component. If result color 'this' is empty then its size is set to size if color v, otherwise no interpolation is performed.

      Avoid negative values, method uses absolute value of each weight. All new color components are clipped to the range [0,255].

      Parameters:
        `a` - weight of first color v
        `v` - first color
        `b` - weight of second color w
        `w` - second color
      See Also:
        `blendBase(PdColor, double, PdColor)`

    - #### blendBase

          public void blendBase(PdColor v,
                       double b,
                       PdColor w)

      Interpolate between two colors with given weights. Uses `this = v + w*b` including alpha component. If result color 'this' is empty then its size is set to size if color v, otherwise no interpolation is performed.
      Parameters:
        `v` - first color
        `b` - weight of second color w
        `w` - second color
      See Also:
        `blend(double, PdColor, double, PdColor)`

    - #### realloc

          public static java.awt.Color[] realloc(java.awt.Color[] data,
                                 int arraySize)

      Allocate an array of Java colors and assign default color black. If argument `data!=null` then as most as possible of the content of existing colors is copied into (possibly reused) colors of the reallocated array. Assignment of default color does not waist memory since assignment is made to a static class.

      If requested array size is 0 then method returns an array of length 0.

      Parameters:
        `data` - possibly empty array of colors
        `arraySize` - number of colors in new array

    - #### realloc

          public static PdColor[] realloc(PdColor[] data,
                          int arraySize,
                          int colorSize)

      Allocate an array of colors, where all colors have the same dimension. If argument `data!=null` then as most as possible of the content of existing colors is copied into (possibly reused) colors of the reallocated array. Colors have no alpha channel.
      Parameters:
        `data` - possibly empty array of colors
        `arraySize` - number of colors in new array
        `colorSize` - dimension of colors in new array

    - #### realloc

          public static PdColor[] realloc(PdColor[] data,
                          int arraySize,
                          int colorSize,
                          boolean bAlpha)

      Allocate an array of colors, where all colors have the same dimension. If argument `data!=null` then as most as possible of the content of existing colors is copied into (possibly reused) colors of the reallocated array.
      Parameters:
        `data` - possibly empty array of colors
        `arraySize` - number of colors in new array
        `colorSize` - dimension of colors in new array
        `bAlpha` - flag whether alpha is enabled

    - #### copyNew

          public static PdColor[] copyNew(PdColor[] data)

      Create an new array with copies of all colors of a given array of colors. The new array contains new colors containing the same data as the original colors.
      Parameters:
        `data` - array of colors
      Returns:
        new array with same number of colors as argument array
      See Also:
        `copyNew(PdColor [], int)`, `copy(PdColor [], int, PdColor [], int, int)`

    - #### copyNew

          public static PdColor[] copyNew(PdColor[] data,
                          int size)

      Create an new array with copies of the first 'size' colors of a given array of colors. The new array contains new colors containing the same data as the original colors.
      Parameters:
        `data` - array of colors
        `size` - number of copied colors of array
      Returns:
        new array with number of colors equal to argument 'size'
      See Also:
        `copyNew(PdColor [])`, `copy(PdColor [], int, PdColor [], int, int)`

    - #### copyNew

          public static java.awt.Color[] copyNew(java.awt.Color[] data)

      Create an new array with copies of all colors of a given array of colors. The new array contains new colors containing the same data as the original colors.
      Parameters:
        `data` - array of colors
      Returns:
        new array with same number of colors as argument array
      See Also:
        `copyNew(Color [], int)`, `copy(Color [], int, Color [], int, int)`

    - #### copyNew

          public static java.awt.Color[] copyNew(java.awt.Color[] data,
                                 int size)

      Create an new array with copies of the first 'size' colors of a given array of colors. The new array contains new colors containing the same data as the original colors.
      Parameters:
        `data` - array of colors
        `size` - number of copied colors of array
      Returns:
        new array with number of colors equal to argument 'size'
      See Also:
        `copyNew(Color [])`, `copy(Color [], int, Color [], int, int)`

    - #### copy

          public static boolean copy(java.awt.Color[] dataDest,
                     int destInd,
                     java.awt.Color[] dataSrc,
                     int srcInd,
                     int size)

      Assign some colors of a given array of colors to an existing destination array. Both source and destination array must exist already.

             for (int i=0; i
           Destination array must be large enough, i.e. dataDest.length >= destInd+size.

      Parameters:
        `dataDest` - destination array of colors
        `destInd` - index of first destination color in dataDest
        `dataSrc` - source array of colors
        `srcInd` - index of first source color in dataSrc used for copying
        `size` - number of assigned colors of array
      Returns:
        `true` if destination array is large enough
      See Also:
        `copy(PdColor)`

    - #### copy

          public static boolean copy(PdColor[] dataDest,
                     int destInd,
                     PdColor[] dataSrc,
                     int srcInd,
                     int size)

      Copies some colors of a given array of colors into an existing destination array. All colors in source and destination array must exist already.

             for (int i=0; i
           Destination array must be large enough, i.e. dataDest.length >= destInd+size.

      Parameters:
        `dataDest` - destination array of colors
        `destInd` - index of first destination color in dataDest
        `dataSrc` - source array of colors
        `srcInd` - index of first source color in dataSrc used for copying
        `size` - number of copied colors of array
      Returns:
        `true` if destination array is large enough
      See Also:
        `copy(PdColor)`

    - #### rgb2hsv

          public static void rgb2hsv(PdColor hsv,
                     PdColor rgb)

      Conversion of color spaces.

    - #### hsv2rgb

          public static void hsv2rgb(PdColor rgb,
                     PdColor hsv)

      Conversion of color spaces.

    - #### hsv2rgb

          public static java.awt.Color hsv2rgb(java.awt.Color hsv)

      Conversion of color spaces.

    - #### hsv2rgbAsInt

          public static int hsv2rgbAsInt(int h,
                         int s,
                         int v)

      Conversion of color spaces. All values h,s,v are in range [0,255].
      Since:
        JavaView 2.90.001

    - #### hsv2rgb

          public static java.awt.Color hsv2rgb(int h,
                               int s,
                               int v)

      Conversion of color spaces.

    - #### hsl2rgb

          public static java.awt.Color hsl2rgb(int hi,
                               int li,
                               int si)

    - #### rgb2hsl

          public static java.awt.Color rgb2hsl(int ri,
                               int gi,
                               int bi)

    - #### yiq2rgb

          public static java.awt.Color yiq2rgb(int yi,
                               int ii,
                               int qi)

    - #### rgb2yiq

          public static java.awt.Color rgb2yiq(int ri,
                               int gi,
                               int bi)

    - #### cmyk2rgb

          public static java.awt.Color cmyk2rgb(int c,
                                int m,
                                int y,
                                int k)

      Convert a set of (cyan, magenta, yellow, black) to RGB color. CMYK color representation is used in print media.
      Since:
        JavaView 2.49.002

    - #### rgb2cmyk

          public static int[] rgb2cmyk(int r,
                       int g,
                       int b)

      Convert a set of (cyan, magenta, yellow, black) to RGB color. CMYK color representation is used in print media.
      Since:
        JavaView 2.49.002

    - #### parseColor

          public static java.awt.Color parseColor(java.lang.String colorString)

      Parse rgb color from a given string where each component is integer in the range 0..255 or a float in the range [0.,1.], or the whole color string is in Html HEX representation such as "#FF0039".

      Colors are interpreted as HEX colors if the string starts with '#' character. Otherwise they are interpreted as float color if a '.' is found within the string, or else as integer colors.

      Color components in int of float representation may be separated using either blanks, commas, semicolons or vertical bars.

      Parameters:
        `colorString` - string with integer color components
      Returns:
        java.awt.Color instance of color components, `null` if less than 3 components available.

    - #### parseNamedColor

          public static java.awt.Color parseNamedColor(java.lang.String str)

      Parse a named color string into a java.awt.Color. The color name can be one of the following:

      > black blue cyan gray darkGray lightGray grey darkGrey lightGrey green magenta orange pink red white yellow

      and optionally the name can be preprended with a blank separated prefix

      > dark light

      . For example, 'dark red'.
      Since:
        JavaView 3.97.002

    - #### getXORColor

          public static java.awt.Color getXORColor(java.awt.Color colCurr,
                                   java.awt.Color colPref,
                                   java.awt.Color colAlt,
                                   int eps)

      Choose a new color depending on the distance to an existing color. If the preferred color more than eps away from the current color then return the preferred color. Otherwise return the alternate color.
      Parameters:
        `colCurr` - current color against which the new color is compared.
        `colPref` - new preferred color
        `colAlt` - alternative color choice returned if preferred color is eps-close to current color
        `eps` - distance threshold in [0,255] compared to current color.
      Returns:
        either colPref or colAlt
      Since:
        JavaView 3.55.001

    - #### toString

          public static java.lang.String toString(java.awt.Color col,
                                  java.lang.String sep)

      Get string representation of color components with given separator string.
      Since:
        JavaView 3.97.078

    - #### toStringAsFloat

          public static java.lang.String toStringAsFloat(java.awt.Color col,
                                         java.lang.String sep)

      Get string representation of color components with given separator string and range of color components scaled to interval [0.,1.].
      Since:
        JavaView 3.97.078

"

The software JavaView? is copyright protected. All Rights Reserved.
"