Kanzi 3.9.10
ColorRGBA Class Reference

Color with 4 floating point components: red, green, blue and alpha (r, g, b, a). More...

Public Member Functions

 ColorRGBA ()
 Default constructor, initializes the color to (0.0, 0.0, 0.0, 0.0).
 
 ColorRGBA (float r, float g, float b)
 Constructor, initializes the color to (r, g, b, 1.0).
 
 ColorRGBA (float r, float g, float b, float a)
 Constructor, initializes the color to (r, g, b, a).
 
 ColorRGBA (float v)
 Constructor, initializes the color to (v, v, v, v).
 
ColorRGBA add (ColorRGBA v)
 Modifies this color by adding another color.
 
ColorRGBA add (float scalar)
 Adds a scalar to each color element.
 
synchronized void delete ()
 
ColorRGBA divide (float scalar)
 Divides each color element with a scalar.
 
boolean equals (Object obj)
 Indicates whether some other object is "equal to" this one.
 
float get (int index)
 Returns individual color channel value at index.
 
float getAlpha ()
 Returns the alpha element of the color

 
float getBlue ()
 Returns the blue element of the color

 
float getGreen ()
 Returns the green element of the color

 
float getRed ()
 Returns the red element of the color

 
int hashCode ()
 Returns a hash code value for the object.
 
boolean hasNan ()
 Returns true if and only if at least one of the vector values is NaN.
 
ColorRGBA multiply (float scalar)
 Multiplies each color element with a scalar.
 
void set (int index, float v)
 Sets the individual color channel at index to value.
 
void setAlpha (float value)
 Sets the alpha element of the color.
 
void setBlue (float value)
 Sets the blue element of the color.
 
void setGreen (float value)
 Sets the green element of the color.
 
void setRed (float value)
 Sets the red element of the color.
 
ColorRGBA subtract (ColorRGBA v)
 Modifies this color by subtracting another color from this color.
 

Static Public Member Functions

static ColorRGBA add (ColorRGBA v1, ColorRGBA v2)
 Adds two colors and returns the sum.
 
static ColorRGBA add (ColorRGBA v1, float v2)
 Adds a color and a scalar and returns the sum.
 
static ColorRGBA add (float v1, ColorRGBA v2)
 Adds a color and a scalar and returns the sum.
 
static ColorRGBA componentAbs (ColorRGBA v)
 Calculates component-wise absolute value for all elements and returns the resulting color.
 
static ColorRGBA componentAdd (ColorRGBA v, float scalar)
 Adds a value to all color elements and returns the resulting color.
 
static ColorRGBA componentCeil (ColorRGBA v)
 Calculates component-wise ceil value for all elements and returns the resulting color.
 
static ColorRGBA componentFloor (ColorRGBA v)
 Calculates component-wise floor value for all elements and returns the resulting color.
 
static ColorRGBA componentRound (ColorRGBA v)
 Calculates component-wise rounded value for all elements and returns the resulting color.
 
static ColorRGBA componentSqrt (ColorRGBA v)
 Calculates component-wise square root all elements and returns the resulting color.
 
static ColorRGBA componentSubtract (ColorRGBA v, float scalar)
 Subtracts a value from all color elements and returns the resulting color.
 
static ColorRGBA componentWiseDivide (ColorRGBA v1, ColorRGBA v2)
 Divides component-wise all color elements and returns the resulting color.
 
static ColorRGBA componentWiseMax (ColorRGBA v1, ColorRGBA v2)
 Calculates component-wise maximum for all color elements and returns the resulting color.
 
static ColorRGBA componentWiseMin (ColorRGBA v1, ColorRGBA v2)
 Calculates component-wise minimum for all color elements and returns the resulting color.
 
static ColorRGBA componentWiseMultiply (ColorRGBA v1, ColorRGBA v2)
 Multiplies component-wise all color elements and returns the resulting color.
 
static ColorRGBA componentWiseRemainder (ColorRGBA v1, ColorRGBA v2)
 Calculates component-wise the remainder for all color elements and returns the resulting color.
 
static ColorRGBA divide (ColorRGBA v, float scalar)
 Divides all color elements with a scalar and returns the resulting color.
 
static float dotProduct (ColorRGBA v1, ColorRGBA v2)
 Calculates the dot product of two colors.
 
static ColorRGBA fromSRGB (float r, float g, float b)
 Returns a linear color with each element set from a sRGB value.
 
static ColorRGBA fromSRGB (float r, float g, float b, float a)
 Returns a linear color with each element set from a sRGB value.
 
static ColorRGBA getThemeBlue ()
 Returns the default blue theme color.
 
static ColorRGBA getThemeGray ()
 Returns the default gray theme color.
 
static ColorRGBA getThemeGreen ()
 Returns the default green theme color.
 
static ColorRGBA getThemeOrange ()
 Returns the default orange theme color.
 
static ColorRGBA getThemeRed ()
 Returns the default red theme color.
 
static ColorRGBA getThemeYellow ()
 Returns the default yellow theme color.
 
static ColorRGBA highestValue ()
 Returns the color with each element having the most positive float value.
 
static ColorRGBA linearTosRGB (ColorRGBA cs)
 Converts whole ColorRGBA color from linear to sRGB.
 
static ColorRGBA lowestValue ()
 Returns the color with each element having the most negative float value.
 
static ColorRGBA multiply (ColorRGBA v, float scalar)
 Multiplies all color elements with a scalar and returns the resulting color.
 
static ColorRGBA multiply (float scalar, ColorRGBA v)
 Multiplies all color elements with a scalar and returns the resulting color.
 
static ColorRGBA nan ()
 Returns the color with each element being NaN.
 
static ColorRGBA negativeInfinity ()
 Returns the color with each element being the negative infinity.
 
static ColorRGBA one ()
 Returns the color with each element being one.
 
static ColorRGBA opaqueBlack ()
 Returns opaque black color (0.0, 0.0, 0.0, 1.0).
 
static ColorRGBA positiveInfinity ()
 Returns the color with each element being the positive infinity.
 
static ColorRGBA sRGBToLinear (ColorRGBA cs)
 Converts to whole ColorRGBA from sRGB to linear.
 
static ColorRGBA subtract (ColorRGBA v1, ColorRGBA v2)
 Subtracts two colors and returns the difference.
 
static ColorRGBA transparentBlack ()
 Returns transparent black color (0.0, 0.0, 0.0, 0.0).
 
static ColorRGBA zero ()
 Returns the color with each element being zero.
 

Protected Member Functions

void finalize ()
 Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
 

Protected Attributes

transient boolean swigCMemOwn
 Does this object own its native object.
 

Detailed Description

Color with 4 floating point components: red, green, blue and alpha (r, g, b, a).


Constructor & Destructor Documentation

◆ ColorRGBA() [1/3]

Constructor, initializes the color to (v, v, v, v).


Parameters
vRed, Green, Blue, and Alpha component of the color.

◆ ColorRGBA() [2/3]

ColorRGBA ( float r,
float g,
float b )

Constructor, initializes the color to (r, g, b, 1.0).


Parameters
rRed component of the color.
gGreen component of the color.
bBlue component of the color.

◆ ColorRGBA() [3/3]

ColorRGBA ( float r,
float g,
float b,
float a )

Constructor, initializes the color to (r, g, b, a).


Parameters
rRed component of the color.
gGreen component of the color.
bBlue component of the color.
aAlpha component of the color.

Member Function Documentation

◆ add() [1/5]

ColorRGBA add ( ColorRGBA v)

Modifies this color by adding another color.


Parameters
vAnother color.
Returns
This color.

◆ add() [2/5]

static ColorRGBA add ( ColorRGBA v1,
ColorRGBA v2 )
static

Adds two colors and returns the sum.

Parameters
v1Left hand side color.
v2Right hand side color.
Returns
The result color.

◆ add() [3/5]

static ColorRGBA add ( ColorRGBA v1,
float v2 )
static

Adds a color and a scalar and returns the sum.

Parameters
v1Left hand side color.
v2Right hand side scalar.
Returns
The result color.

◆ add() [4/5]

ColorRGBA add ( float scalar)

Adds a scalar to each color element.


Parameters
scalarAnother color.
Returns
This color.

◆ add() [5/5]

static ColorRGBA add ( float v1,
ColorRGBA v2 )
static

Adds a color and a scalar and returns the sum.

Parameters
v1Left hand side scalar.
v2Right hand side color.
Returns
The result color.

◆ componentAbs()

static ColorRGBA componentAbs ( ColorRGBA v)
static

Calculates component-wise absolute value for all elements and returns the resulting color.


Parameters
vColor input.
Returns
The result color.

◆ componentAdd()

static ColorRGBA componentAdd ( ColorRGBA v,
float scalar )
static

Adds a value to all color elements and returns the resulting color.


Parameters
vColor.
scalarValue
Returns
Result color.

◆ componentCeil()

static ColorRGBA componentCeil ( ColorRGBA v)
static

Calculates component-wise ceil value for all elements and returns the resulting color.


Parameters
vColor input.
Returns
The result color.

◆ componentFloor()

static ColorRGBA componentFloor ( ColorRGBA v)
static

Calculates component-wise floor value for all elements and returns the resulting color.


Parameters
vColor input.
Returns
The result color.

◆ componentRound()

static ColorRGBA componentRound ( ColorRGBA v)
static

Calculates component-wise rounded value for all elements and returns the resulting color.


Parameters
vColor input.
Returns
The result color.

◆ componentSqrt()

static ColorRGBA componentSqrt ( ColorRGBA v)
static

Calculates component-wise square root all elements and returns the resulting color.


Parameters
vColor input.
Returns
The result color.

◆ componentSubtract()

static ColorRGBA componentSubtract ( ColorRGBA v,
float scalar )
static

Subtracts a value from all color elements and returns the resulting color.


Parameters
vColor.
scalarValue
Returns
Result color.

◆ componentWiseDivide()

static ColorRGBA componentWiseDivide ( ColorRGBA v1,
ColorRGBA v2 )
static

Divides component-wise all color elements and returns the resulting color.


Parameters
v1The first color.
v2The second color.
Returns
The result color.

◆ componentWiseMax()

static ColorRGBA componentWiseMax ( ColorRGBA v1,
ColorRGBA v2 )
static

Calculates component-wise maximum for all color elements and returns the resulting color.


Parameters
v1The first color.
v2The second color.
Returns
The result color.

◆ componentWiseMin()

static ColorRGBA componentWiseMin ( ColorRGBA v1,
ColorRGBA v2 )
static

Calculates component-wise minimum for all color elements and returns the resulting color.


Parameters
v1The first color.
v2The second color.
Returns
The result color.

◆ componentWiseMultiply()

static ColorRGBA componentWiseMultiply ( ColorRGBA v1,
ColorRGBA v2 )
static

Multiplies component-wise all color elements and returns the resulting color.


Parameters
v1The first color.
v2The second color.
Returns
The result color.

◆ componentWiseRemainder()

static ColorRGBA componentWiseRemainder ( ColorRGBA v1,
ColorRGBA v2 )
static

Calculates component-wise the remainder for all color elements and returns the resulting color.


Parameters
v1The first color.
v2The second color.
Returns
The result color.

◆ divide() [1/2]

static ColorRGBA divide ( ColorRGBA v,
float scalar )
static

Divides all color elements with a scalar and returns the resulting color.

Parameters
vA color.
scalarA scalar.
Returns
The result color.

◆ divide() [2/2]

ColorRGBA divide ( float scalar)

Divides each color element with a scalar.


Parameters
scalarDivider for each color element.
Returns
This color.

◆ dotProduct()

static float dotProduct ( ColorRGBA v1,
ColorRGBA v2 )
static

Calculates the dot product of two colors.


Parameters
v1The first color.
v2The second color.
Returns
The dot product of the colors.

◆ equals()

boolean equals ( Object obj)

Indicates whether some other object is "equal to" this one.

Parameters
objThe reference object with which to compare.
Returns
True if this object is the same as the obj argument, otherwise false.

◆ finalize()

void finalize ( )
protected

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

Finalization is deprecated and subject to removal in future.

◆ fromSRGB() [1/2]

static ColorRGBA fromSRGB ( float r,
float g,
float b )
static

Returns a linear color with each element set from a sRGB value.


Parameters
rRed Channel (0-1.0)
gGreen Channel (0-1.0)
bBlue Channel (0-1.0)
Returns
Color in linear color space.

◆ fromSRGB() [2/2]

static ColorRGBA fromSRGB ( float r,
float g,
float b,
float a )
static

Returns a linear color with each element set from a sRGB value.


Parameters
rRed Channel (0-1.0)
gGreen Channel (0-1.0)
bBlue Channel (0-1.0)
aAlpha Channel (0-1.0)
Returns
Color in linear color space.

◆ get()

float get ( int index)

Returns individual color channel value at index.


Returns
The color channel value at index.

◆ getAlpha()

float getAlpha ( )

Returns the alpha element of the color

Returns
The alpha element.

◆ getBlue()

float getBlue ( )

Returns the blue element of the color

Returns
The blue element.

◆ getGreen()

float getGreen ( )

Returns the green element of the color

Returns
The green element.

◆ getRed()

float getRed ( )

Returns the red element of the color

Returns
The red element.

◆ getThemeBlue()

static ColorRGBA getThemeBlue ( )
static

Returns the default blue theme color.


Returns
The default blue theme color.

◆ getThemeGray()

static ColorRGBA getThemeGray ( )
static

Returns the default gray theme color.


Returns
The default gray theme color.

◆ getThemeGreen()

static ColorRGBA getThemeGreen ( )
static

Returns the default green theme color.


Returns
The default green theme color.

◆ getThemeOrange()

static ColorRGBA getThemeOrange ( )
static

Returns the default orange theme color.


Returns
The default orange theme color.

◆ getThemeRed()

static ColorRGBA getThemeRed ( )
static

Returns the default red theme color.


Returns
The default red theme color.

◆ getThemeYellow()

static ColorRGBA getThemeYellow ( )
static

Returns the default yellow theme color.


Returns
The default yellow theme color.

◆ hashCode()

int hashCode ( )

Returns a hash code value for the object.

Returns
A hash code value for this object.

◆ highestValue()

static ColorRGBA highestValue ( )
static

Returns the color with each element having the most positive float value.


Returns
Color with the highest possible value.

◆ linearTosRGB()

static ColorRGBA linearTosRGB ( ColorRGBA cs)
static

Converts whole ColorRGBA color from linear to sRGB.


Parameters
csColor in linear format.
Returns
Color in sRGB format.

◆ lowestValue()

static ColorRGBA lowestValue ( )
static

Returns the color with each element having the most negative float value.


Returns
Color with the lowest possible value.

◆ multiply() [1/3]

static ColorRGBA multiply ( ColorRGBA v,
float scalar )
static

Multiplies all color elements with a scalar and returns the resulting color.

Parameters
vA color.
scalarA scalar.
Returns
The result color.

◆ multiply() [2/3]

ColorRGBA multiply ( float scalar)

Multiplies each color element with a scalar.


Parameters
scalarMultiplier for each color element.
Returns
This color.

◆ multiply() [3/3]

static ColorRGBA multiply ( float scalar,
ColorRGBA v )
static

Multiplies all color elements with a scalar and returns the resulting color.

Parameters
scalarA scalar.
vA color.
Returns
The result color.

◆ nan()

static ColorRGBA nan ( )
static

Returns the color with each element being NaN.


Returns
Color with NaN elements.

◆ negativeInfinity()

static ColorRGBA negativeInfinity ( )
static

Returns the color with each element being the negative infinity.


Returns
Color with negative infinity elements.

◆ one()

static ColorRGBA one ( )
static

Returns the color with each element being one.


Returns
Color with unit element values.

◆ opaqueBlack()

static ColorRGBA opaqueBlack ( )
static

Returns opaque black color (0.0, 0.0, 0.0, 1.0).


Returns
Opaque black.

◆ positiveInfinity()

static ColorRGBA positiveInfinity ( )
static

Returns the color with each element being the positive infinity.


Returns
Color with positive infinity elements.

◆ set()

void set ( int index,
float v )

Sets the individual color channel at index to value.


Parameters
indexColor channel index to set.

◆ setAlpha()

void setAlpha ( float value)

Sets the alpha element of the color.


Parameters
valueThe new value of the alpha element.

◆ setBlue()

void setBlue ( float value)

Sets the blue element of the color.


Parameters
valueThe new value of the blue element.

◆ setGreen()

void setGreen ( float value)

Sets the green element of the color.


Parameters
valueThe new value of the green element.

◆ setRed()

void setRed ( float value)

Sets the red element of the color.


Parameters
valueThe new value of the red element.

◆ sRGBToLinear()

static ColorRGBA sRGBToLinear ( ColorRGBA cs)
static

Converts to whole ColorRGBA from sRGB to linear.


Parameters
csColor in sRGB format.
Returns
Color in linear format.

◆ subtract() [1/2]

ColorRGBA subtract ( ColorRGBA v)

Modifies this color by subtracting another color from this color.


Parameters
vAnother color.
Returns
This color.

◆ subtract() [2/2]

static ColorRGBA subtract ( ColorRGBA v1,
ColorRGBA v2 )
static

Subtracts two colors and returns the difference.

Parameters
v1Left hand side color.
v2Right hand side color.
Returns
The result color.

◆ transparentBlack()

static ColorRGBA transparentBlack ( )
static

Returns transparent black color (0.0, 0.0, 0.0, 0.0).


Returns
Transparent black color.

◆ zero()

static ColorRGBA zero ( )
static

Returns the color with each element being zero.


Returns
Color with zeroed elements.