Drag[en]gine Script Module DragonScript Script API  1.0
Color Class Reference

Immutable 3-component double precision color. More...

Inheritance diagram for Color:

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 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...
 
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.0, 1.0, 1.0, 1.0 )
 White. More...
 
static final Color LIGHTGRAY = Color.new( 0.75, 0.75, 0.75, 1.0 )
 light gray. More...
 
static final Color GRAY = Color.new( 0.5, 0.5, 0.5, 1.0 )
 gray. More...
 
static final Color DARKGRAY = Color.new( 0.25, 0.25, 0.25, 1.0 )
 Dark gray. More...
 
static final Color BLACK = Color.new( 0.0, 0.0, 0.0, 1.0 )
 Black. More...
 
static final Color RED = Color.new( 1.0, 0.0, 0.0, 1.0 )
 Red. More...
 
static final Color DARKRED = Color.new( 0.5, 0.0, 0.0, 1.0 )
 Dark red. More...
 
static final Color GREEN = Color.new( 0.0, 1.0, 0.0, 1.0 )
 Green. More...
 
static final Color DARKGREEN = Color.new( 0.0, 0.5, 0.0, 1.0 )
 Dark green. More...
 
static final Color BLUE = Color.new( 0.0, 0.0, 1.0, 1.0 )
 Blue. More...
 
static final Color DARKBLUE = Color.new( 0.0, 0.0, 0.5, 1.0 )
 Dark blue. More...
 
static final Color YELLOW = Color.new( 1.0, 1.0, 0.0, 1.0 )
 Yellow. More...
 
static final Color TRANSPARENT = Color.new( 0.0, 0.0, 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...
 
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...
 

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...
 

Detailed Description

Immutable 3-component double precision color.

This is a native class. It can not be subclassed.

Author
Roland Pl├╝ss
Version
1.0
Date
2015

Member Function Documentation

§ clamp()

Color clamp ( )

Color with all intensities clamped to the range of 0 to 1.

§ equals()

bool equals ( Object  other)

Color is equal to another object.

Implements Object.equals(Object).

Returns
true if other is of type Color and components are equal.

§ getAlpha()

float getAlpha ( )

Alpha value.

§ getBlue()

float getBlue ( )

Blue intensity.

§ getGreen()

float getGreen ( )

Green intensity.

§ getRed()

float getRed ( )

Red intensity.

§ hashCode()

int hashCode ( )

Hash code for use as dictionary keys.

Implements Object.hashCode().

§ invert()

Color invert ( )

Inverted color.

§ isEqual()

bool isEqual ( Color  c)

Color is equal to another object..

§ new() [1/2]

Color new ( float  red,
float  green,
float  blue 
)

Create color.

§ new() [2/2]

Color new ( float  red,
float  green,
float  blue,
float  alpha 
)

Create color.

§ newRGB()

static Color newRGB ( int  red,
int  green,
int  blue 
)
static

Create color from rgb values in the range from 0 to 1.

§ newRGBA()

static Color newRGBA ( int  red,
int  green,
int  blue,
int  alpha 
)
static

Create color from rgb values in the range from 0 to 1.

§ operator*() [1/2]

Color operator* ( float  scalar)

Color scaled by scalar.

§ operator*() [2/2]

Color operator* ( Color  v)

Two colors intensity wise multiplied.

§ operator+()

Color operator+ ( Color  v)

Sum of two colors.

§ operator-()

Color operator- ( Color  v)

Difference of two colors.

§ operator/()

Color operator/ ( float  scalar)

Color with each component divided by a value.

Exceptions
EDivisionByZeroscalar is 0.

§ readFromFile()

static Color readFromFile ( FileReader  reader)
static

Read color from a file reader.

§ toString()

String toString ( )

String representation of color.

Implements Object.toString()

§ writeToFile()

void writeToFile ( FileWriter  writer)

Write color to a file writer.

Member Data Documentation

§ BLACK

final Color BLACK = Color.new( 0.0, 0.0, 0.0, 1.0 )
static

Black.

§ BLUE

final Color BLUE = Color.new( 0.0, 0.0, 1.0, 1.0 )
static

Blue.

§ DARKBLUE

final Color DARKBLUE = Color.new( 0.0, 0.0, 0.5, 1.0 )
static

Dark blue.

§ DARKGRAY

final Color DARKGRAY = Color.new( 0.25, 0.25, 0.25, 1.0 )
static

Dark gray.

§ DARKGREEN

final Color DARKGREEN = Color.new( 0.0, 0.5, 0.0, 1.0 )
static

Dark green.

§ DARKRED

final Color DARKRED = Color.new( 0.5, 0.0, 0.0, 1.0 )
static

Dark red.

§ GRAY

final Color GRAY = Color.new( 0.5, 0.5, 0.5, 1.0 )
static

gray.

§ GREEN

final Color GREEN = Color.new( 0.0, 1.0, 0.0, 1.0 )
static

Green.

§ LIGHTGRAY

final Color LIGHTGRAY = Color.new( 0.75, 0.75, 0.75, 1.0 )
static

light gray.

§ RED

final Color RED = Color.new( 1.0, 0.0, 0.0, 1.0 )
static

Red.

§ TRANSPARENT

final Color TRANSPARENT = Color.new( 0.0, 0.0, 0.0, 0.0 )
static

Transparent.

§ WHITE

final Color WHITE = Color.new( 1.0, 1.0, 1.0, 1.0 )
static

White.

§ YELLOW

final Color YELLOW = Color.new( 1.0, 1.0, 0.0, 1.0 )
static

Yellow.


The documentation for this class was generated from the following file: