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

# Connector

*** ** * ** ***

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

```
open class Connector
```

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

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/kotlin/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/kotlin/android/graphics/ColorSpace.Adaptation`, using the CIE standard illuminant `https://developer.android.com/reference/kotlin/android/graphics/ColorSpace#ILLUMINANT_D50:kotlin.FloatArray` as the target white point.

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

```kotlin
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 }
  
```

## Summary

| Public methods ||
|---|---|
| open [ColorSpace](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace) | `https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Connector#getDestination()()` Returns the destination color space this connector will convert to. |
| open [ColorSpace.RenderIntent](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.RenderIntent)! | `https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Connector#getRenderIntent()()` Returns the render intent this connector will use when mapping the source color space to the destination color space. |
| open [ColorSpace](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace) | `https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Connector#getSource()()` Returns the source color space this connector will convert from. |
| open [FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html) | `https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Connector#transform(kotlin.Float,%20kotlin.Float,%20kotlin.Float)(r: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html, g: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html, b: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html)` Transforms the specified color from the source color space to a color in the destination color space. |
| open [FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html) | `https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Connector#transform(kotlin.FloatArray)(v: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html)` Transforms the specified color from the source color space to a color in the destination color space. |

## Public methods

### getDestination

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

```
open fun getDestination(): ColorSpace
```

Returns the destination color space this connector will convert to.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/graphics/ColorSpace` | A non-null instance of `https://developer.android.com/reference/kotlin/android/graphics/ColorSpace` |

**See Also**

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

### getRenderIntent

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

```
open fun getRenderIntent(): ColorSpace.RenderIntent!
```

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

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.RenderIntent!` | A non-null `https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.RenderIntent` |

**See Also**

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

### getSource

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

```
open fun getSource(): ColorSpace
```

Returns the source color space this connector will convert from.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/graphics/ColorSpace` | A non-null instance of `https://developer.android.com/reference/kotlin/android/graphics/ColorSpace` |

**See Also**

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

### transform

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

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

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/kotlin/android/graphics/ColorSpace.Model`, use `https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.Connector#transform(kotlin.FloatArray)` instead.

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

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html` | A new array of 3 floats containing the specified color transformed from the source space to the destination space. This value cannot be `null`. |

**See Also**

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

### transform

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

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

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

| Parameters ||
|---|---|
| `v` | [FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html): A non-null array of 3 floats containing the value to transform and that will hold the result of the transform |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html` | 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`. |

**See Also**

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