# Rgb

Artifact: [androidx.compose.ui:ui-graphics](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/graphics/colorspace/Rgb.kt+class:androidx.compose.ui.graphics.colorspace.Rgb) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0) Common/All
- Cmn

  ```
  class Rgb : ColorSpace
  ```

|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html) |||
| ↳ | [androidx.compose.ui.graphics.colorspace.ColorSpace](https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/ColorSpace) ||
|   | ↳ | [androidx.compose.ui.graphics.colorspace.Rgb](https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb) |

*** ** * ** ***

An RGB color space is an additive color space using the `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/ColorModel#Rgb()` 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 `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/ColorSpaces#Srgb()`.

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

[sRGB primaries and white point](https://developer.android.com/reference/android/images/graphics/colorspace_srgb.png)

### 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 `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/ColorSpaces#Srgb()` 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:

[See RGB equation](https://developer.android.com/reference/android/graphics/ColorSpace.Rgb)

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 from `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#transferParameters()`. This can be useful to match color spaces for instance.

Some RGB color spaces, such as `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/ColorSpaces#Aces()` and `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/ColorSpaces#LinearExtendedSrgb()`, 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, `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/ColorSpaces#ExtendedSrgb()` is used to manipulate the range `[-0.5..7.5]` while `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/ColorSpaces#Aces()` can be used throughout the range `[-65504, 65504]`.

[Extended sRGB and its large range](https://developer.android.com/reference/android/images/graphics/colorspace_scrgb.png)

### 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:

[See RGB equation](https://developer.android.com/reference/android/graphics/ColorSpace.Rgb)

Where `Tsrc` is the `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#getTransform()` of the source color space and `Tdst^-1` the `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#getInverseTransform()` of the destination color space.

Many RGB color spaces commonly used with electronic devices use the standard illuminant `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Illuminant#D65()`. 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 `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/package-summary#(androidx.compose.ui.graphics.colorspace.ColorSpace).adapt(androidx.compose.ui.graphics.colorspace.WhitePoint,androidx.compose.ui.graphics.colorspace.Adaptation)` to adapt one or both color spaces to a single common white point. This can be achieved automatically by calling `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/package-summary#(androidx.compose.ui.graphics.colorspace.ColorSpace).connect(androidx.compose.ui.graphics.colorspace.ColorSpace,androidx.compose.ui.graphics.colorspace.RenderIntent)`, which also handles non-RGB color spaces.

To learn more about the white point adaptation process, refer to the documentation of `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Adaptation`.

## Summary

| ### Public constructors |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#Rgb(kotlin.String,kotlin.FloatArray,androidx.compose.ui.graphics.colorspace.TransferParameters)( name: @https://developer.android.com/reference/kotlin/androidx/annotation/Size(min = 1) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, toXYZ: @https://developer.android.com/reference/kotlin/androidx/annotation/Size(value = 9) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html, function: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/TransferParameters )` Creates a new RGB color space using a 3x3 column-major transform matrix. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#Rgb(kotlin.String,kotlin.FloatArray,kotlin.Double)(name: @https://developer.android.com/reference/kotlin/androidx/annotation/Size(min = 1) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, toXYZ: @https://developer.android.com/reference/kotlin/androidx/annotation/Size(value = 9) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html, gamma: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html)` Creates a new RGB color space using a 3x3 column-major transform matrix. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#Rgb(kotlin.String,kotlin.FloatArray,androidx.compose.ui.graphics.colorspace.WhitePoint,androidx.compose.ui.graphics.colorspace.TransferParameters)( name: @https://developer.android.com/reference/kotlin/androidx/annotation/Size(min = 1) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, primaries: @https://developer.android.com/reference/kotlin/androidx/annotation/Size(min = 6, max = 9) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html, whitePoint: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/WhitePoint, function: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/TransferParameters )` Creates a new RGB color space using a specified set of primaries and a specified white point. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#Rgb(kotlin.String,kotlin.FloatArray,androidx.compose.ui.graphics.colorspace.WhitePoint,kotlin.Double)( name: @https://developer.android.com/reference/kotlin/androidx/annotation/Size(min = 1) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, primaries: @https://developer.android.com/reference/kotlin/androidx/annotation/Size(min = 6, max = 9) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html, whitePoint: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/WhitePoint, gamma: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html )` Creates a new RGB color space using a specified set of primaries and a specified white point. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#Rgb(kotlin.String,kotlin.FloatArray,kotlin.Function1,kotlin.Function1)( name: @https://developer.android.com/reference/kotlin/androidx/annotation/Size(min = 1) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, toXYZ: @https://developer.android.com/reference/kotlin/androidx/annotation/Size(value = 9) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html, oetf: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html, eotf: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html )` Creates a new RGB color space using a 3x3 column-major transform matrix. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#Rgb(kotlin.String,kotlin.FloatArray,androidx.compose.ui.graphics.colorspace.WhitePoint,kotlin.Function1,kotlin.Function1,kotlin.Float,kotlin.Float)( name: @https://developer.android.com/reference/kotlin/androidx/annotation/Size(min = 1) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, primaries: @https://developer.android.com/reference/kotlin/androidx/annotation/Size(min = 6, max = 9) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html, whitePoint: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/WhitePoint, oetf: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html, eotf: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html, min: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, max: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html )` Creates a new RGB color space using a specified set of primaries and a specified white point. | Cmn |

| ### Public functions |
|---|---|---|
| `open operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#equals(kotlin.Any)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` | Cmn |
| `@https://developer.android.com/reference/kotlin/androidx/annotation/Size(min = 3) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#fromLinear(kotlin.FloatArray)(v: @https://developer.android.com/reference/kotlin/androidx/annotation/Size(min = 3) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html)` Encodes an RGB value from linear space to this color space's "gamma space". | Cmn |
| `@https://developer.android.com/reference/kotlin/androidx/annotation/Size(value = 3) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#fromLinear(kotlin.Float,kotlin.Float,kotlin.Float)(r: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, g: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, b: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Encodes an RGB value from linear space to this color space's "gamma space". | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#fromXyz(kotlin.FloatArray)(v: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html)` Converts tristimulus values from the CIE XYZ space to this color space's color model. | Cmn |
| `@https://developer.android.com/reference/kotlin/androidx/annotation/Size(value = 9) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#getInverseTransform()()` Returns the inverse transform of this color space as a new array. | Cmn |
| `@https://developer.android.com/reference/kotlin/androidx/annotation/Size(min = 9) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#getInverseTransform(kotlin.FloatArray)(inverseTransform: @https://developer.android.com/reference/kotlin/androidx/annotation/Size(min = 9) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html)` Copies the inverse transform of this color space in specified array. | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#getMaxValue(kotlin.Int)(component: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Returns the maximum valid value for the specified component of this color space's color model. | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#getMinValue(kotlin.Int)(component: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Returns the minimum valid value for the specified component of this color space's color model. | Cmn |
| `@https://developer.android.com/reference/kotlin/androidx/annotation/Size(value = 6) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#getPrimaries()()` Returns the primaries of this color space as a new array of 6 floats. | Cmn |
| `@https://developer.android.com/reference/kotlin/androidx/annotation/Size(min = 6) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#getPrimaries(kotlin.FloatArray)(primaries: @https://developer.android.com/reference/kotlin/androidx/annotation/Size(min = 6) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html)` Copies the primaries of this color space in specified array. | Cmn |
| `@https://developer.android.com/reference/kotlin/androidx/annotation/Size(value = 9) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#getTransform()()` Returns the transform of this color space as a new array. | Cmn |
| `@https://developer.android.com/reference/kotlin/androidx/annotation/Size(min = 9) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#getTransform(kotlin.FloatArray)(transform: @https://developer.android.com/reference/kotlin/androidx/annotation/Size(min = 9) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html)` Copies the transform of this color space in specified array. | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#hashCode()()` | Cmn |
| `@https://developer.android.com/reference/kotlin/androidx/annotation/Size(min = 3) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#toLinear(kotlin.FloatArray)(v: @https://developer.android.com/reference/kotlin/androidx/annotation/Size(min = 3) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html)` Decodes an RGB value to linear space. | Cmn |
| `@https://developer.android.com/reference/kotlin/androidx/annotation/Size(value = 3) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#toLinear(kotlin.Float,kotlin.Float,kotlin.Float)(r: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, g: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, b: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Decodes an RGB value to linear space. | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#toXyz(kotlin.FloatArray)(v: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html)` Converts a color value from this color space's model to tristimulus CIE XYZ values. | Cmn |

| ### Public properties |
|---|---|---|
| `(https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#eotf()` Returns the electro-optical transfer function (EOTF) of this color space. | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#isSrgb()` Indicates whether this color space is the sRGB color space or equivalent to the sRGB color space. | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#isWideGamut()` Returns whether this color space is a wide-gamut color space. | Cmn |
| `(https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#oetf()` Returns the opto-electronic transfer function (OETF) of this color space. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/TransferParameters?` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#transferParameters()` Returns the parameters used by the `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#(kotlin.String,kotlin.FloatArray,androidx.compose.ui.graphics.colorspace.WhitePoint,kotlin.FloatArray,androidx.compose.ui.graphics.colorspace.DoubleFunction,androidx.compose.ui.graphics.colorspace.DoubleFunction,kotlin.Float,kotlin.Float,androidx.compose.ui.graphics.colorspace.TransferParameters,kotlin.Int)` and `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#(kotlin.String,kotlin.FloatArray,androidx.compose.ui.graphics.colorspace.WhitePoint,kotlin.FloatArray,androidx.compose.ui.graphics.colorspace.DoubleFunction,androidx.compose.ui.graphics.colorspace.DoubleFunction,kotlin.Float,kotlin.Float,androidx.compose.ui.graphics.colorspace.TransferParameters,kotlin.Int)` transfer functions. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/WhitePoint` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#whitePoint()` | Cmn |

### Inherited functions

From [androidx.compose.ui.graphics.colorspace.ColorSpace](https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/ColorSpace) `@https://developer.android.com/reference/kotlin/androidx/annotation/Size(min = 3) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html` `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/ColorSpace#fromXyz(kotlin.Float,kotlin.Float,kotlin.Float)(x: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, y: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, z: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`

Converts tristimulus values from the CIE XYZ space to this color space's color model.
Cmn `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/ColorSpace#toString()()`

Returns a string representation of the object.
Cmn `@https://developer.android.com/reference/kotlin/androidx/annotation/Size(value = 3) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html` `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/ColorSpace#toXyz(kotlin.Float,kotlin.Float,kotlin.Float)(r: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, g: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, b: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`

Converts a color value from this color space's model to tristimulus CIE XYZ values.
Cmn

### Inherited properties

From [androidx.compose.ui.graphics.colorspace.ColorSpace](https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/ColorSpace) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/ColorSpace#componentCount()`

Returns the number of components that form a color value according to this color space's color model.
Cmn `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/ColorModel` `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/ColorSpace#model()`

The color model of this color space.
Cmn `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/ColorSpace#name()`

Returns the name of this color space.
Cmn

## Public constructors

### Rgb

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
Rgb(
    name: @Size(min = 1) String,
    toXYZ: @Size(value = 9) FloatArray,
    function: 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: @https://developer.android.com/reference/kotlin/androidx/annotation/Size(min = 1) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | Name of the color space, cannot be null, its length must be \>= 1 |
| `toXYZ: @https://developer.android.com/reference/kotlin/androidx/annotation/Size(value = 9) https://kotlinlang.org/api/core/kotlin-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: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/TransferParameters` | Parameters for the transfer functions |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | If any of the following conditions is met: \* The name is null or has a length of 0. \* Gamma is negative. |

### Rgb

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
Rgb(name: @Size(min = 1) String, toXYZ: @Size(value = 9) 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: @https://developer.android.com/reference/kotlin/androidx/annotation/Size(min = 1) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | Name of the color space, cannot be null, its length must be \>= 1 |
| `toXYZ: @https://developer.android.com/reference/kotlin/androidx/annotation/Size(value = 9) https://kotlinlang.org/api/core/kotlin-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: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html` | Gamma to use as the transfer function |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | If any of the following conditions is met: \* The name is null or has a length of 0. \* Gamma is negative. |

| See also |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/index.html` |   |

### Rgb

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
Rgb(
    name: @Size(min = 1) String,
    primaries: @Size(min = 6, max = 9) FloatArray,
    whitePoint: WhitePoint,
    function: 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:

```kotlin
| Spaces | 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: @https://developer.android.com/reference/kotlin/androidx/annotation/Size(min = 1) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | Name of the color space, cannot be null, its length must be \>= 1 |
| `primaries: @https://developer.android.com/reference/kotlin/androidx/annotation/Size(min = 6, max = 9) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html` | RGB primaries as an array of 6 (xy) or 9 (XYZ) floats |
| `whitePoint: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/WhitePoint` | Reference white as an array of 2 (xy) or 3 (XYZ) floats |
| `function: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/TransferParameters` | Parameters for the transfer functions |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | 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. |

### Rgb

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
Rgb(
    name: @Size(min = 1) String,
    primaries: @Size(min = 6, max = 9) FloatArray,
    whitePoint: WhitePoint,
    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:

```kotlin
| Spaces | 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: @https://developer.android.com/reference/kotlin/androidx/annotation/Size(min = 1) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | Name of the color space, cannot be null, its length must be \>= 1 |
| `primaries: @https://developer.android.com/reference/kotlin/androidx/annotation/Size(min = 6, max = 9) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html` | RGB primaries as an array of 6 (xy) or 9 (XYZ) floats |
| `whitePoint: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/WhitePoint` | Reference white as an array of 2 (xy) or 3 (XYZ) floats |
| `gamma: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html` | Gamma to use as the transfer function |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | 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 |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/index.html` |   |

### Rgb

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
Rgb(
    name: @Size(min = 1) String,
    toXYZ: @Size(value = 9) FloatArray,
    oetf: (Double) -> Double,
    eotf: (Double) -> 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: @https://developer.android.com/reference/kotlin/androidx/annotation/Size(min = 1) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | Name of the color space, cannot be null, its length must be \>= 1 |
| `toXYZ: @https://developer.android.com/reference/kotlin/androidx/annotation/Size(value = 9) https://kotlinlang.org/api/core/kotlin-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: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html` | Opto-electronic transfer function, cannot be null |
| `eotf: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html` | Electro-optical transfer function, cannot be null |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | 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. |

### Rgb

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
Rgb(
    name: @Size(min = 1) String,
    primaries: @Size(min = 6, max = 9) FloatArray,
    whitePoint: WhitePoint,
    oetf: (Double) -> Double,
    eotf: (Double) -> Double,
    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:

```kotlin
| Spaces | 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: @https://developer.android.com/reference/kotlin/androidx/annotation/Size(min = 1) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | Name of the color space, cannot be null, its length must be \>= 1 |
| `primaries: @https://developer.android.com/reference/kotlin/androidx/annotation/Size(min = 6, max = 9) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html` | RGB primaries as an array of 6 (xy) or 9 (XYZ) floats |
| `whitePoint: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/WhitePoint` | Reference white as an array of 2 (xy) or 3 (XYZ) floats |
| `oetf: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html` | Opto-electronic transfer function, cannot be null |
| `eotf: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html` | Electro-optical transfer function, cannot be null |
| `min: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The minimum valid value in this color space's RGB range |
| `max: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The maximum valid value in this color space's RGB range |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | 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. |

## Public functions

### equals

Cmn

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

### fromLinear

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
fun fromLinear(v: @Size(min = 3) FloatArray): @Size(min = 3) 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 `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb` for more information about transfer functions and their use for encoding and decoding RGB values.

| Parameters |
|---|---|
| `v: @https://developer.android.com/reference/kotlin/androidx/annotation/Size(min = 3) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html` | A non-null array of linear RGB values, its length must be at least 3 |

| Returns |
|---|---|
| `@https://developer.android.com/reference/kotlin/androidx/annotation/Size(min = 3) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#fromLinear(kotlin.FloatArray)`, containing non-linear RGB values |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#fromLinear(kotlin.FloatArray)` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#toLinear(kotlin.Float,kotlin.Float,kotlin.Float)` |   |

### fromLinear

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
fun fromLinear(r: Float, g: Float, b: Float): @Size(value = 3) 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 `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb` for more information about transfer functions and their use for encoding and decoding RGB values.

| Parameters |
|---|---|
| `r: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The red component to encode from linear space |
| `g: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The green component to encode from linear space |
| `b: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The blue component to encode from linear space |

| Returns |
|---|---|
| `@https://developer.android.com/reference/kotlin/androidx/annotation/Size(value = 3) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html` | A new array of 3 floats containing non-linear RGB values |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#fromLinear(kotlin.Float,kotlin.Float,kotlin.Float)` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#toLinear(kotlin.Float,kotlin.Float,kotlin.Float)` |   |

### fromXyz

Cmn

```
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 `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/ColorModel#componentCount()`, and its first 3 values must be the XYZ components to convert from.

| Parameters |
|---|---|
| `v: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html` | An array of color components containing the XYZ values to convert from, and large enough to hold the number of components of this color space's model. The minimum size is 3, but most color spaces have 4 components. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html` | The array passed in parameter `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/ColorSpace#fromXyz(kotlin.FloatArray)`. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/ColorSpace#fromXyz(kotlin.FloatArray)` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/ColorSpace#toXyz(kotlin.Float,kotlin.Float,kotlin.Float)` |   |

### getInverseTransform

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
fun getInverseTransform(): @Size(value = 9) 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 `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/package-summary#(androidx.compose.ui.graphics.colorspace.ColorSpace).adapt(androidx.compose.ui.graphics.colorspace.WhitePoint,androidx.compose.ui.graphics.colorspace.Adaptation)` them to the same white point.

It is recommended to use `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/package-summary#(androidx.compose.ui.graphics.colorspace.ColorSpace).connect(androidx.compose.ui.graphics.colorspace.ColorSpace,androidx.compose.ui.graphics.colorspace.RenderIntent)` to convert between color spaces.

| Returns |
|---|---|
| `@https://developer.android.com/reference/kotlin/androidx/annotation/Size(value = 9) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html` | A new array of 9 floats |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#getTransform()` |   |

### getInverseTransform

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
fun getInverseTransform(inverseTransform: @Size(min = 9) FloatArray): @Size(min = 9) 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 `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/package-summary#(androidx.compose.ui.graphics.colorspace.ColorSpace).adapt(androidx.compose.ui.graphics.colorspace.WhitePoint,androidx.compose.ui.graphics.colorspace.Adaptation)` them to the same white point.

It is recommended to use `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/package-summary#(androidx.compose.ui.graphics.colorspace.ColorSpace).connect(androidx.compose.ui.graphics.colorspace.ColorSpace,androidx.compose.ui.graphics.colorspace.RenderIntent)` to convert between color spaces.

| Parameters |
|---|---|
| `inverseTransform: @https://developer.android.com/reference/kotlin/androidx/annotation/Size(min = 9) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html` | The destination array, cannot be null, its length must be \>= 9 |

| Returns |
|---|---|
| `@https://developer.android.com/reference/kotlin/androidx/annotation/Size(min = 9) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html` | The `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#getInverseTransform(kotlin.FloatArray)` array passed as a parameter, modified to contain the inverse transform of this color space. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#getTransform()` |   |

### getMaxValue

Cmn

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

Returns the maximum valid value for the specified component of this color space's color model.

| Parameters |
|---|---|
| `component: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The index of the component, from `0` to `3`, inclusive |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | A floating point value greater than `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/ColorSpace#getMinValue(kotlin.Int)` |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/ColorSpace#getMinValue(kotlin.Int)` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/ColorModel#componentCount()` |   |

### getMinValue

Cmn

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

Returns the minimum valid value for the specified component of this color space's color model.

| Parameters |
|---|---|
| `component: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The index of the component, from `0` to `3`, inclusive. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | A floating point value less than `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/ColorSpace#getMaxValue(kotlin.Int)` |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/ColorSpace#getMaxValue(kotlin.Int)` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/ColorModel#componentCount()` |   |

### getPrimaries

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
fun getPrimaries(): @Size(value = 6) 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.

| Returns |
|---|---|
| `@https://developer.android.com/reference/kotlin/androidx/annotation/Size(value = 6) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html` | A new non-null array of 2 floats |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#whitePoint()` |   |

### getPrimaries

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
fun getPrimaries(primaries: @Size(min = 6) FloatArray): @Size(min = 6) 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.

| Parameters |
|---|---|
| `primaries: @https://developer.android.com/reference/kotlin/androidx/annotation/Size(min = 6) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html` | The destination array, cannot be null, its length must be \>= 6 |

| Returns |
|---|---|
| `@https://developer.android.com/reference/kotlin/androidx/annotation/Size(min = 6) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#getPrimaries(kotlin.FloatArray)` array, modified to contain the primaries of this color space. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#getPrimaries(kotlin.FloatArray)` |   |

### getTransform

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
fun getTransform(): @Size(value = 9) 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 `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/package-summary#(androidx.compose.ui.graphics.colorspace.ColorSpace).adapt(androidx.compose.ui.graphics.colorspace.WhitePoint,androidx.compose.ui.graphics.colorspace.Adaptation)` them to the same white point.

It is recommended to use `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/package-summary#(androidx.compose.ui.graphics.colorspace.ColorSpace).connect(androidx.compose.ui.graphics.colorspace.ColorSpace,androidx.compose.ui.graphics.colorspace.RenderIntent)` to convert between color spaces.

| Returns |
|---|---|
| `@https://developer.android.com/reference/kotlin/androidx/annotation/Size(value = 9) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html` | A new array of 9 floats |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#getInverseTransform()` |   |

### getTransform

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
fun getTransform(transform: @Size(min = 9) FloatArray): @Size(min = 9) 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 `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/package-summary#(androidx.compose.ui.graphics.colorspace.ColorSpace).adapt(androidx.compose.ui.graphics.colorspace.WhitePoint,androidx.compose.ui.graphics.colorspace.Adaptation)` them to the same white point.

It is recommended to use `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/package-summary#(androidx.compose.ui.graphics.colorspace.ColorSpace).connect(androidx.compose.ui.graphics.colorspace.ColorSpace,androidx.compose.ui.graphics.colorspace.RenderIntent)` to convert between color spaces.

| Parameters |
|---|---|
| `transform: @https://developer.android.com/reference/kotlin/androidx/annotation/Size(min = 9) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html` | The destination array, cannot be null, its length must be \>= 9 |

| Returns |
|---|---|
| `@https://developer.android.com/reference/kotlin/androidx/annotation/Size(min = 9) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#getTransform(kotlin.FloatArray)`, modified to contain the transform for this color space. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#getInverseTransform()` |   |

### hashCode

Cmn

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

### toLinear

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
fun toLinear(v: @Size(min = 3) FloatArray): @Size(min = 3) 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 `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb` for more information about transfer functions and their use for encoding and decoding RGB values.

| Parameters |
|---|---|
| `v: @https://developer.android.com/reference/kotlin/androidx/annotation/Size(min = 3) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html` | A non-null array of non-linear RGB values, its length must be at least 3 |

| Returns |
|---|---|
| `@https://developer.android.com/reference/kotlin/androidx/annotation/Size(min = 3) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#toLinear(kotlin.FloatArray)`, containing linear RGB values |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#toLinear(kotlin.FloatArray)` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#fromLinear(kotlin.Float,kotlin.Float,kotlin.Float)` |   |

### toLinear

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
fun toLinear(r: Float, g: Float, b: Float): @Size(value = 3) 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 `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb` for more information about transfer functions and their use for encoding and decoding RGB values.

| Parameters |
|---|---|
| `r: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The red component to decode to linear space |
| `g: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The green component to decode to linear space |
| `b: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The blue component to decode to linear space |

| Returns |
|---|---|
| `@https://developer.android.com/reference/kotlin/androidx/annotation/Size(value = 3) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html` | A new array of 3 floats containing linear RGB values |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#toLinear(kotlin.Float,kotlin.Float,kotlin.Float)` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#fromLinear(kotlin.Float,kotlin.Float,kotlin.Float)` |   |

### toXyz

Cmn

```
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 `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/ColorModel#Rgb()`, it is assumed that the target CIE XYZ space uses a `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Illuminant#D50()` standard illuminant.

The specified array's length must be at least equal to to the number of color components as returned by `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/ColorModel#componentCount()`.

| Parameters |
|---|---|
| `v: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html` | An array of color components containing the color space's color value to convert to XYZ, and large enough to hold the resulting tristimulus XYZ values, at least 3 values. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html` | The array passed in parameter `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/ColorSpace#toXyz(kotlin.FloatArray)`. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/ColorSpace#toXyz(kotlin.FloatArray)` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/ColorSpace#fromXyz(kotlin.Float,kotlin.Float,kotlin.Float)` |   |

## Public properties

### eotf

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
val eotf: (Double) -> Double
```

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

```kotlin
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\^γ (the approximation of the `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/ColorSpaces#Srgb()` EOTF uses γ = 2.2 for instance).

| Returns |
|---|---|
| `(https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html` | A transfer function that converts from "gamma space" to linear space |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#oetf()` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#transferParameters()` |   |

### isSrgb

Cmn

```
open val isSrgb: Boolean
```

Indicates whether this color space is the sRGB color space or equivalent to the sRGB color space.

A color space is considered sRGB if it meets all the following conditions:

- Its color model is `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/ColorModel#Rgb()`. \* Its primaries are within 1e-3 of the true `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/ColorSpaces#Srgb()` primaries.

  - Its white point is within 1e-3 of the CIE standard illuminant `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Illuminant#D65()`.

- Its opto-electronic transfer function is not linear.

- Its electro-optical transfer function is not linear.

- Its transfer functions yield values within 1e-3 of `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/ColorSpaces#Srgb()`.

- Its range is `[0..1]`.

This method always returns true for `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/ColorSpaces#Srgb()`.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | True if this color space is the sRGB color space (or a close approximation), false otherwise |

### isWideGamut

Cmn

```
open val isWideGamut: Boolean
```

Returns whether this color space is a wide-gamut color space. An RGB color space is wide-gamut if its gamut entirely contains the `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/ColorSpaces#Srgb()` gamut and if the area of its gamut is 90% of greater than the area of the `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/ColorSpaces#Ntsc1953()` gamut.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | True if this color space is a wide-gamut color space, false otherwise |

### oetf

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
val oetf: (Double) -> Double
```

Returns the opto-electronic transfer function (OETF) of this color space. The inverse function is the electro-optical transfer function (EOTF) returned by `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#eotf()`. These functions are defined to satisfy the following equality for x ∈ `[0..1]`:

```kotlin
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\^γ (the approximation of the `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/ColorSpaces#Srgb()` OETF uses γ = 2.2 for instance).

| Returns |
|---|---|
| `(https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html` | A transfer function that converts from linear space to "gamma space" |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#eotf()` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#transferParameters()` |   |

### transferParameters

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
val transferParameters: TransferParameters?
```

Returns the parameters used by the `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#(kotlin.String,kotlin.FloatArray,androidx.compose.ui.graphics.colorspace.WhitePoint,kotlin.FloatArray,androidx.compose.ui.graphics.colorspace.DoubleFunction,androidx.compose.ui.graphics.colorspace.DoubleFunction,kotlin.Float,kotlin.Float,androidx.compose.ui.graphics.colorspace.TransferParameters,kotlin.Int)` and `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb#(kotlin.String,kotlin.FloatArray,androidx.compose.ui.graphics.colorspace.WhitePoint,kotlin.FloatArray,androidx.compose.ui.graphics.colorspace.DoubleFunction,androidx.compose.ui.graphics.colorspace.DoubleFunction,kotlin.Float,kotlin.Float,androidx.compose.ui.graphics.colorspace.TransferParameters,kotlin.Int)` 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 `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/TransferParameters` for a full description of the transfer functions.

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/TransferParameters?` | An instance of `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/TransferParameters` or null if this color space's transfer functions do not match the equation defined in `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/TransferParameters` |

### whitePoint

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
val whitePoint: WhitePoint
```