Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## toxi.color
Interface ReadonlyTColor

All Known Implementing Classes:
  TColor

    public interface ReadonlyTColor

Defines an immutable API for the TColor class. This is used to define the preset color constants in `NamedColor`, but also throughout other parts of this package wherever immutable behaviour is required or encouraged.

Method Summary
`float` | `alpha()`
`float` | `black()`
`float` | `blue()`
`float` | `brightness()`
`TColor` | `copy()`
`float` | `cyan()`
`float` | `distanceToCMYK(ReadonlyTColor c)` Calculates the CMYK distance to the given color.
`float` | `distanceToHSV(ReadonlyTColor c)` Calculates the HSV distance to the given color.
`float` | `distanceToRGB(ReadonlyTColor c)` Calculates the RGB distance to the given color.
`TColor` | `getAnalog(float theta, float delta)`
`TColor` | `getAnalog(int angle, float delta)`
`TColor` | `getBlended(ReadonlyTColor c, float t)`
`Hue` | `getClosestHue()`
`Hue` | `getClosestHue(boolean primaryOnly)`
`TColor` | `getComplement()`
`float` | `getComponentValue(AccessCriteria criteria)`
`TColor` | `getDarkened(float step)`
`TColor` | `getDesaturated(float step)`
`TColor` | `getInverted()`
`TColor` | `getLightened(float step)`
`TColor` | `getRotatedRYB(float theta)`
`TColor` | `getRotatedRYB(int angle)`
`TColor` | `getSaturated(float step)`
`float` | `green()`
`float` | `hue()`
`boolean` | `isBlack()`
`boolean` | `isGrey()`
`boolean` | `isPrimary()`
`boolean` | `isWhite()`
`float` | `luminance()` Computes the color's luminance using this formula: lum=0.299*red + 0.587*green + 0.114 *blue
`float` | `magenta()`
`float` | `red()`
`float` | `saturation()`
`int` | `toARGB()` Converts the color into a packed ARGB int.
`float[]` | `toCMYKAArray(float[] cmyka)` Copies the current CMYKA values into the given array (or constucts a new one with these values).
`float[]` | `toHSVAArray(float[] hsva)`
`float[]` | `toRGBAArray(float[] rgba)` Copies the current RGBA value into the given array (or constucts a new one with these values).
`float[]` | `toRGBAArray(float[] rgba, int offset)` Copies the current RGBA value into the given array starting the given offset.
`float` | `yellow()`

Method Detail

### alpha

    float alpha()

  Returns:
    the color's alpha component

### black

    float black()

  Returns:
    the color's black component

### blue

    float blue()

  Returns:
    the color's blue component

### brightness

    float brightness()

  Returns:
    color HSV brightness (not luminance!)

### copy

    TColor copy()

  Returns:
    a mutable copy of the current color

### cyan

    float cyan()

  Returns:
    the color's cyan component

### distanceToCMYK

    float distanceToCMYK(ReadonlyTColor c)

  Calculates the CMYK distance to the given color.

  Parameters:
    `c` - target color
  Returns:
    distance

### distanceToHSV

    float distanceToHSV(ReadonlyTColor c)

  Calculates the HSV distance to the given color.

  Parameters:
    `c` - target color
  Returns:
    distance

### distanceToRGB

    float distanceToRGB(ReadonlyTColor c)

  Calculates the RGB distance to the given color.

  Parameters:
    `c` - target color
  Returns:
    distance

### getAnalog

    TColor getAnalog(float theta,
                     float delta)

### getAnalog

    TColor getAnalog(int angle,
                     float delta)

### getBlended

    TColor getBlended(ReadonlyTColor c,
                      float t)

### getClosestHue

    Hue getClosestHue()

  Returns:
    an instance of the closest named hue to this color.

### getClosestHue

    Hue getClosestHue(boolean primaryOnly)

  Parameters:
    `primaryOnly` - if true, only primary color hues are considered
  Returns:
    an instance of the closest named (primary) hue to this color.

### getComplement

    TColor getComplement()

### getComponentValue

    float getComponentValue(AccessCriteria criteria)

### getDarkened

    TColor getDarkened(float step)

  Parameters:
    `step` -
  Returns:
    a darkened copy

### getDesaturated

    TColor getDesaturated(float step)

  Parameters:
    `step` -
  Returns:
    a desaturated copy

### getInverted

    TColor getInverted()

  Returns:
    an inverted copy

### getLightened

    TColor getLightened(float step)

  Parameters:
    `step` -
  Returns:
    a lightened copy

### getRotatedRYB

    TColor getRotatedRYB(float theta)

  Parameters:
    `theta` - rotation angle in radians
  Returns:
    a RYB rotated copy

### getRotatedRYB

    TColor getRotatedRYB(int angle)

  Parameters:
    `angle` - rotation angle in degrees
  Returns:
    a RYB rotated copy

### getSaturated

    TColor getSaturated(float step)

  Parameters:
    `step` -
  Returns:
    a saturated copy

### green

    float green()

  Returns:
    the color's green component

### hue

    float hue()

  Returns:
    the color's hue

### isBlack

    boolean isBlack()

  Returns:
    true, if all rgb component values are equal and less than `TColor.BLACK_POINT`

### isGrey

    boolean isGrey()

  Returns:
    true, if the saturation component value is less than `TColor.GREY_THRESHOLD`

### isPrimary

    boolean isPrimary()

  Returns:
    true, if this colors hue is matching one of the 7 defined primary hues.

### isWhite

    boolean isWhite()

  Returns:
    true, if all rgb component values are equal and greater than `TColor.WHITE_POINT`

### luminance

    float luminance()

  Computes the color's luminance using this formula: lum=0.299*red + 0.587*green + 0.114 *blue

  Returns:
    luminance

### magenta

    float magenta()

  Returns:
    the color's magenta component

### red

    float red()

  Returns:
    the color's red component

### saturation

    float saturation()

  Returns:
    the color's saturation

### toARGB

    int toARGB()

  Converts the color into a packed ARGB int.

  Returns:
    color as int

### toCMYKAArray

    float[] toCMYKAArray(float[] cmyka)

  Copies the current CMYKA values into the given array (or constucts a new one with these values).

  Parameters:
    `cmyka` - result array (or null)
  Returns:
    array in this order: c,m,y,k,a

### toHSVAArray

    float[] toHSVAArray(float[] hsva)

  Parameters:
    `hsva` - result array (or null)
  Returns:
    Copies the the current HSV values into the given array (or constucts a new one with these values).

### toRGBAArray

    float[] toRGBAArray(float[] rgba)

  Copies the current RGBA value into the given array (or constucts a new one with these values).

  Parameters:
    `rgba` - result array (or null)
  Returns:
    array in this order: r,g,b,a (OpenGL format)

### toRGBAArray

    float[] toRGBAArray(float[] rgba,
                        int offset)

  Copies the current RGBA value into the given array starting the given offset. If the array is null, the method constucts a new one with these values and the offset value is ignored (set to zero).

  Parameters:
    `rgba` -
    `offset` -
  Returns:
    float array

### yellow

    float yellow()

  Returns:
    the color's yellow component

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD