toxi.color
Class Color

java.lang.Object
  extended by toxi.color.Color

public class Color
extends java.lang.Object

Floating point color class with implicit RGB, HSV, CMYK access modes, conversion and color theory utils. Based on the Colors library for NodeBox


Field Summary
 float alpha
           
static Color BLACK
           
static float BLACK_POINT
           
static Color BLUE
           
protected  float[] cmyk
           
static Color CYAN
           
static double EPS
           
static Color GREEN
           
static float GREY_THRESHOLD
           
protected  float[] hsv
           
static float INV8BIT
           
static Color MAGENTA
           
static Color RED
           
protected  float[] rgb
           
protected static toxi.geom.Vec2D[] RYB_WHEEL
           
static Color WHITE
           
static float WHITE_POINT
           
static Color YELLOW
           
 
Constructor Summary
protected Color()
           
  Color(Color c)
           
 
Method Summary
 Color adjustConstrast(float amount)
           
 Color adjustHSV(float h, float s, float v)
           
 Color adjustRGB(float r, float g, float b)
           
 float alpha()
           
 Color analog(float theta, float delta)
           
 Color analog(int angle, float delta)
           
 float black()
           
 Color blend(Color c, float t)
           
 float blue()
           
 float brightness()
           
static float[] cmykToRGB(float c, float m, float y, float k)
           
static float[] cmykToRGB(float c, float m, float y, float k, float[] rgb)
           
 Color complement()
           
 Color copy()
           
 float cyan()
           
 Color darken(float step)
           
 Color desaturate(float step)
           
 float distanceTo(Color c)
           
 boolean equals(java.lang.Object o)
           
 Color getAnalog(float theta, float delta)
           
 Color getAnalog(int angle, float delta)
           
 Color getBlended(Color c, float t)
           
 Color getComplement()
           
 float getComponentValue(ColorAccessCriteria criteria)
           
 Color getDarkened(float step)
           
 Color getDesaturated(float step)
           
 Color getLightened(float step)
           
 Color getRotatedRYB(float theta)
           
 Color getRotatedRYB(int angle)
           
 Color getSaturated(float step)
           
 float green()
           
 int hashCode()
           
static float[] hexToRGB(java.lang.String hexRGB)
           
static float[] hexToRGB(java.lang.String hexRGB, float[] rgb)
           
static float[] hsvToRGB(float h, float s, float v)
           
static float[] hsvToRGB(float h, float s, float v, float[] rgb)
           
 float hue()
           
 Color invert()
           
 boolean isBlack()
           
 boolean isGrey()
           
 boolean isWhite()
           
static float[] labToRGB(float l, float a, float b)
           
static float[] labToRGB(float l, float a, float b, float[] rgb)
           
 Color lighten(float step)
           
 float magenta()
           
static Color newARGB(int argb)
           
static Color newCMYK(float c, float m, float y, float k)
           
static Color newCMYKA(float c, float m, float y, float k, float a)
           
static Color newGray(float gray)
           
static Color newGrayAlpha(float gray, float alpha)
           
static Color newHex(java.lang.String hexRGB)
           
static Color newHSV(float h, float s, float v)
           
static Color newHSVA(float h, float s, float v, float a)
           
static Color newRGB(float r, float g, float b)
           
static Color newRGBA(float r, float g, float b, float a)
           
 float red()
           
static float[] rgbToCMYK(float r, float g, float b)
           
static float[] rgbToCMYK(float r, float g, float b, float[] cmyk)
           
static java.lang.String rgbToHex(float r, float g, float b)
           
static float[] rgbToHSV(float r, float g, float b)
           
static float[] rgbToHSV(float r, float g, float b, float[] hsv)
           
 Color rotateRYB(float theta)
           
 Color rotateRYB(int theta)
           
 Color saturate(float step)
           
 float saturation()
           
 Color setBrightness(float brightness)
           
 Color setCMYK(float[] newCMYK)
           
 Color setHSV(float[] newHSV)
           
 void setHue(float hue)
           
 Color setRGB(float[] newRGB)
           
 Color setSaturation(float saturation)
           
 int toARGB()
           
 java.lang.String toString()
           
 float yellow()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

RYB_WHEEL

protected static final toxi.geom.Vec2D[] RYB_WHEEL

BLACK_POINT

public static float BLACK_POINT

WHITE_POINT

public static float WHITE_POINT

GREY_THRESHOLD

public static float GREY_THRESHOLD

INV8BIT

public static final float INV8BIT
See Also:
Constant Field Values

RED

public static final Color RED

GREEN

public static final Color GREEN

BLUE

public static final Color BLUE

CYAN

public static final Color CYAN

MAGENTA

public static final Color MAGENTA

YELLOW

public static final Color YELLOW

BLACK

public static final Color BLACK

WHITE

public static final Color WHITE

EPS

public static final double EPS
See Also:
Constant Field Values

rgb

protected float[] rgb

cmyk

protected float[] cmyk

hsv

protected float[] hsv

alpha

public float alpha
Constructor Detail

Color

protected Color()

Color

public Color(Color c)
Method Detail

newHex

public static final Color newHex(java.lang.String hexRGB)

newGray

public static final Color newGray(float gray)

newGrayAlpha

public static final Color newGrayAlpha(float gray,
                                       float alpha)

newRGB

public static final Color newRGB(float r,
                                 float g,
                                 float b)

newRGBA

public static final Color newRGBA(float r,
                                  float g,
                                  float b,
                                  float a)

newARGB

public static final Color newARGB(int argb)

newHSV

public static final Color newHSV(float h,
                                 float s,
                                 float v)

newHSVA

public static final Color newHSVA(float h,
                                  float s,
                                  float v,
                                  float a)

newCMYK

public static final Color newCMYK(float c,
                                  float m,
                                  float y,
                                  float k)

newCMYKA

public static final Color newCMYKA(float c,
                                   float m,
                                   float y,
                                   float k,
                                   float a)

copy

public Color copy()

toARGB

public int toARGB()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

setRGB

public Color setRGB(float[] newRGB)

setCMYK

public Color setCMYK(float[] newCMYK)

setHSV

public Color setHSV(float[] newHSV)

hexToRGB

public static final float[] hexToRGB(java.lang.String hexRGB)

hexToRGB

public static final float[] hexToRGB(java.lang.String hexRGB,
                                     float[] rgb)

rgbToHex

public static final java.lang.String rgbToHex(float r,
                                              float g,
                                              float b)

cmykToRGB

public static final float[] cmykToRGB(float c,
                                      float m,
                                      float y,
                                      float k)

cmykToRGB

public static final float[] cmykToRGB(float c,
                                      float m,
                                      float y,
                                      float k,
                                      float[] rgb)

rgbToCMYK

public static final float[] rgbToCMYK(float r,
                                      float g,
                                      float b)

rgbToCMYK

public static final float[] rgbToCMYK(float r,
                                      float g,
                                      float b,
                                      float[] cmyk)

hsvToRGB

public static final float[] hsvToRGB(float h,
                                     float s,
                                     float v)

hsvToRGB

public static final float[] hsvToRGB(float h,
                                     float s,
                                     float v,
                                     float[] rgb)

rgbToHSV

public static final float[] rgbToHSV(float r,
                                     float g,
                                     float b)

rgbToHSV

public static final float[] rgbToHSV(float r,
                                     float g,
                                     float b,
                                     float[] hsv)

labToRGB

public static final float[] labToRGB(float l,
                                     float a,
                                     float b)

labToRGB

public static final float[] labToRGB(float l,
                                     float a,
                                     float b,
                                     float[] rgb)

alpha

public float alpha()

brightness

public float brightness()

hue

public float hue()

saturation

public float saturation()

red

public float red()

green

public float green()

blue

public float blue()

cyan

public float cyan()

magenta

public float magenta()

yellow

public float yellow()

black

public float black()

isWhite

public boolean isWhite()

isBlack

public boolean isBlack()

isGrey

public boolean isGrey()

darken

public Color darken(float step)

lighten

public Color lighten(float step)

getDarkened

public Color getDarkened(float step)

getLightened

public Color getLightened(float step)

saturate

public Color saturate(float step)

desaturate

public Color desaturate(float step)

getSaturated

public Color getSaturated(float step)

getDesaturated

public Color getDesaturated(float step)

rotateRYB

public Color rotateRYB(float theta)

rotateRYB

public Color rotateRYB(int theta)

getRotatedRYB

public Color getRotatedRYB(int angle)

getRotatedRYB

public Color getRotatedRYB(float theta)

complement

public Color complement()

getComplement

public Color getComplement()

invert

public Color invert()

analog

public Color analog(int angle,
                    float delta)

analog

public Color analog(float theta,
                    float delta)

getAnalog

public Color getAnalog(int angle,
                       float delta)

getAnalog

public Color getAnalog(float theta,
                       float delta)

setSaturation

public Color setSaturation(float saturation)

setBrightness

public Color setBrightness(float brightness)

blend

public Color blend(Color c,
                   float t)

getBlended

public Color getBlended(Color c,
                        float t)

distanceTo

public float distanceTo(Color c)

getComponentValue

public float getComponentValue(ColorAccessCriteria criteria)

setHue

public void setHue(float hue)

adjustConstrast

public Color adjustConstrast(float amount)

adjustRGB

public Color adjustRGB(float r,
                       float g,
                       float b)

adjustHSV

public Color adjustHSV(float h,
                       float s,
                       float v)

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object