Kanzi  3.9.5
Java API
ColorRGBA Class Reference

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

Public Member Functions

 ColorRGBA (long cPtr, boolean cMemoryOwn)
 
 ColorRGBA ()
 Default constructor, initializes the color to (0.0, 0.0, 0.0, 0.0).
 
 ColorRGBA (float v)
 Constructor, initializes the color to (v, v, v, v). More...
 
 ColorRGBA (float r, float g, float b)
 Constructor, initializes the color to (r, g, b, 1.0). More...
 
 ColorRGBA (float r, float g, float b, float a)
 Constructor, initializes the color to (r, g, b, a). More...
 
ColorRGBA add (float scalar)
 Adds a scalar to each color element. More...
 
ColorRGBA add (ColorRGBA v)
 Modifies this color by adding another color. More...
 
synchronized void delete ()
 
ColorRGBA divide (float scalar)
 Divides each color element with a scalar. More...
 
boolean equals (Object obj)
 
float get (long index)
 Returns individual color channel value at index. More...
 
float getAlpha ()
 Returns the alpha element of the color
More...
 
float getBlue ()
 Returns the blue element of the color
More...
 
float getGreen ()
 Returns the green element of the color
More...
 
float getRed ()
 Returns the red element of the color
More...
 
int hashCode ()
 
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. More...
 
void set (long index, float v)
 Sets the individual color channel at index to value. More...
 
void setAlpha (float value)
 Sets the alpha element of the color. More...
 
void setBlue (float value)
 Sets the blue element of the color. More...
 
void setGreen (float value)
 Sets the green element of the color. More...
 
void setRed (float value)
 Sets the red element of the color. More...
 
ColorRGBA subtract (ColorRGBA v)
 Modifies this color by subtracting another color from this color. More...
 

Static Public Member Functions

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

Protected Member Functions

void finalize ()
 

Protected Attributes

transient boolean swigCMemOwn
 

Detailed Description

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


Constructor & Destructor Documentation

◆ ColorRGBA() [1/3]

ColorRGBA ( float  v)

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 ( float  scalar)

Adds a scalar to each color element.


Parameters
scalarAnother color.
Returns
This color.

◆ add() [2/5]

ColorRGBA add ( ColorRGBA  v)

Modifies this color by adding another color.


Parameters
vAnother color.
Returns
This color.

◆ add() [3/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() [4/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.

◆ add() [5/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.

◆ 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]

ColorRGBA divide ( float  scalar)

Divides each color element with a scalar.


Parameters
scalarDivider for each color element.
Returns
This color.

◆ divide() [2/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.

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

◆ fromSRGB() [1/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.

◆ fromSRGB() [2/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.

◆ get()

float get ( long  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.

◆ 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]

ColorRGBA multiply ( float  scalar)

Multiplies each color element with a scalar.


Parameters
scalarMultiplier for each color element.
Returns
This color.

◆ multiply() [2/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.

◆ multiply() [3/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.

◆ 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 ( long  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.