Drag[en]gine Script Module DragonScript
1.23
|
Immutable 3-component double precision color. More...
Public Member Functions | |
Management | |
float | getRed () |
Red intensity. More... | |
float | getGreen () |
Green intensity. More... | |
float | getBlue () |
Blue intensity. More... | |
float | getAlpha () |
Alpha value. More... | |
Color | clamp () |
Color with all intensities clamped to the range of 0 to 1. More... | |
Color | invert () |
Inverted color. More... | |
bool | isEqual (Color c) |
Color is equal to another object.. More... | |
bool | isEqual (Color c, float delta) |
Two colors are equal. More... | |
bool | equals (Object other) |
Color is equal to another object. More... | |
int | hashCode () |
Hash code for use as dictionary keys. More... | |
String | toString () |
String representation of color. More... | |
String | toString (int precision) |
String representation of color with precision. More... | |
Array | toHSV () |
Convert to HSV. More... | |
Array | toHSL () |
Convert to HSL. More... | |
Array | toCMYK () |
Convert to CMYK. More... | |
Operators | |
Color | operator+ (Color v) |
Sum of two colors. More... | |
Color | operator- (Color v) |
Difference of two colors. More... | |
Color | operator* (float scalar) |
Color scaled by scalar. More... | |
Color | operator/ (float scalar) |
Color with each component divided by a value. More... | |
Color | operator* (Color v) |
Two colors intensity wise multiplied. More... | |
Static Public Attributes | |
Color constants | |
static final Color | white = Color.new(1, 1, 1, 1) |
White. More... | |
static final Color | lightGray = Color.new(0.75, 0.75, 0.75, 1) |
light gray. More... | |
static final Color | gray = Color.new(0.5, 0.5, 0.5, 1) |
gray. More... | |
static final Color | darkGray = Color.new(0.25, 0.25, 0.25, 1) |
Dark gray. More... | |
static final Color | black = Color.new(0, 0, 0, 1) |
Black. More... | |
static final Color | red = Color.new(1, 0, 0, 1) |
Red. More... | |
static final Color | darkRed = Color.new(0.5, 0, 0, 1) |
Dark red. More... | |
static final Color | green = Color.new(0, 1, 0, 1) |
Green. More... | |
static final Color | darkGreen = Color.new(0, 0.5, 0, 1) |
Dark green. More... | |
static final Color | blue = Color.new(0, 0, 1, 1) |
Blue. More... | |
static final Color | darkBlue = Color.new(0, 0, 0.5, 1) |
Dark blue. More... | |
static final Color | yellow = Color.new(1, 1, 0, 1) |
Yellow. More... | |
static final Color | transparent = Color.new(0, 0, 0, 0) |
Transparent. More... | |
Constructors | |
Color | new (float red, float green, float blue) |
Create color. More... | |
Color | new (float red, float green, float blue, float alpha) |
Create color. More... | |
Color | new (Color color, float alpha) |
Create color from another color with alpha replaced. More... | |
static Color | newRGB (int red, int green, int blue) |
Create color from rgb values in the range from 0 to 1. More... | |
static Color | newRGBA (int red, int green, int blue, int alpha) |
Create color from rgb values in the range from 0 to 1. More... | |
static Color | newHSV (float hue, float saturation, float value) |
Create color from HSV. More... | |
static Color | newHSL (float hue, float saturation, float lightness) |
Create color from HSL. More... | |
static Color | newCMYK (float cyan, float magenta, float yellow, float black) |
Create color from CMYK. More... | |
File Handling | |
void | writeToFile (FileWriter writer) |
Write color to a file writer. More... | |
static Color | readFromFile (FileReader reader) |
Read color from a file reader. More... | |
Immutable 3-component double precision color.
This is a native class. It can not be subclassed.
bool Dragengine.Gui.Color.equals | ( | Object | other | ) |
float Dragengine.Gui.Color.getAlpha | ( | ) |
Alpha value.
float Dragengine.Gui.Color.getBlue | ( | ) |
Blue intensity.
float Dragengine.Gui.Color.getGreen | ( | ) |
Green intensity.
float Dragengine.Gui.Color.getRed | ( | ) |
Red intensity.
int Dragengine.Gui.Color.hashCode | ( | ) |
Hash code for use as dictionary keys.
Implements Object.hashCode().
Color Dragengine.Gui.Color.invert | ( | ) |
Inverted color.
bool Dragengine.Gui.Color.isEqual | ( | Color | c, |
float | delta | ||
) |
Two colors are equal.
Create color from another color with alpha replaced.
Color Dragengine.Gui.Color.new | ( | float | red, |
float | green, | ||
float | blue | ||
) |
Create color.
Color Dragengine.Gui.Color.new | ( | float | red, |
float | green, | ||
float | blue, | ||
float | alpha | ||
) |
Create color.
|
static |
Create color from CMYK.
cyan | Cyan in the range from 0 to 1. Value is clamped. |
magenta | Magenta in the range from 0 to 1. Value is clamped. |
yellow | Yellow in the range from 0 to 1. Value is clamped. |
black | Black in the range from 0 to 1. Value is clamped. |
|
static |
Create color from HSL.
hue | Hue in the range from 0 (0 degrees) to 1 (360 degrees). Values outside this range are normalized hence -0.2 is used as 0.8 for the calculation. |
saturation | Saturation in the range from 0 to 1. Value is clamped. |
lightness | Lightness in the range from 0 to 1. Value is clamped. |
|
static |
Create color from HSV.
hue | Hue in the range from 0 (0 degrees) to 1 (360 degrees). Values outside this range are normalized hence -0.2 is used as 0.8 for the calculation. |
saturation | Saturation in the range from 0 to 1. Value is clamped. |
value | Value in the range from 0 to 1. Value is clamped. |
|
static |
Create color from rgb values in the range from 0 to 1.
|
static |
Create color from rgb values in the range from 0 to 1.
Color Dragengine.Gui.Color.operator/ | ( | float | scalar | ) |
Color with each component divided by a value.
EDivisionByZero | scalar is 0. |
|
static |
Read color from a file reader.
Array Dragengine.Gui.Color.toCMYK | ( | ) |
Convert to CMYK.
Returns Array with 4 floats in this order: cyan, magenta, yellow and black. Cyan in the range from 0 to 1. Magenta in the range from 0 to 1. Yellow in the range from 0 to 1. Black in the range from 0 to 1.
Array Dragengine.Gui.Color.toHSL | ( | ) |
Convert to HSL.
Returns Array with 3 floats in this order: hue, saturation and lightness. Hue in the range from 0 (0 degrees) to 1 (360 degrees). Saturation in the range from 0 to 1. Lightness in the range from 0 to 1.
Array Dragengine.Gui.Color.toHSV | ( | ) |
Convert to HSV.
Returns Array with 3 floats in this order: hue, saturation and value. Hue in the range from 0 (0 degrees) to 1 (360 degrees). Saturation in the range from 0 to 1. Value in the range from 0 to 1.
String Dragengine.Gui.Color.toString | ( | ) |
String representation of color.
Implements Object.toString()
String Dragengine.Gui.Color.toString | ( | int | precision | ) |
String representation of color with precision.
Same as toString() except the count of digits of each component is precision.
precision | Precision in digits in the range from 0 to 9 inclusive. |
EInvalidParam | precision is less than 0 or larger than 9. |
void Dragengine.Gui.Color.writeToFile | ( | FileWriter | writer | ) |
Write color to a file writer.