|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttoxi.color.TColor
public class TColor
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 ReadonlyTColor |
BLACK
|
static float |
BLACK_POINT
Maximum rgb component value for a color to be classified as black. |
static ReadonlyTColor |
BLUE
|
static ReadonlyTColor |
CYAN
|
static ReadonlyTColor |
GREEN
|
static float |
GREY_THRESHOLD
Maximum saturations value for a color to be classified as grey |
static ReadonlyTColor |
MAGENTA
|
static ReadonlyTColor |
RED
|
static ReadonlyTColor |
WHITE
|
static float |
WHITE_POINT
Minimum rgb component value for a color to be classified as white. |
static ReadonlyTColor |
YELLOW
|
Constructor Summary | |
---|---|
TColor(ReadonlyTColor c)
Creates a deep copy of the given color. |
Method Summary | |
---|---|
TColor |
add(TColor c)
|
TColor |
addSelf(TColor c)
|
ReadonlyTColor |
adjustConstrast(float amount)
Changes the brightness of the color by the given amount in the direction towards either the black or white point (depending on if current brightness >= 50%) |
ReadonlyTColor |
adjustHSV(float h,
float s,
float v)
Adds the given HSV values as offsets to the current color. |
ReadonlyTColor |
adjustRGB(float r,
float g,
float b)
Adds the given RGB values as offsets to the current color. |
float |
alpha()
|
TColor |
analog(float theta,
float delta)
Rotates this color by a random amount (not exceeding the one specified) and creates variations in saturation and brightness based on the 2nd parameter. |
TColor |
analog(int angle,
float delta)
|
float |
black()
|
TColor |
blend(ReadonlyTColor c,
float t)
Blends the color with the given one by the stated amount |
float |
blue()
|
float |
brightness()
|
static float[] |
cmykToRGB(float c,
float m,
float y,
float k)
Converts CMYK floats into an RGB array. |
static float[] |
cmykToRGB(float c,
float m,
float y,
float k,
float[] rgb)
Converts CMYK floats into the given RGB array. |
TColor |
complement()
|
TColor |
copy()
|
float |
cyan()
|
TColor |
darken(float step)
Reduces the color's brightness by the given amount (e.g 0.1 = 10% darker). |
TColor |
desaturate(float step)
Reduced the color's saturation by the given amount. |
TColor |
differenceTo(TColor c)
|
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. |
boolean |
equals(java.lang.Object o)
|
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 |
getDifferenceTo(TColor c)
|
TColor |
getInverted()
|
TColor |
getLightened(float step)
|
TColor |
getRotatedRYB(float theta)
|
TColor |
getRotatedRYB(int angle)
|
TColor |
getSaturated(float step)
|
float |
green()
|
int |
hashCode()
|
static float[] |
hexToRGB(java.lang.String hexRGB)
Converts hex string into a RGB array. |
static float[] |
hexToRGB(java.lang.String hexRGB,
float[] rgb)
|
static float[] |
hsvToRGB(float h,
float s,
float v)
Converts HSV values into RGB array. |
static float[] |
hsvToRGB(float h,
float s,
float v,
float[] rgb)
|
float |
hue()
|
TColor |
invert()
Inverts the color. |
boolean |
isBlack()
|
boolean |
isGrey()
|
boolean |
isPrimary()
|
boolean |
isWhite()
|
static float[] |
labToRGB(float l,
float a,
float b)
|
static float[] |
labToRGB(float l,
float a,
float b,
float[] rgb)
Converts CIE Lab to RGB components. |
TColor |
lighten(float step)
Lightens the color by stated amount. |
float |
luminance()
Computes the color's luminance using this formula: lum=0.299*red + 0.587*green + 0.114 *blue |
float |
magenta()
|
static TColor |
newARGB(int argb)
Factory method. |
static TColor |
newCMYK(float c,
float m,
float y,
float k)
Factory method. |
static TColor |
newCMYKA(float c,
float m,
float y,
float k,
float a)
Factory method. |
static TColor |
newGray(float gray)
Factory method. |
static TColor |
newGrayAlpha(float gray,
float alpha)
|
static TColor |
newHex(java.lang.String hexRGB)
Factory method. |
static TColor |
newHSV(float h,
float s,
float v)
Factory method. |
static ReadonlyTColor |
newHSV(Hue h,
float s,
float v)
|
static TColor |
newHSVA(float h,
float s,
float v,
float a)
|
static TColor |
newRandom()
Factory method. |
static TColor |
newRGB(float r,
float g,
float b)
Factory method. |
static TColor |
newRGBA(float r,
float g,
float b,
float a)
|
float |
red()
|
static float[] |
rgbToCMYK(float r,
float g,
float b)
Converts the RGB values into a CMYK array. |
static float[] |
rgbToCMYK(float r,
float g,
float b,
float[] cmyk)
|
static java.lang.String |
rgbToHex(float r,
float g,
float b)
Formats the RGB float values into hex integers. |
static float[] |
rgbToHSV(float r,
float g,
float b)
Converts the RGB values into an HSV array. |
static float[] |
rgbToHSV(float r,
float g,
float b,
float[] hsv)
|
TColor |
rotateRYB(float theta)
|
TColor |
rotateRYB(int theta)
Rotates the color by x degrees along the RYB color wheel |
TColor |
saturate(float step)
Adds the given value to the current saturation component. |
float |
saturation()
|
TColor |
setAlpha(float alpha)
|
TColor |
setARGB(int argb)
Sets all color components to new values interpreted from the given packed ARGB 32bit color value. |
TColor |
setBlack(float val)
|
TColor |
setBlue(float blue)
|
TColor |
setBrightness(float brightness)
|
TColor |
setCMYK(float[] newCMYK)
|
TColor |
setCMYK(float c,
float m,
float y,
float k)
|
TColor |
setComponent(AccessCriteria criteria,
float val)
Sets a color component by name. |
TColor |
setCyan(float val)
|
TColor |
setGreen(float green)
|
TColor |
setHSV(float[] newHSV)
|
TColor |
setHSV(float h,
float s,
float v)
|
void |
setHue(float hue)
|
TColor |
setMagenta(float val)
|
TColor |
setRed(float red)
|
TColor |
setRGB(float[] newRGB)
|
TColor |
setRGB(float r,
float g,
float b)
|
TColor |
setSaturation(float saturation)
|
TColor |
setYellow(float val)
|
TColor |
sub(TColor c)
|
TColor |
subSelf(TColor c)
|
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). |
java.lang.String |
toHex()
Converts the color into a 6 digit hex string. |
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. |
java.lang.String |
toString()
|
float |
yellow()
|
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static float BLACK_POINT
isBlack()
public static float WHITE_POINT
isWhite()
public static float GREY_THRESHOLD
isGrey()
public static final ReadonlyTColor RED
public static final ReadonlyTColor GREEN
public static final ReadonlyTColor BLUE
public static final ReadonlyTColor CYAN
public static final ReadonlyTColor MAGENTA
public static final ReadonlyTColor YELLOW
public static final ReadonlyTColor BLACK
public static final ReadonlyTColor WHITE
public float alpha
Constructor Detail |
---|
public TColor(ReadonlyTColor c)
c
- Method Detail |
---|
public static final float[] cmykToRGB(float c, float m, float y, float k)
c
- m
- y
- k
-
public static final float[] cmykToRGB(float c, float m, float y, float k, float[] rgb)
c
- m
- y
- k
- rgb
-
public static final float[] hexToRGB(java.lang.String hexRGB)
hexRGB
-
public static final float[] hexToRGB(java.lang.String hexRGB, float[] rgb)
public static final float[] hsvToRGB(float h, float s, float v)
h
- s
- v
-
public static final float[] hsvToRGB(float h, float s, float v, float[] rgb)
public static final float[] labToRGB(float l, float a, float b)
public static final float[] labToRGB(float l, float a, float b, float[] rgb)
l
- a
- b
- rgb
-
public static final TColor newARGB(int argb)
argb
-
public static final TColor newCMYK(float c, float m, float y, float k)
c
- m
- y
- k
-
public static final TColor newCMYKA(float c, float m, float y, float k, float a)
c
- m
- y
- k
- a
-
public static final TColor newGray(float gray)
gray
-
public static final TColor newGrayAlpha(float gray, float alpha)
public static final TColor newHex(java.lang.String hexRGB)
hexRGB
-
public static final TColor newHSV(float h, float s, float v)
h
- s
- v
-
public static ReadonlyTColor newHSV(Hue h, float s, float v)
public static final TColor newHSVA(float h, float s, float v, float a)
public static final TColor newRandom()
public static final TColor newRGB(float r, float g, float b)
r
- g
- b
-
public static final TColor newRGBA(float r, float g, float b, float a)
public static final float[] rgbToCMYK(float r, float g, float b)
r
- g
- b
-
public static final float[] rgbToCMYK(float r, float g, float b, float[] cmyk)
public static final java.lang.String rgbToHex(float r, float g, float b)
r
- g
- b
-
public static final float[] rgbToHSV(float r, float g, float b)
r
- g
- b
-
public static final float[] rgbToHSV(float r, float g, float b, float[] hsv)
public TColor add(TColor c)
public TColor addSelf(TColor c)
public ReadonlyTColor adjustConstrast(float amount)
amount
-
public ReadonlyTColor adjustHSV(float h, float s, float v)
h
- s
- v
-
public ReadonlyTColor adjustRGB(float r, float g, float b)
r
- g
- b
-
public float alpha()
alpha
in interface ReadonlyTColor
public TColor analog(float theta, float delta)
theta
- max. rotation angle (in radians)delta
- max. sat/bri variance
public TColor analog(int angle, float delta)
public float black()
black
in interface ReadonlyTColor
public TColor blend(ReadonlyTColor c, float t)
c
- target colort
- interpolation factor
public float blue()
blue
in interface ReadonlyTColor
public float brightness()
brightness
in interface ReadonlyTColor
public TColor complement()
public TColor copy()
copy
in interface ReadonlyTColor
public float cyan()
cyan
in interface ReadonlyTColor
public TColor darken(float step)
step
-
public TColor desaturate(float step)
step
-
public TColor differenceTo(TColor c)
public float distanceToCMYK(ReadonlyTColor c)
ReadonlyTColor
distanceToCMYK
in interface ReadonlyTColor
c
- target color
public float distanceToHSV(ReadonlyTColor c)
ReadonlyTColor
distanceToHSV
in interface ReadonlyTColor
c
- target color
public float distanceToRGB(ReadonlyTColor c)
ReadonlyTColor
distanceToRGB
in interface ReadonlyTColor
c
- target color
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public TColor getAnalog(float theta, float delta)
getAnalog
in interface ReadonlyTColor
public TColor getAnalog(int angle, float delta)
getAnalog
in interface ReadonlyTColor
public TColor getBlended(ReadonlyTColor c, float t)
getBlended
in interface ReadonlyTColor
public Hue getClosestHue()
getClosestHue
in interface ReadonlyTColor
public Hue getClosestHue(boolean primaryOnly)
getClosestHue
in interface ReadonlyTColor
primaryOnly
- if true, only primary color hues are considered
public TColor getComplement()
getComplement
in interface ReadonlyTColor
public float getComponentValue(AccessCriteria criteria)
getComponentValue
in interface ReadonlyTColor
public TColor getDarkened(float step)
getDarkened
in interface ReadonlyTColor
public TColor getDesaturated(float step)
getDesaturated
in interface ReadonlyTColor
public TColor getDifferenceTo(TColor c)
public TColor getInverted()
getInverted
in interface ReadonlyTColor
public TColor getLightened(float step)
getLightened
in interface ReadonlyTColor
public TColor getRotatedRYB(float theta)
getRotatedRYB
in interface ReadonlyTColor
theta
- rotation angle in radians
public TColor getRotatedRYB(int angle)
getRotatedRYB
in interface ReadonlyTColor
angle
- rotation angle in degrees
public TColor getSaturated(float step)
getSaturated
in interface ReadonlyTColor
public float green()
green
in interface ReadonlyTColor
public int hashCode()
hashCode
in class java.lang.Object
public float hue()
hue
in interface ReadonlyTColor
public TColor invert()
public boolean isBlack()
isBlack
in interface ReadonlyTColor
BLACK_POINT
public boolean isGrey()
isGrey
in interface ReadonlyTColor
GREY_THRESHOLD
public boolean isPrimary()
isPrimary
in interface ReadonlyTColor
public boolean isWhite()
isWhite
in interface ReadonlyTColor
WHITE_POINT
public TColor lighten(float step)
step
- lighten amount
public float luminance()
ReadonlyTColor
luminance
in interface ReadonlyTColor
public float magenta()
magenta
in interface ReadonlyTColor
public float red()
red
in interface ReadonlyTColor
public TColor rotateRYB(float theta)
public TColor rotateRYB(int theta)
theta
-
public TColor saturate(float step)
step
-
public float saturation()
saturation
in interface ReadonlyTColor
public TColor setAlpha(float alpha)
public TColor setARGB(int argb)
argb
-
public TColor setBlack(float val)
public TColor setBlue(float blue)
public TColor setBrightness(float brightness)
public TColor setCMYK(float c, float m, float y, float k)
public TColor setCMYK(float[] newCMYK)
public TColor setComponent(AccessCriteria criteria, float val)
criteria
- val
-
AccessCriteria
public TColor setCyan(float val)
public TColor setGreen(float green)
public TColor setHSV(float h, float s, float v)
public TColor setHSV(float[] newHSV)
public void setHue(float hue)
public TColor setMagenta(float val)
public TColor setRed(float red)
public TColor setRGB(float r, float g, float b)
public TColor setRGB(float[] newRGB)
public TColor setSaturation(float saturation)
public TColor setYellow(float val)
public TColor sub(TColor c)
public TColor subSelf(TColor c)
public int toARGB()
ReadonlyTColor
toARGB
in interface ReadonlyTColor
public float[] toCMYKAArray(float[] cmyka)
ReadonlyTColor
toCMYKAArray
in interface ReadonlyTColor
cmyka
- result array (or null)
public java.lang.String toHex()
public float[] toHSVAArray(float[] hsva)
toHSVAArray
in interface ReadonlyTColor
hsva
- result array (or null)
public float[] toRGBAArray(float[] rgba)
ReadonlyTColor
toRGBAArray
in interface ReadonlyTColor
rgba
- result array (or null)
public float[] toRGBAArray(float[] rgba, int offset)
ReadonlyTColor
toRGBAArray
in interface ReadonlyTColor
public java.lang.String toString()
toString
in class java.lang.Object
public float yellow()
yellow
in interface ReadonlyTColor
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |