Color.kl¶
Types¶
Color (struct)¶
The color type represents a 32 bit float 4 channel color value, storing the components ordered as red, green, blue and alpha.
/*
** Example: Construct Color
*/
Color colorFromByte(255, 0, 0);
Color colorFromScalar(0.0, 1.0, 0.0);
Color blendColor = colorFromByte.linearInterpolate(colorFromScalar, 0.6);
Methods¶
| Color ( in Color other ) | |
| Color ( in Float64 v ) | |
| Color ( in Integer r, in Integer g, in Integer b ) | |
| Color ( in Integer r, in Integer g, in Integer b, in Integer a ) | |
| Color ( in RGB r ) | |
| Color ( in RGBA r ) | |
| Color ( in SInt16 v ) | |
| Color ( in SInt32 v ) | |
| Color ( in SInt64 v ) | |
| Color ( in Scalar r, in Scalar g, in Scalar b ) | |
| Color ( in Scalar r, in Scalar g, in Scalar b, in Scalar a ) | |
| Color ( in Scalar v ) | |
| Color ( in UInt16 r, in UInt16 g, in UInt16 b ) | |
| Color ( in UInt16 r, in UInt16 g, in UInt16 b, in UInt16 a ) | |
| Color ( in UInt16 v ) | |
| Color ( in UInt32 v ) | |
| Color ( in UInt64 v ) | |
| Color ( in UInt8 r, in UInt8 g, in UInt8 b ) | |
| Color ( in UInt8 r, in UInt8 g, in UInt8 b, in UInt8 a ) | |
| Color ( in UInt8 v ) | |
| Color ( in Vec3 v ) | |
| Color ( in Vec4 v ) | |
| Color () | |
| Color | add ? ( in Color other ) | 
| Boolean | almostEqual ? ( in Color other ) | 
| Boolean | almostEqual ? ( in Color other, in Scalar precision ) | 
| Color | clone ? () | 
| Scalar | component ? ( in Size i ) | 
| Color | divide ? ( in Color other ) | 
| Color | divideScalar ? ( in Scalar other ) | 
| Boolean | equal ? ( in Color other ) | 
| get ? ( io Float32 v<> ) | |
| get ? ( io Float32 v<>, in UInt32 o ) | |
| get ? ( io Float32 v[] ) | |
| get ? ( io Float32 v[], in UInt32 o ) | |
| get ? ( io Float64 v<> ) | |
| get ? ( io Float64 v<>, in UInt32 o ) | |
| get ? ( io Float64 v[] ) | |
| get ? ( io Float64 v[], in UInt32 o ) | |
| UInt32 | hash ? () | 
| Color | linearInterpolate ? ( in Color other, in Scalar t ) | 
| Color | multiply ? ( in Color other ) | 
| Color | multiplyScalar ? ( in Scalar other ) | 
| set ! ( in Float32 v<> ) | |
| set ! ( in Float32 v<>, in UInt32 o ) | |
| set ! ( in Float64 v<> ) | |
| set ! ( in Float64 v<>, in UInt32 o ) | |
| set ! ( in Scalar r, in Scalar g, in Scalar b, in Scalar a ) | |
| setComponent ! ( in Size i, in Scalar v ) | |
| setFromHSV ! ( in Scalar hue, in Scalar saturation, in Scalar value ) | |
| Color | subtract ? ( in Color other ) | 
| toHSV ? ( out Scalar hue, out Scalar saturation, out Scalar value ) | |
| RGB | toRGB ? () | 
| RGBA | toRGBA ? () | 
Functions¶
randomColor¶
Color randomColor ( in UInt32 seed, in UInt32 offset, in Scalar gammaAdjustment )
Generates a random color based on a seed and offset with gamma adjustment.
/*
** Example: Construct :ref:`Color <color>`
*/
:ref:`UInt32 <uint32>` seed = 8765;
:ref:`UInt32 <uint32>` offset = 0;
// Generate a regular random color
:ref:`Color <color>` color = randomColor(seed, ++offset);
// Generate a light random color
:ref:`Color <color>` color = randomColor(seed, ++offset, 0.5);
// Generate a dark random color
:ref:`Color <color>` color = randomColor(seed, ++offset, -0.5);
| seed | The seed to base the random number geration on. | 
| offset | The offset to use in the random number sequence. | 
| gammaAdjustment | A gamma adjustment to offset the range of the generated color. | 
randomColor¶
Color randomColor ( in UInt32 seed, in UInt32 offset, in Scalar gammaAdjustment )
Generates a random color based on a seed and offset with gamma adjustment.
/*
** Example: Construct Color
*/
UInt32 seed = 8765;
UInt32 offset = 0;
// Generate a regular random color
Color color = randomColor(seed, ++offset);
// Generate a light random color
Color color = randomColor(seed, ++offset, 0.5);
// Generate a dark random color
Color color = randomColor(seed, ++offset, -0.5);
| seed | The seed to base the random number geration on. | 
| offset | The offset to use in the random number sequence. | 
| gammaAdjustment | A gamma adjustment to offset the range of the generated color. |