V8 Javascript API

RS.Math.Spectrum Class Reference

[Math]

Description

A Spectrum.

Constructor

 Spectrum( Object color)
More...

Functions

Spectrum add( Spectrum rhs)
Adds rhs to this color and stores the result in this color. More...
 cie_intensity()
Returns the intensity of the RGB components, weighted according to the CIE standard.
 clone()
returns a copy of this color.
Boolean equal( Spectrum rhs, Boolean use_tolerance)
Returns true if this spectrum equals rhs. More...
Boolean equal_with_tolerance( Spectrum rhs, Number tolerance)
Returns true if this vector equals rhs using tolerance. More...
 gamma_correct( undefined gamma_factor)
Returns a gamma corrected color. Does not affect this colour.
Boolean is_black( Number tolerance)
Checks if the color is black. More...
 linear_intensity()
Returns the intensity of the RGB components, equally weighted.
 ntsc_intensity()
Returns the intensity of the RGB components, weighted according to the NTSC standard.
Spectrum scale( Number scale)
Scales this color. More...
 set( Spectrum rhs)
Sets this vector from an object. More...
Spectrum subtract( Spectrum rhs)
Subtracts rhs from this color and stores the result in this color. More...
Spectrum tint( Spectrum rhs)
Tints this color by rhs. More...
String toString()
Returns a string describing this Object. More...

Constructor

RS.​Math.​Spectrum( Object color)

Parameters

color
Initial value. May be one of the following:
  • Array
  • Object
  • Color
  • Spectrum

Functions

Spectrum RS.​Math.​Spectrum.add( Spectrum rhs)

Adds rhs to this color and stores the result in this color.

Parameters

rhs
the color to add.

Returns

this

RS.​Math.​Spectrum.cie_intensity()

Returns the intensity of the RGB components, weighted according to the CIE standard.

RS.​Math.​Spectrum.clone()

returns a copy of this color.

Boolean RS.​Math.​Spectrum.equal( Spectrum rhs, Boolean use_tolerance)

Returns true if this spectrum equals rhs.

Parameters

rhs
The spectrum to compare with.
use_tolerance
if supplied and true then use tolerance
Boolean RS.​Math.​Spectrum.equal_with_tolerance( Spectrum rhs, Number tolerance)

Returns true if this vector equals rhs using tolerance.

Parameters

rhs
The vector to compare with.
tolerance
The tolerance to use or RS.Math.ALMOST_ZERO if not supplied.
RS.​Math.​Spectrum.gamma_correct( undefined gamma_factor)

Returns a gamma corrected color. Does not affect this colour.

Boolean RS.​Math.​Spectrum.is_black( Number tolerance)

Checks if the color is black.

Parameters

tolerance
Optional. A Number used to approximate the comparison.
RS.​Math.​Spectrum.linear_intensity()

Returns the intensity of the RGB components, equally weighted.

RS.​Math.​Spectrum.ntsc_intensity()

Returns the intensity of the RGB components, weighted according to the NTSC standard.

Spectrum RS.​Math.​Spectrum.scale( Number scale)

Scales this color.

Parameters

scale
Scale the scalar to apply.

Returns

this

RS.​Math.​Spectrum.set( Spectrum rhs)

Sets this vector from an object. The object may be of the following types: Spectrum, and Array with 3 or more members or an Object. In the case of an object it must have the members x, y, z, and optionally w. If w is omitted then w will be set to 1.

Parameters

rhs
The object to set from. May be one of the following:
  • Array
  • Object
  • Color
  • Spectrum
Spectrum RS.​Math.​Spectrum.subtract( Spectrum rhs)

Subtracts rhs from this color and stores the result in this color.

Parameters

rhs
the color to subtract.

Returns

this

Spectrum RS.​Math.​Spectrum.tint( Spectrum rhs)

Tints this color by rhs.

Parameters

rhs
the color to subtract.

Returns

this

String RS.​Math.​Spectrum.toString()

Returns a string describing this Object.

Returns

A String describing this Object.