# ColorSpace.Rgb

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# Rgb

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/graphics/ColorSpace.Rgb "View this page in Java")  

```
open class Rgb : ColorSpace
```

|---|---|--------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                        |||
| ↳ | [android.graphics.ColorSpace](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace)             ||
|   | ↳ | [android.graphics.ColorSpace.Rgb](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#) |

An RGB color space is an additive color space using the[RGB](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Model)color model (a color is therefore represented by a tuple of 3 numbers).

A specific RGB color space is defined by the following properties:

- Three chromaticities of the red, green and blue primaries, which define the gamut of the color space.
- A white point chromaticity that defines the stimulus to which color space values are normalized (also just called "white").
- An opto-electronic transfer function, also called opto-electronic conversion function or often, and approximately, gamma function.
- An electro-optical transfer function, also called electo-optical conversion function or often, and approximately, gamma function.
- A range of valid RGB values (most commonly \\(\[0..1\]\\)).

The most commonly used RGB color space is[sRGB](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Named).

### Primaries and white point chromaticities

In this implementation, the chromaticity of the primaries and the white point of an RGB color space is defined in the CIE xyY color space. This color space separates the chromaticity of a color, the x and y components, and its luminance, the Y component. Since the primaries and the white point have full brightness, the Y component is assumed to be 1 and only the x and y components are needed to encode them.

For convenience, this implementation also allows to define the primaries and white point in the CIE XYZ space. The tristimulus XYZ values are internally converted to xyY.

<br />

sRGB primaries and white point

<br />

### Transfer functions

A transfer function is a color component conversion function, defined as a single variable, monotonic mathematical function. It is applied to each individual component of a color. They are used to perform the mapping between linear tristimulus values and non-linear electronic signal value.

The*opto-electronic transfer function*(OETF or OECF) encodes tristimulus values in a scene to a non-linear electronic signal value. An OETF is often expressed as a power function with an exponent between 0.38 and 0.55 (the reciprocal of 1.8 to 2.6).

The*electro-optical transfer function*(EOTF or EOCF) decodes a non-linear electronic signal value to a tristimulus value at the display. An EOTF is often expressed as a power function with an exponent between 1.8 and 2.6.

Transfer functions are used as a compression scheme. For instance, linear sRGB values would normally require 11 to 12 bits of precision to store all values that can be perceived by the human eye. When encoding sRGB values using the appropriate OETF (see[sRGB](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Named)for an exact mathematical description of that OETF), the values can be compressed to only 8 bits precision.

When manipulating RGB values, particularly sRGB values, it is safe to assume that these values have been encoded with the appropriate OETF (unless noted otherwise). Encoded values are often said to be in "gamma space". They are therefore defined in a non-linear space. This in turns means that any linear operation applied to these values is going to yield mathematically incorrect results (any linear interpolation such as gradient generation for instance, most image processing functions such as blurs, etc.).

To properly process encoded RGB values you must first apply the EOTF to decode the value into linear space. After processing, the RGB value must be encoded back to non-linear ("gamma") space. Here is a formal description of the process, where \\(f\\) is the processing function to apply:
$$RGB_{out} = OETF(f(EOTF(RGB_{in})))$$

If the transfer functions of the color space can be expressed as an ICC parametric curve as defined in ICC.1:2004-10, the numeric parameters can be retrieved by calling[getTransferParameters()](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#getTransferParameters()). This can be useful to match color spaces for instance.

Some RGB color spaces, such as[Named.ACES](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Named)and[scRGB](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Named), are said to be linear because their transfer functions are the identity function: \\(f(x) = x\\). If the source and/or destination are known to be linear, it is not necessary to invoke the transfer functions.

### Range

Most RGB color spaces allow RGB values in the range \\(\[0..1\]\\). There are however a few RGB color spaces that allow much larger ranges. For instance,[scRGB](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Named)is used to manipulate the range \\(\[-0.5..7.5\]\\) while[ACES](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Named)can be used throughout the range \\(\[-65504, 65504\]\\).

<br />

Extended sRGB and its large range

<br />

### Converting between RGB color spaces

Conversion between two color spaces is achieved by using an intermediate color space called the profile connection space (PCS). The PCS used by this implementation is CIE XYZ. The conversion operation is defined as such:
$$RGB_{out} = OETF(T_{dst}\^{-1} \\cdot T_{src} \\cdot EOTF(RGB_{in}))$$

Where \\(T_{src}\\) is the[RGB to XYZ transform](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#getTransform())of the source color space and \\(T_{dst}\^{-1}\\) the[XYZ to RGB transform](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#getInverseTransform())of the destination color space.

Many RGB color spaces commonly used with electronic devices use the standard illuminant[D65](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#ILLUMINANT_D65:kotlin.FloatArray). Care must be take however when converting between two RGB color spaces if their white points do not match. This can be achieved by either calling[adapt(android.graphics.ColorSpace,float[])](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#adapt(android.graphics.ColorSpace,%20kotlin.FloatArray))to adapt one or both color spaces to a single common white point. This can be achieved automatically by calling[ColorSpace.connect(ColorSpace, ColorSpace)](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#connect(android.graphics.ColorSpace,%20android.graphics.ColorSpace)), which also handles non-RGB color spaces.

To learn more about the white point adaptation process, refer to the documentation of[Adaptation](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Adaptation).

## Summary

|                                                                                                Nested classes                                                                                                ||
|------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| open | [TransferParameters](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb.TransferParameters) Defines the parameters for the ICC parametric curve type 4, as defined in ICC. |

| Inherited constants ||
|---|---|
| From class[ColorSpace](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace) |----------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [MAX_ID](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#MAX_ID:kotlin.Int) <br /> The maximum ID value a color space can have. <br /> | | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [MIN_ID](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#MIN_ID:kotlin.Int) <br /> The minimum ID value a color space can have. <br /> | ||

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           Public constructors                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [Rgb](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#Rgb(kotlin.String,%20kotlin.FloatArray,%20android.graphics.ColorSpace.Rgb.TransferParameters))`(`name:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `toXYZ:` `[FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html)`, `function:` `[ColorSpace.Rgb.TransferParameters](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb.TransferParameters)`)` Creates a new RGB color space using a 3x3 column-major transform matrix.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| [Rgb](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#Rgb(kotlin.String,%20kotlin.FloatArray,%20kotlin.Double))`(`name:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `toXYZ:` `[FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html)`, `gamma:` `[Double](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-double/index.html)`)` Creates a new RGB color space using a 3x3 column-major transform matrix.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| [Rgb](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#Rgb(kotlin.String,%20kotlin.FloatArray,%20kotlin.FloatArray,%20android.graphics.ColorSpace.Rgb.TransferParameters))`(`name:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `primaries:` `[FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html)`, `whitePoint:` `[FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html)`, `function:` `[ColorSpace.Rgb.TransferParameters](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb.TransferParameters)`)` Creates a new RGB color space using a specified set of primaries and a specified white point.                                                                                                                                                                                                                                                                                                                                                       |
| [Rgb](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#Rgb(kotlin.String,%20kotlin.FloatArray,%20kotlin.FloatArray,%20kotlin.Double))`(`name:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `primaries:` `[FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html)`, `whitePoint:` `[FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html)`, `gamma:` `[Double](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-double/index.html)`)` Creates a new RGB color space using a specified set of primaries and a specified white point.                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| [Rgb](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#Rgb(kotlin.String,%20kotlin.FloatArray,%20kotlin.FloatArray,%20java.util.function.DoubleUnaryOperator,%20java.util.function.DoubleUnaryOperator,%20kotlin.Float,%20kotlin.Float))`(`name:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `primaries:` `[FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html)`, `whitePoint:` `[FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html)`, `oetf:` `[DoubleUnaryOperator](https://developer.android.com/reference/kotlin/java/util/function/DoubleUnaryOperator.html#)`, `eotf:` `[DoubleUnaryOperator](https://developer.android.com/reference/kotlin/java/util/function/DoubleUnaryOperator.html#)`, `min:` `[Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html)`, `max:` `[Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html)`)` Creates a new RGB color space using a specified set of primaries and a specified white point. |
| [Rgb](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#Rgb(kotlin.String,%20kotlin.FloatArray,%20java.util.function.DoubleUnaryOperator,%20java.util.function.DoubleUnaryOperator))`(`name:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `toXYZ:` `[FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html)`, `oetf:` `[DoubleUnaryOperator](https://developer.android.com/reference/kotlin/java/util/function/DoubleUnaryOperator.html#)`, `eotf:` `[DoubleUnaryOperator](https://developer.android.com/reference/kotlin/java/util/function/DoubleUnaryOperator.html#)`)` Creates a new RGB color space using a 3x3 column-major transform matrix.                                                                                                                                                                                                                                                                                                                                                                            |

|                                                                                                                                                                                                                                                                                                                    Public methods                                                                                                                                                                                                                                                                                                                     ||
|---------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| open[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)                                                      | [equals](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#equals(kotlin.Any))`(`other:` `[Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)?`)` <br />                                                                                                                                                                                                                                                                                             |
| open[FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html)                                               | [fromLinear](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#fromLinear(kotlin.Float,%20kotlin.Float,%20kotlin.Float))`(`r:` `[Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html)`, `g:` `[Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html)`, `b:` `[Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html)`)` Encodes an RGB value from linear space to this color space's "gamma space". |
| open[FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html)                                               | [fromLinear](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#fromLinear(kotlin.FloatArray))`(`v:` `[FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html)`)` Encodes an RGB value from linear space to this color space's "gamma space".                                                                                                                                                                                               |
| open[FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html)                                               | [fromXyz](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#fromXyz(kotlin.FloatArray))`(`v:` `[FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html)`)` Converts tristimulus values from the CIE XYZ space to this color space's color model.                                                                                                                                                                                           |
| open[DoubleUnaryOperator](https://developer.android.com/reference/kotlin/java/util/function/DoubleUnaryOperator.html#)                      | [getEotf](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#getEotf())`()` Returns the electro-optical transfer function (EOTF) of this color space.                                                                                                                                                                                                                                                                                                                        |
| open[FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html)                                               | [getInverseTransform](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#getInverseTransform())`()` Returns the inverse transform of this color space as a new array.                                                                                                                                                                                                                                                                                                        |
| open[FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html)                                               | [getInverseTransform](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#getInverseTransform(kotlin.FloatArray))`(`inverseTransform:` `[FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html)`)` Copies the inverse transform of this color space in specified array.                                                                                                                                                                     |
| open[Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html)                                                          | [getMaxValue](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#getMaxValue(kotlin.Int))`(`component:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` <br />                                                                                                                                                                                                                                                                                |
| open[Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html)                                                          | [getMinValue](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#getMinValue(kotlin.Int))`(`component:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` <br />                                                                                                                                                                                                                                                                                |
| open[DoubleUnaryOperator](https://developer.android.com/reference/kotlin/java/util/function/DoubleUnaryOperator.html#)                      | [getOetf](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#getOetf())`()` Returns the opto-electronic transfer function (OETF) of this color space.                                                                                                                                                                                                                                                                                                                        |
| open[FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html)                                               | [getPrimaries](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#getPrimaries())`()` Returns the primaries of this color space as a new array of 6 floats.                                                                                                                                                                                                                                                                                                                  |
| open[FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html)                                               | [getPrimaries](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#getPrimaries(kotlin.FloatArray))`(`primaries:` `[FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html)`)` Copies the primaries of this color space in specified array.                                                                                                                                                                                                  |
| open[ColorSpace.Rgb.TransferParameters](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb.TransferParameters)? | [getTransferParameters](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#getTransferParameters())`()` Returns the parameters used by the[electro-optical](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#getEotf())and[opto-electronic](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#getOetf())transfer functions.                                                                                       |
| open[FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html)                                               | [getTransform](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#getTransform())`()` Returns the transform of this color space as a new array.                                                                                                                                                                                                                                                                                                                              |
| open[FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html)                                               | [getTransform](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#getTransform(kotlin.FloatArray))`(`transform:` `[FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html)`)` Copies the transform of this color space in specified array.                                                                                                                                                                                                  |
| open[FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html)                                               | [getWhitePoint](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#getWhitePoint())`()` Returns the non-adapted CIE xyY white point of this color space as a new array of 2 floats.                                                                                                                                                                                                                                                                                          |
| open[FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html)                                               | [getWhitePoint](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#getWhitePoint(kotlin.FloatArray))`(`whitePoint:` `[FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html)`)` Copies the non-adapted CIE xyY white point of this color space in specified array.                                                                                                                                                                         |
| open[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)                                                              | [hashCode](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#hashCode())`()` <br />                                                                                                                                                                                                                                                                                                                                                                                         |
| open[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)                                                      | [isSrgb](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#isSrgb())`()` <br />                                                                                                                                                                                                                                                                                                                                                                                             |
| open[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)                                                      | [isWideGamut](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#isWideGamut())`()` <br />                                                                                                                                                                                                                                                                                                                                                                                   |
| open[FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html)                                               | [toLinear](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#toLinear(kotlin.Float,%20kotlin.Float,%20kotlin.Float))`(`r:` `[Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html)`, `g:` `[Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html)`, `b:` `[Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html)`)` Decodes an RGB value to linear space.                                           |
| open[FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html)                                               | [toLinear](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#toLinear(kotlin.FloatArray))`(`v:` `[FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html)`)` Decodes an RGB value to linear space.                                                                                                                                                                                                                                         |
| open[FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html)                                               | [toXyz](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#toXyz(kotlin.FloatArray))`(`v:` `[FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html)`)` Converts a color value from this color space's model to tristimulus CIE XYZ values.                                                                                                                                                                                                 |

| Inherited functions ||
|---|---|
| From class[ColorSpace](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace) |--------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [ColorSpace](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace)                     | [adapt](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#adapt(android.graphics.ColorSpace,%20kotlin.FloatArray))`(`colorSpace:` `[ColorSpace](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace)`, `whitePoint:` `[FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html)`)` <br /> Performs the chromatic adaptation of a color space from its native white point to the specified white point. The chromatic adaptation is performed using the[Adaptation.BRADFORD](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Adaptation)matrix. The color space returned by this method always has an ID of[MIN_ID](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#MIN_ID:kotlin.Int). <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | | [ColorSpace](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace)                     | [adapt](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#adapt(android.graphics.ColorSpace,%20kotlin.FloatArray,%20android.graphics.ColorSpace.Adaptation))`(`colorSpace:` `[ColorSpace](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace)`, `whitePoint:` `[FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html)`, `adaptation:` `[ColorSpace.Adaptation](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Adaptation)`)` <br /> Performs the chromatic adaptation of a color space from its native white point to the specified white point. If the specified color space does not have an[RGB](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Model)color model, or if the color space already has the target white point, the color space is returned unmodified. The chromatic adaptation is performed using the von Kries method described in the documentation of[Adaptation](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Adaptation). The color space returned by this method always has an ID of[MIN_ID](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#MIN_ID:kotlin.Int). <br />                                                                                                                                                                                                                            | | [FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html)                    | [cctToXyz](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#cctToXyz(kotlin.Int))`(`cct:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` <br /> Computes the chromaticity coordinates of a specified correlated color temperature (CCT) on the Planckian locus. The specified CCT must be greater than 0. A meaningful CCT range is \[1667, 25000\]. The transform is computed using the methods in Kang et al.,*Design of Advanced Color - Temperature Control System for HDTV Applications*, Journal of Korean Physical Society 41, 865-871 (2002). <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | | [FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html)                    | [chromaticAdaptation](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#chromaticAdaptation(android.graphics.ColorSpace.Adaptation,%20kotlin.FloatArray,%20kotlin.FloatArray))`(`adaptation:` `[ColorSpace.Adaptation](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Adaptation)`, `srcWhitePoint:` `[FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html)`, `dstWhitePoint:` `[FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html)`)` <br /> Computes the chromatic adaptation transform from the specified source white point to the specified destination white point. The transform is computed using the von Kries method, described in more details in the documentation of[Adaptation](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Adaptation). The[Adaptation](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Adaptation)enum provides different matrices that can be used to perform the adaptation. <br />                                                                                                                                                                                                                                                                                                                                                                                                                  | | [ColorSpace.Connector](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Connector) | [connect](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#connect(android.graphics.ColorSpace))`(`source:` `[ColorSpace](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace)`)` <br /> Connects the specified color spaces to sRGB. If the source color space does not use CIE XYZ D65 as its profile connection space, the two spaces are chromatically adapted to use the CIE standard illuminant[D50](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#ILLUMINANT_D50:kotlin.FloatArray)as needed. If the source is the sRGB color space, an optimized connector is returned to avoid unnecessary computations and loss of precision. Colors are mapped from the source color space to the destination color space using the[perceptual](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.RenderIntent)render intent. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | | [ColorSpace.Connector](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Connector) | [connect](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#connect(android.graphics.ColorSpace,%20android.graphics.ColorSpace))`(`source:` `[ColorSpace](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace)`, `destination:` `[ColorSpace](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace)`)` <br /> Connects two color spaces to allow conversion from the source color space to the destination color space. If the source and destination color spaces do not have the same profile connection space (CIE XYZ with the same white point), they are chromatically adapted to use the CIE standard illuminant[D50](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#ILLUMINANT_D50:kotlin.FloatArray)as needed. If the source and destination are the same, an optimized connector is returned to avoid unnecessary computations and loss of precision. Colors are mapped from the source color space to the destination color space using the[perceptual](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.RenderIntent)render intent. <br />                                                                                                                                                                                                                                                                                                                                              | | [ColorSpace.Connector](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Connector) | [connect](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#connect(android.graphics.ColorSpace,%20android.graphics.ColorSpace,%20android.graphics.ColorSpace.RenderIntent))`(`source:` `[ColorSpace](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace)`, `destination:` `[ColorSpace](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace)`, `intent:` `[ColorSpace.RenderIntent](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.RenderIntent)`)` <br /> Connects two color spaces to allow conversion from the source color space to the destination color space. If the source and destination color spaces do not have the same profile connection space (CIE XYZ with the same white point), they are chromatically adapted to use the CIE standard illuminant[D50](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#ILLUMINANT_D50:kotlin.FloatArray)as needed. If the source and destination are the same, an optimized connector is returned to avoid unnecessary computations and loss of precision. <br />                                                                                                                                                                                                                                                                                                                                                                            | | [ColorSpace.Connector](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Connector) | [connect](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#connect(android.graphics.ColorSpace,%20android.graphics.ColorSpace.RenderIntent))`(`source:` `[ColorSpace](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace)`, `intent:` `[ColorSpace.RenderIntent](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.RenderIntent)`)` <br /> Connects the specified color spaces to sRGB. If the source color space does not use CIE XYZ D65 as its profile connection space, the two spaces are chromatically adapted to use the CIE standard illuminant[D50](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#ILLUMINANT_D50:kotlin.FloatArray)as needed. If the source is the sRGB color space, an optimized connector is returned to avoid unnecessary computations and loss of precision. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | | [FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html)                    | [fromXyz](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#fromXyz(kotlin.Float,%20kotlin.Float,%20kotlin.Float))`(`x:` `[Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html)`, `y:` `[Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html)`, `z:` `[Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html)`)` <br /> Converts tristimulus values from the CIE XYZ space to this color space's color model. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | | [ColorSpace](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace)                     | [get](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#get(android.graphics.ColorSpace.Named))`(`name:` `[ColorSpace.Named](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Named)`)` <br /> Returns an instance of[ColorSpace](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace)identified by the specified name. The list of names provided in the[Named](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Named)enum gives access to a variety of common RGB color spaces. This method always returns the same instance for a given name. This method is thread-safe. Note that in the Android W release and later, this can return the SRGB ColorSpace if the[ColorSpace.Named](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Named)parameter is not enabled in the corresponding release. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)                                   | [getComponentCount](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#getComponentCount())`()` <br /> Returns the number of components that form a color value according to this color space's color model. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)                                   | [getDataSpace](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#getDataSpace())`()` <br /> Retrieve the[DataSpace](https://developer.android.com/reference/kotlin/android/hardware/DataSpace.html#)value from a[ColorSpace](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace)object. If this[ColorSpace](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace)object has no matching`dataSpace`value,[DATASPACE_UNKNOWN](https://developer.android.com/reference/kotlin/android/hardware/DataSpace.html#DATASPACE_UNKNOWN:kotlin.Int)will return. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | | [ColorSpace](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace)?                    | [getFromDataSpace](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#getFromDataSpace(kotlin.Int))`(`dataSpace:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` <br /> Create a[ColorSpace](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace)object using a[DataSpace](https://developer.android.com/reference/kotlin/android/hardware/DataSpace.html#)value. This function maps from a dataspace to a[Named](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Named)ColorSpace. If no[Named](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Named)ColorSpace object matching the`dataSpace`value can be created,`null`will return. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)                                   | [getId](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#getId())`()` <br /> Returns the ID of this color space. Positive IDs match the color spaces enumerated in[Named](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Named). A negative ID indicates a color space created by calling one of the public constructors. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | | [ColorSpace.Model](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Model)         | [getModel](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#getModel())`()` <br /> Return the color model of this color space. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)                             | [getName](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#getName())`()` <br /> Returns the name of this color space. The name is never null and contains always at least 1 character. Color space names are recommended to be unique but are not guaranteed to be. There is no defined format but the name usually falls in one of the following categories: - Generic names used to identify color spaces in non-RGB color models. For instance:[Generic L*a*b*](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Named). - Names tied to a particular specification. For instance:[sRGB IEC61966-2.1](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Named)or[SMPTE ST 2065-1:2012 ACES](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Named). - Ad-hoc names, often generated procedurally or by the user during a calibration workflow. These names often contain the make and model of the display. Because the format of color space names is not defined, it is not recommended to programmatically identify a color space by its name alone. Names can be used as a first approximation. It is however perfectly acceptable to display color space names to users in a UI, or in debuggers and logs. When displaying a color space name to the user, it is recommended to add extra information to avoid ambiguities: color model, a representation of the color space's gamut, white point, etc. <br /> | | [ColorSpace](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace)?                    | [match](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#match(kotlin.FloatArray,%20android.graphics.ColorSpace.Rgb.TransferParameters))`(`toXYZD50:` `[FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html)`, `function:` `[ColorSpace.Rgb.TransferParameters](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb.TransferParameters)`)` <br /> Returns a[Named](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Named)instance of[ColorSpace](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace)that matches the specified RGB to CIE XYZ transform and transfer functions. If no instance can be found, this method returns null. The color transform matrix is assumed to target the CIE XYZ space a[D50](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#ILLUMINANT_D50:kotlin.FloatArray)standard illuminant. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)                             | [toString](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#toString())`()` <br /> Returns a string representation of the object. This method returns a string equal to the value of: ```kotlin getName() + "(id=" + getId() + ", model=" + getModel() + ")" ``` For instance, the string representation of the[sRGB](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Named)color space is equal to the following value: ```kotlin sRGB IEC61966-2.1 (id=0, model=RGB) ``` <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | | [FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html)                    | [toXyz](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#toXyz(kotlin.Float,%20kotlin.Float,%20kotlin.Float))`(`r:` `[Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html)`, `g:` `[Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html)`, `b:` `[Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html)`)` <br /> Converts a color value from this color space's model to tristimulus CIE XYZ values. If the color model of this color space is not[RGB](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Model), it is assumed that the target CIE XYZ space uses a[D50](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#ILLUMINANT_D50:kotlin.FloatArray)standard illuminant. This method is a convenience for color spaces with a model of 3 components ([RGB](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Model)or[Model.LAB](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Model)for instance). With color spaces using fewer or more components, use[toXyz(float[])](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#toXyz(kotlin.FloatArray))instead . <br />                                                                                                                                                                                                            | ||

| Inherited properties ||
|---|---|
| From class[ColorSpace](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace) |--------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html)! | [ILLUMINANT_A](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#ILLUMINANT_A:kotlin.FloatArray) <br /> Standard CIE 1931 2° illuminant A, encoded in xyY. This illuminant has a color temperature of 2856K. <br />                                                                                       | | [FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html)! | [ILLUMINANT_B](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#ILLUMINANT_B:kotlin.FloatArray) <br /> Standard CIE 1931 2° illuminant B, encoded in xyY. This illuminant has a color temperature of 4874K. <br />                                                                                       | | [FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html)! | [ILLUMINANT_C](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#ILLUMINANT_C:kotlin.FloatArray) <br /> Standard CIE 1931 2° illuminant C, encoded in xyY. This illuminant has a color temperature of 6774K. <br />                                                                                       | | [FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html)! | [ILLUMINANT_D50](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#ILLUMINANT_D50:kotlin.FloatArray) <br /> Standard CIE 1931 2° illuminant D50, encoded in xyY. This illuminant has a color temperature of 5003K. This illuminant is used by the profile connection space in ICC profiles. <br />        | | [FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html)! | [ILLUMINANT_D55](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#ILLUMINANT_D55:kotlin.FloatArray) <br /> Standard CIE 1931 2° illuminant D55, encoded in xyY. This illuminant has a color temperature of 5503K. <br />                                                                                 | | [FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html)! | [ILLUMINANT_D60](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#ILLUMINANT_D60:kotlin.FloatArray) <br /> Standard CIE 1931 2° illuminant D60, encoded in xyY. This illuminant has a color temperature of 6004K. <br />                                                                                 | | [FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html)! | [ILLUMINANT_D65](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#ILLUMINANT_D65:kotlin.FloatArray) <br /> Standard CIE 1931 2° illuminant D65, encoded in xyY. This illuminant has a color temperature of 6504K. This illuminant is commonly used in RGB color spaces such as sRGB, BT.709, etc. <br /> | | [FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html)! | [ILLUMINANT_D75](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#ILLUMINANT_D75:kotlin.FloatArray) <br /> Standard CIE 1931 2° illuminant D75, encoded in xyY. This illuminant has a color temperature of 7504K. <br />                                                                                 | | [FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html)! | [ILLUMINANT_E](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#ILLUMINANT_E:kotlin.FloatArray) <br /> Standard CIE 1931 2° illuminant E, encoded in xyY. This illuminant has a color temperature of 5454K. <br />                                                                                       | ||

## Public constructors

### Rgb

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
Rgb(
    name: String, 
    toXYZ: FloatArray, 
    function: ColorSpace.Rgb.TransferParameters)
```

Creates a new RGB color space using a 3x3 column-major transform matrix. The transform matrix must convert from the RGB space to the profile connection space CIE XYZ.

The range of the color space is imposed to be \\(\[0..1\]\\).

|                                                                                                            Parameters                                                                                                            ||
|------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `name`     | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):Name of the color space, cannot be null, its length must be \>= 1                                                                   |
| `toXYZ`    | [FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html):3x3 column-major transform matrix from RGB to the profile connection space CIE XYZ as an array of 9 floats, cannot be null |
| `function` | [ColorSpace.Rgb.TransferParameters](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb.TransferParameters):Parameters for the transfer functions This value cannot be`null`.             |

|                                                                   Exceptions                                                                   ||
|--------------------------------------|----------------------------------------------------------------------------------------------------------|
| `java.lang.IllegalArgumentException` | If any of the following conditions is met: - The name is null or has a length of 0. - Gamma is negative. |

**See Also**

- [#get(Named)](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#get(android.graphics.ColorSpace.Named))  

### Rgb

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
Rgb(
    name: String, 
    toXYZ: FloatArray, 
    gamma: Double)
```

Creates a new RGB color space using a 3x3 column-major transform matrix. The transform matrix must convert from the RGB space to the profile connection space CIE XYZ.

The range of the color space is imposed to be \\(\[0..1\]\\).

|                                                                                                          Parameters                                                                                                           ||
|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `name`  | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):Name of the color space, cannot be null, its length must be \>= 1                                                                   |
| `toXYZ` | [FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html):3x3 column-major transform matrix from RGB to the profile connection space CIE XYZ as an array of 9 floats, cannot be null |
| `gamma` | [Double](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-double/index.html):Gamma to use as the transfer function                                                                                               |

|                                                                   Exceptions                                                                   ||
|--------------------------------------|----------------------------------------------------------------------------------------------------------|
| `java.lang.IllegalArgumentException` | If any of the following conditions is met: - The name is null or has a length of 0. - Gamma is negative. |

**See Also**

- [#get(Named)](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#get(android.graphics.ColorSpace.Named))  

### Rgb

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
Rgb(
    name: String, 
    primaries: FloatArray, 
    whitePoint: FloatArray, 
    function: ColorSpace.Rgb.TransferParameters)
```

Creates a new RGB color space using a specified set of primaries and a specified white point.

The primaries and white point can be specified in the CIE xyY space or in CIE XYZ. The length of the arrays depends on the chosen space:

| Space | Primaries length | White point length |
|-------|------------------|--------------------|
| xyY   | 6                | 2                  |
| XYZ   | 9                | 3                  |

When the primaries and/or white point are specified in xyY, the Y component does not need to be specified and is assumed to be 1.0. Only the xy components are required.

|                                                                                                       Parameters                                                                                                       ||
|--------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `name`       | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):Name of the color space, cannot be null, its length must be \>= 1                                                       |
| `primaries`  | [FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html):RGB primaries as an array of 6 (xy) or 9 (XYZ) floats This value cannot be`null`.                              |
| `whitePoint` | [FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html):Reference white as an array of 2 (xy) or 3 (XYZ) floats This value cannot be`null`.                            |
| `function`   | [ColorSpace.Rgb.TransferParameters](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb.TransferParameters):Parameters for the transfer functions This value cannot be`null`. |

|                                                                                                                                                   Exceptions                                                                                                                                                   ||
|--------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `java.lang.IllegalArgumentException` | If any of the following conditions is met: - The name is null or has a length of 0. - The primaries array is null or has a length that is neither 6 or 9. - The white point array is null or has a length that is neither 2 or 3. - The transfer parameters are invalid. |

**See Also**

- [#get(Named)](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#get(android.graphics.ColorSpace.Named))  

### Rgb

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
Rgb(
    name: String, 
    primaries: FloatArray, 
    whitePoint: FloatArray, 
    gamma: Double)
```

Creates a new RGB color space using a specified set of primaries and a specified white point.

The primaries and white point can be specified in the CIE xyY space or in CIE XYZ. The length of the arrays depends on the chosen space:

| Space | Primaries length | White point length |
|-------|------------------|--------------------|
| xyY   | 6                | 2                  |
| XYZ   | 9                | 3                  |

When the primaries and/or white point are specified in xyY, the Y component does not need to be specified and is assumed to be 1.0. Only the xy components are required.

|                                                                                         Parameters                                                                                          ||
|--------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `name`       | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):Name of the color space, cannot be null, its length must be \>= 1                            |
| `primaries`  | [FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html):RGB primaries as an array of 6 (xy) or 9 (XYZ) floats This value cannot be`null`.   |
| `whitePoint` | [FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html):Reference white as an array of 2 (xy) or 3 (XYZ) floats This value cannot be`null`. |
| `gamma`      | [Double](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-double/index.html):Gamma to use as the transfer function                                                        |

|                                                                                                                                          Exceptions                                                                                                                                          ||
|--------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `java.lang.IllegalArgumentException` | If any of the following conditions is met: - The name is null or has a length of 0. - The primaries array is null or has a length that is neither 6 or 9. - The white point array is null or has a length that is neither 2 or 3. - Gamma is negative. |

**See Also**

- [#get(Named)](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#get(android.graphics.ColorSpace.Named))  

### Rgb

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
Rgb(
    name: String, 
    primaries: FloatArray, 
    whitePoint: FloatArray, 
    oetf: DoubleUnaryOperator, 
    eotf: DoubleUnaryOperator, 
    min: Float, 
    max: Float)
```

Creates a new RGB color space using a specified set of primaries and a specified white point.

The primaries and white point can be specified in the CIE xyY space or in CIE XYZ. The length of the arrays depends on the chosen space:

| Space | Primaries length | White point length |
|-------|------------------|--------------------|
| xyY   | 6                | 2                  |
| XYZ   | 9                | 3                  |

When the primaries and/or white point are specified in xyY, the Y component does not need to be specified and is assumed to be 1.0. Only the xy components are required.

The ID, as returned by[getId()](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#getId()), of an object created by this constructor is always[MIN_ID](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#MIN_ID:kotlin.Int).

|                                                                                         Parameters                                                                                          ||
|--------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `name`       | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):Name of the color space, cannot be null, its length must be \>= 1                            |
| `primaries`  | [FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html):RGB primaries as an array of 6 (xy) or 9 (XYZ) floats This value cannot be`null`.   |
| `whitePoint` | [FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html):Reference white as an array of 2 (xy) or 3 (XYZ) floats This value cannot be`null`. |
| `oetf`       | [DoubleUnaryOperator](https://developer.android.com/reference/kotlin/java/util/function/DoubleUnaryOperator.html#):Opto-electronic transfer function, cannot be null          |
| `eotf`       | [DoubleUnaryOperator](https://developer.android.com/reference/kotlin/java/util/function/DoubleUnaryOperator.html#):Electro-optical transfer function, cannot be null          |
| `min`        | [Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html):The minimum valid value in this color space's RGB range                                        |
| `max`        | [Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html):The maximum valid value in this color space's RGB range                                        |

|                                                                                                                                                                                Exceptions                                                                                                                                                                                 ||
|--------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `java.lang.IllegalArgumentException` | If any of the following conditions is met: - The name is null or has a length of 0. - The primaries array is null or has a length that is neither 6 or 9. - The white point array is null or has a length that is neither 2 or 3. - The OETF is null or the EOTF is null. - The minimum valid value is \>= the maximum valid value. |

**See Also**

- [#get(Named)](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#get(android.graphics.ColorSpace.Named))  

### Rgb

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
Rgb(
    name: String, 
    toXYZ: FloatArray, 
    oetf: DoubleUnaryOperator, 
    eotf: DoubleUnaryOperator)
```

Creates a new RGB color space using a 3x3 column-major transform matrix. The transform matrix must convert from the RGB space to the profile connection space CIE XYZ.

The range of the color space is imposed to be \\(\[0..1\]\\).

|                                                                                                          Parameters                                                                                                           ||
|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `name`  | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):Name of the color space, cannot be null, its length must be \>= 1                                                                   |
| `toXYZ` | [FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html):3x3 column-major transform matrix from RGB to the profile connection space CIE XYZ as an array of 9 floats, cannot be null |
| `oetf`  | [DoubleUnaryOperator](https://developer.android.com/reference/kotlin/java/util/function/DoubleUnaryOperator.html#):Opto-electronic transfer function, cannot be null                                                 |
| `eotf`  | [DoubleUnaryOperator](https://developer.android.com/reference/kotlin/java/util/function/DoubleUnaryOperator.html#):Electro-optical transfer function, cannot be null                                                 |

|                                                                                                         Exceptions                                                                                                          ||
|--------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `java.lang.IllegalArgumentException` | If any of the following conditions is met: - The name is null or has a length of 0. - The OETF is null or the EOTF is null. - The minimum valid value is \>= the maximum valid value. |

**See Also**

- [#get(Named)](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#get(android.graphics.ColorSpace.Named))

## Public methods

### equals

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun equals(other: Any?): Boolean
```

|                     Parameters                     ||
|-------|---------------------------------------------|
| `obj` | the reference object with which to compare. |

|                                                                           Return                                                                           ||
|------------------------------------------------------------------------------------|------------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `true`if this object is the same as the obj argument;`false`otherwise. |

### fromLinear

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun fromLinear(
    r: Float, 
    g: Float, 
    b: Float
): FloatArray
```

Encodes an RGB value from linear space to this color space's "gamma space". This is achieved by applying this color space's opto-electronic transfer function to the supplied values.

Refer to the documentation of[ColorSpace.Rgb](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#)for more information about transfer functions and their use for encoding and decoding RGB values.

|                                                             Parameters                                                              ||
|-----|--------------------------------------------------------------------------------------------------------------------------------|
| `r` | [Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html):The red component to encode from linear space   |
| `g` | [Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html):The green component to encode from linear space |
| `b` | [Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html):The blue component to encode from linear space  |

|                                                                                     Return                                                                                      ||
|-------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------|
| [FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html) | A new array of 3 floats containing non-linear RGB values This value cannot be`null`. |

**See Also**

- [#fromLinear(float[])](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#fromLinear(kotlin.FloatArray))
- [#toLinear(float, float, float)](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#toLinear(kotlin.Float,%20kotlin.Float,%20kotlin.Float))  

### fromLinear

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun fromLinear(v: FloatArray): FloatArray
```

Encodes an RGB value from linear space to this color space's "gamma space". This is achieved by applying this color space's opto-electronic transfer function to the first 3 values of the supplied array. The result is stored back in the input array.

Refer to the documentation of[ColorSpace.Rgb](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#)for more information about transfer functions and their use for encoding and decoding RGB values.

|                                                                             Parameters                                                                              ||
|-----|----------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `v` | [FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html):A non-null array of linear RGB values, its length must be at least 3 |

|                                                                                     Return                                                                                      ||
|-------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------|
| [FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html) | A new array of 3 floats containing non-linear RGB values This value cannot be`null`. |

**See Also**

- [#fromLinear(float[])](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#fromLinear(kotlin.FloatArray))
- [#toLinear(float, float, float)](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#toLinear(kotlin.Float,%20kotlin.Float,%20kotlin.Float))  

### fromXyz

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun fromXyz(v: FloatArray): FloatArray
```

Converts tristimulus values from the CIE XYZ space to this color space's color model. The resulting value is passed back in the specified array.

The specified array's length must be at least equal to to the number of color components as returned by[Model.getComponentCount()](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Model#getComponentCount()), and its first 3 values must be the XYZ components to convert from.

|                                                         Parameters                                                         ||
|-----|-----------------------------------------------------------------------------------------------------------------------|
| `v` | [FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html):This value cannot be`null`. |

|                                                         Return                                                         ||
|-------------------------------------------------------------------------------------------|-----------------------------|
| [FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html) | This value cannot be`null`. |

### getEotf

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun getEotf(): DoubleUnaryOperator
```

Returns the electro-optical transfer function (EOTF) of this color space. The inverse function is the opto-electronic transfer function (OETF) returned by[getOetf()](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#getOetf()). These functions are defined to satisfy the following equality for \\(x \\in \[0..1\]\\):
$$OETF(EOTF(x)) = EOTF(OETF(x)) = x$$

For RGB colors, this function can be used to convert from "gamma space" (gamma encoded) to linear space. The terms gamma space and gamma encoded are frequently used because many EOTFs can be closely approximated using a simple power function of the form \\(x\^\\gamma\\) (the approximation of the[sRGB](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Named)EOTF uses \\(\\gamma=2.2\\) for instance).

|                                                                                                        Return                                                                                                        ||
|--------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------|
| [DoubleUnaryOperator](https://developer.android.com/reference/kotlin/java/util/function/DoubleUnaryOperator.html#) | A transfer function that converts from "gamma space" to linear space This value cannot be`null`. |

**See Also**

- <https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#getOetf()>
- <https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#getTransferParameters()>  

### getInverseTransform

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun getInverseTransform(): FloatArray
```

Returns the inverse transform of this color space as a new array. The inverse transform is used to convert from XYZ to RGB (with the same white point as this color space). To connect color spaces, you must first[adapt](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#adapt(android.graphics.ColorSpace,%20kotlin.FloatArray))them to the same white point.

It is recommended to use[ColorSpace.connect(ColorSpace, ColorSpace)](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#connect(android.graphics.ColorSpace,%20android.graphics.ColorSpace))to convert between color spaces.

|                                                                     Return                                                                     ||
|-------------------------------------------------------------------------------------------|-----------------------------------------------------|
| [FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html) | A new array of 9 floats This value cannot be`null`. |

**See Also**

- [#getInverseTransform(float[])](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#getInverseTransform(kotlin.FloatArray))  

### getInverseTransform

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun getInverseTransform(inverseTransform: FloatArray): FloatArray
```

Copies the inverse transform of this color space in specified array. The inverse transform is used to convert from XYZ to RGB (with the same white point as this color space). To connect color spaces, you must first[adapt](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#adapt(android.graphics.ColorSpace,%20kotlin.FloatArray))them to the same white point.

It is recommended to use[ColorSpace.connect(ColorSpace, ColorSpace)](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#connect(android.graphics.ColorSpace,%20android.graphics.ColorSpace))to convert between color spaces.

|                                                                                  Parameters                                                                                   ||
|--------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------|
| `inverseTransform` | [FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html):The destination array, cannot be null, its length must be \>= 9 |

|                                                                               Return                                                                               ||
|-------------------------------------------------------------------------------------------|-------------------------------------------------------------------------|
| [FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html) | The destination array passed as a parameter This value cannot be`null`. |

**See Also**

- <https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#getInverseTransform()>  

### getMaxValue

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun getMaxValue(component: Int): Float
```

|                                                                      Parameters                                                                       ||
|-------------|------------------------------------------------------------------------------------------------------------------------------------------|
| `component` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):The index of the component Value is between 0 and 3 inclusive |

|                                                                                                                  Return                                                                                                                   ||
|--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html) | A floating point value greater than[getMinValue(int)](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#getMinValue(kotlin.Int)) |

### getMinValue

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun getMinValue(component: Int): Float
```

|                                                                      Parameters                                                                       ||
|-------------|------------------------------------------------------------------------------------------------------------------------------------------|
| `component` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):The index of the component Value is between 0 and 3 inclusive |

|                                                                                                                 Return                                                                                                                 ||
|--------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html) | A floating point value less than[getMaxValue(int)](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#getMaxValue(kotlin.Int)) |

### getOetf

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun getOetf(): DoubleUnaryOperator
```

Returns the opto-electronic transfer function (OETF) of this color space. The inverse function is the electro-optical transfer function (EOTF) returned by[getEotf()](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#getEotf()). These functions are defined to satisfy the following equality for \\(x \\in \[0..1\]\\):
$$OETF(EOTF(x)) = EOTF(OETF(x)) = x$$

For RGB colors, this function can be used to convert from linear space to "gamma space" (gamma encoded). The terms gamma space and gamma encoded are frequently used because many OETFs can be closely approximated using a simple power function of the form \\(x\^{\\frac{1}{\\gamma}}\\) (the approximation of the[sRGB](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Named)OETF uses \\(\\gamma=2.2\\) for instance).

|                                                                                                        Return                                                                                                        ||
|--------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------|
| [DoubleUnaryOperator](https://developer.android.com/reference/kotlin/java/util/function/DoubleUnaryOperator.html#) | A transfer function that converts from linear space to "gamma space" This value cannot be`null`. |

**See Also**

- <https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#getEotf()>
- <https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#getTransferParameters()>  

### getPrimaries

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun getPrimaries(): FloatArray
```

Returns the primaries of this color space as a new array of 6 floats. The Y component is assumed to be 1 and is therefore not copied into the destination. The x and y components of the first primary are written in the array at positions 0 and 1 respectively.

Note: Some ColorSpaces represent gray profiles. The concept of primaries for such a ColorSpace does not make sense, so we use a special set of primaries that are all 1s.

|                                                           Return                                                            ||
|-------------------------------------------------------------------------------------------|----------------------------------|
| [FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html) | A new non-null array of 6 floats |

**See Also**

- [#getPrimaries(float[])](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#getPrimaries(kotlin.FloatArray))  

### getPrimaries

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun getPrimaries(primaries: FloatArray): FloatArray
```

Copies the primaries of this color space in specified array. The Y component is assumed to be 1 and is therefore not copied into the destination. The x and y components of the first primary are written in the array at positions 0 and 1 respectively.

Note: Some ColorSpaces represent gray profiles. The concept of primaries for such a ColorSpace does not make sense, so we use a special set of primaries that are all 1s.

|                                                                               Parameters                                                                               ||
|-------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------|
| `primaries` | [FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html):The destination array, cannot be null, its length must be \>= 6 |

|                                                                               Return                                                                               ||
|-------------------------------------------------------------------------------------------|-------------------------------------------------------------------------|
| [FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html) | The destination array passed as a parameter This value cannot be`null`. |

**See Also**

- <https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#getPrimaries()>  

### getTransferParameters

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun getTransferParameters(): ColorSpace.Rgb.TransferParameters?
```

Returns the parameters used by the[electro-optical](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#getEotf())and[opto-electronic](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#getOetf())transfer functions. If the transfer functions do not match the ICC parametric curves defined in ICC.1:2004-10 (section 10.15), this method returns null.

See[TransferParameters](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb.TransferParameters)for a full description of the transfer functions.

|                                                                                                                                                                                                                                           Return                                                                                                                                                                                                                                           ||
|-----------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [ColorSpace.Rgb.TransferParameters](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb.TransferParameters)? | An instance of[TransferParameters](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb.TransferParameters)or null if this color space's transfer functions do not match the equation defined in[TransferParameters](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb.TransferParameters) |

### getTransform

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun getTransform(): FloatArray
```

Returns the transform of this color space as a new array. The transform is used to convert from RGB to XYZ (with the same white point as this color space). To connect color spaces, you must first[adapt](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#adapt(android.graphics.ColorSpace,%20kotlin.FloatArray))them to the same white point.

It is recommended to use[ColorSpace.connect(ColorSpace, ColorSpace)](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#connect(android.graphics.ColorSpace,%20android.graphics.ColorSpace))to convert between color spaces.

|                                                                     Return                                                                     ||
|-------------------------------------------------------------------------------------------|-----------------------------------------------------|
| [FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html) | A new array of 9 floats This value cannot be`null`. |

**See Also**

- [#getTransform(float[])](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#getTransform(kotlin.FloatArray))  

### getTransform

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun getTransform(transform: FloatArray): FloatArray
```

Copies the transform of this color space in specified array. The transform is used to convert from RGB to XYZ (with the same white point as this color space). To connect color spaces, you must first[adapt](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#adapt(android.graphics.ColorSpace,%20kotlin.FloatArray))them to the same white point.

It is recommended to use[ColorSpace.connect(ColorSpace, ColorSpace)](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#connect(android.graphics.ColorSpace,%20android.graphics.ColorSpace))to convert between color spaces.

|                                                                               Parameters                                                                               ||
|-------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------|
| `transform` | [FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html):The destination array, cannot be null, its length must be \>= 9 |

|                                                                               Return                                                                               ||
|-------------------------------------------------------------------------------------------|-------------------------------------------------------------------------|
| [FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html) | The destination array passed as a parameter This value cannot be`null`. |

**See Also**

- <https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#getTransform()>  

### getWhitePoint

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun getWhitePoint(): FloatArray
```

Returns the non-adapted CIE xyY white point of this color space as a new array of 2 floats. The Y component is assumed to be 1 and is therefore not copied into the destination. The x and y components are written in the array at positions 0 and 1 respectively.

|                                                           Return                                                            ||
|-------------------------------------------------------------------------------------------|----------------------------------|
| [FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html) | A new non-null array of 2 floats |

**See Also**

- [#getWhitePoint(float[])](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#getWhitePoint(kotlin.FloatArray))  

### getWhitePoint

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun getWhitePoint(whitePoint: FloatArray): FloatArray
```

Copies the non-adapted CIE xyY white point of this color space in specified array. The Y component is assumed to be 1 and is therefore not copied into the destination. The x and y components are written in the array at positions 0 and 1 respectively.

|                                                                               Parameters                                                                                ||
|--------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------|
| `whitePoint` | [FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html):The destination array, cannot be null, its length must be \>= 2 |

|                                                                               Return                                                                               ||
|-------------------------------------------------------------------------------------------|-------------------------------------------------------------------------|
| [FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html) | The destination array passed as a parameter This value cannot be`null`. |

**See Also**

- <https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#getWhitePoint()>  

### hashCode

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun hashCode(): Int
```

|                                                     Return                                                     ||
|----------------------------------------------------------------------------|------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | a hash code value for this object. |

### isSrgb

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun isSrgb(): Boolean
```

|                                                                                      Return                                                                                      ||
|------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | True if this color space is the sRGB color space (or a close approximation), false otherwise |

### isWideGamut

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun isWideGamut(): Boolean
```

|                                                                          Return                                                                           ||
|------------------------------------------------------------------------------------|-----------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | True if this color space is a wide-gamut color space, false otherwise |

### toLinear

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun toLinear(
    r: Float, 
    g: Float, 
    b: Float
): FloatArray
```

Decodes an RGB value to linear space. This is achieved by applying this color space's electro-optical transfer function to the supplied values.

Refer to the documentation of[ColorSpace.Rgb](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#)for more information about transfer functions and their use for encoding and decoding RGB values.

|                                                            Parameters                                                             ||
|-----|------------------------------------------------------------------------------------------------------------------------------|
| `r` | [Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html):The red component to decode to linear space   |
| `g` | [Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html):The green component to decode to linear space |
| `b` | [Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html):The blue component to decode to linear space  |

|                                                                                   Return                                                                                    ||
|-------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------|
| [FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html) | A new array of 3 floats containing linear RGB values This value cannot be`null`. |

**See Also**

- [#toLinear(float[])](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#toLinear(kotlin.FloatArray))
- [#fromLinear(float, float, float)](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#fromLinear(kotlin.Float,%20kotlin.Float,%20kotlin.Float))  

### toLinear

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun toLinear(v: FloatArray): FloatArray
```

Decodes an RGB value to linear space. This is achieved by applying this color space's electro-optical transfer function to the first 3 values of the supplied array. The result is stored back in the input array.

Refer to the documentation of[ColorSpace.Rgb](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#)for more information about transfer functions and their use for encoding and decoding RGB values.

|                                                                               Parameters                                                                                ||
|-----|--------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `v` | [FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html):A non-null array of non-linear RGB values, its length must be at least 3 |

|                                                                   Return                                                                   ||
|-------------------------------------------------------------------------------------------|-------------------------------------------------|
| [FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html) | The specified array This value cannot be`null`. |

**See Also**

- [#toLinear(float, float, float)](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#toLinear(kotlin.Float,%20kotlin.Float,%20kotlin.Float))
- [#fromLinear(float[])](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Rgb#fromLinear(kotlin.FloatArray))  

### toXyz

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun toXyz(v: FloatArray): FloatArray
```

Converts a color value from this color space's model to tristimulus CIE XYZ values. If the color model of this color space is not[RGB](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Model), it is assumed that the target CIE XYZ space uses a[D50](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#ILLUMINANT_D50:kotlin.FloatArray)standard illuminant.

The specified array's length must be at least equal to to the number of color components as returned by[Model.getComponentCount()](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Model#getComponentCount()).

|                                                         Parameters                                                         ||
|-----|-----------------------------------------------------------------------------------------------------------------------|
| `v` | [FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html):This value cannot be`null`. |

|                                                         Return                                                         ||
|-------------------------------------------------------------------------------------------|-----------------------------|
| [FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html) | This value cannot be`null`. |