Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Methods](https://developer.android.com/reference/android/graphics/ColorSpace.Connector#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/graphics/ColorSpace.Connector#inhmethods)

# ColorSpace.Connector

*** ** * ** ***


`
public
static


class
ColorSpace.Connector
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.graphics.ColorSpace.Connector |

<br />

*** ** * ** ***


A connector transforms colors from a source color space to a destination
color space.

A source color space is connected to a destination color space using the
color transform \\(C\\) computed from their respective transforms noted
\\(T_{src}\\) and \\(T_{dst}\\) in the following equation:
$$C = T\^{-1}_{dst} . T_{src}$$

The transform \\(C\\) shown above is only valid when the source and
destination color spaces have the same profile connection space (PCS).
We know that instances of `https://developer.android.com/reference/android/graphics/ColorSpace` always use CIE XYZ as their
PCS but their white points might differ. When they do, we must perform
a chromatic adaptation of the color spaces' transforms. To do so, we
use the von Kries method described in the documentation of `https://developer.android.com/reference/android/graphics/ColorSpace.Adaptation`,
using the CIE standard illuminant `https://developer.android.com/reference/android/graphics/ColorSpace#ILLUMINANT_D50`
as the target white point.

Example of conversion from `https://developer.android.com/reference/android/graphics/ColorSpace.Named#SRGB` to
`https://developer.android.com/reference/android/graphics/ColorSpace.Named#DCI_P3`:

```
ColorSpace.Connector connector = ColorSpace.connect(
        ColorSpace.get(ColorSpace.Named.SRGB),
        ColorSpace.get(ColorSpace.Named.DCI_P3));
float[] p3 = connector.transform(1.0f, 0.0f, 0.0f);
// p3 contains { 0.9473, 0.2740, 0.2076 }
```

<br />

**See also:**

- `https://developer.android.com/reference/android/graphics/ColorSpace.Adaptation`
- `https://developer.android.com/reference/android/graphics/ColorSpace#adapt(android.graphics.ColorSpace,%20float[],%20android.graphics.ColorSpace.Adaptation)`
- `https://developer.android.com/reference/android/graphics/ColorSpace#adapt(android.graphics.ColorSpace,%20float[])`
- `https://developer.android.com/reference/android/graphics/ColorSpace#connect(android.graphics.ColorSpace,%20android.graphics.ColorSpace,%20android.graphics.ColorSpace.RenderIntent)`
- `https://developer.android.com/reference/android/graphics/ColorSpace#connect(android.graphics.ColorSpace,%20android.graphics.ColorSpace)`
- `https://developer.android.com/reference/android/graphics/ColorSpace#connect(android.graphics.ColorSpace,%20android.graphics.ColorSpace.RenderIntent)`
- `https://developer.android.com/reference/android/graphics/ColorSpace#connect(android.graphics.ColorSpace)`

## Summary

| ### Public methods ||
|---|---|
| ` https://developer.android.com/reference/android/graphics/ColorSpace` | ` https://developer.android.com/reference/android/graphics/ColorSpace.Connector#getDestination()() ` Returns the destination color space this connector will convert to. |
| ` https://developer.android.com/reference/android/graphics/ColorSpace.RenderIntent` | ` https://developer.android.com/reference/android/graphics/ColorSpace.Connector#getRenderIntent()() ` Returns the render intent this connector will use when mapping the source color space to the destination color space. |
| ` https://developer.android.com/reference/android/graphics/ColorSpace` | ` https://developer.android.com/reference/android/graphics/ColorSpace.Connector#getSource()() ` Returns the source color space this connector will convert from. |
| ` float[]` | ` https://developer.android.com/reference/android/graphics/ColorSpace.Connector#transform(float[])(float[] v) ` <br /> Transforms the specified color from the source color space to a color in the destination color space. |
| ` float[]` | ` https://developer.android.com/reference/android/graphics/ColorSpace.Connector#transform(float,%20float,%20float)(float r, float g, float b) ` <br /> Transforms the specified color from the source color space to a color in the destination color space. |

| ### Inherited methods |
|---|---|
| From class ` https://developer.android.com/reference/java/lang/Object ` |---|---| | ` https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/java/lang/Object#clone()() ` Creates and returns a copy of this object. | | ` boolean` | ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) ` Indicates whether some other object is "equal to" this one. | | ` void` | ` https://developer.android.com/reference/java/lang/Object#finalize()() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. | | ` final https://developer.android.com/reference/java/lang/Class<?>` | ` https://developer.android.com/reference/java/lang/Object#getClass()() ` Returns the runtime class of this `Object`. | | ` int` | ` https://developer.android.com/reference/java/lang/Object#hashCode()() ` Returns a hash code value for the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notify()() ` Wakes up a single thread that is waiting on this object's monitor. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notifyAll()() ` Wakes up all threads that are waiting on this object's monitor. | | ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/lang/Object#toString()() ` Returns a string representation of the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait()() ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*. | ||

## Public methods

### getDestination

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

```
public ColorSpace getDestination ()
```

Returns the destination color space this connector will convert to.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/graphics/ColorSpace` | A non-null instance of `https://developer.android.com/reference/android/graphics/ColorSpace` <br /> |

**See also:**

- `https://developer.android.com/reference/android/graphics/ColorSpace.Connector#getSource()`

### getRenderIntent

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

```
public ColorSpace.RenderIntent getRenderIntent ()
```

Returns the render intent this connector will use when mapping the
source color space to the destination color space.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/graphics/ColorSpace.RenderIntent` | A non-null `https://developer.android.com/reference/android/graphics/ColorSpace.RenderIntent` <br /> |

**See also:**

- `https://developer.android.com/reference/android/graphics/ColorSpace.RenderIntent`

### getSource

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

```
public ColorSpace getSource ()
```

Returns the source color space this connector will convert from.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/graphics/ColorSpace` | A non-null instance of `https://developer.android.com/reference/android/graphics/ColorSpace` <br /> |

**See also:**

- `https://developer.android.com/reference/android/graphics/ColorSpace.Connector#getDestination()`

### transform

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

```
public float[] transform (float[] v)
```

<br />

Transforms the specified color from the source color space
to a color in the destination color space.

<br />

<br />

| Parameters ||
|---|---|
| `v` | `float`: A non-null array of 3 floats containing the value to transform and that will hold the result of the transform <br /> |

| Returns ||
|---|---|
| `float[]` | The v array passed as a parameter, containing the specified color transformed from the source space to the destination space. This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/graphics/ColorSpace.Connector#transform(float,%20float,%20float)`

### transform

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

```
public float[] transform (float r, 
                float g, 
                float b)
```

<br />

Transforms the specified color from the source color space
to a color in the destination color space. This convenience
method assumes a source color model with 3 components
(typically RGB). To transform from color models with more than
3 components, such as `https://developer.android.com/reference/android/graphics/ColorSpace.Model#CMYK`, use
`https://developer.android.com/reference/android/graphics/ColorSpace.Connector#transform(float[])` instead.

<br />

<br />

| Parameters ||
|---|---|
| `r` | `float`: The red component of the color to transform <br /> |
| `g` | `float`: The green component of the color to transform <br /> |
| `b` | `float`: The blue component of the color to transform <br /> |

| Returns ||
|---|---|
| `float[]` | A new array of 3 floats containing the specified color transformed from the source space to the destination space. This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/graphics/ColorSpace.Connector#transform(float[])`