androidx.ui.graphics.colorspace

Classes

ColorSpace

A ColorSpace is used to identify a specific organization of colors.

Connector

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

Rgb

An RGB color space is an additive color space using the RGB color model (a color is therefore represented by a tuple of 3 numbers).

TransferParameters

Defines the parameters for the ICC parametric curve type 4, as defined in ICC.

WhitePoint

Class for constructing white points used in RGB color space.

Enums

Adaptation

List of adaptation matrices that can be used for chromatic adaptation using the von Kries transform.

ColorModel

A color model is required by a ColorSpace to describe the way colors can be represented as tuples of numbers.

RenderIntent

A render intent determines how a connector maps colors from one color space to another.

Extension functions summary

For ColorSpace
ColorSpace
ColorSpace.adapt(whitePoint: WhitePoint, adaptation: Adaptation = Adaptation.Bradford)

Performs the chromatic adaptation of a color space from its native white point to the specified white point.

Connector
ColorSpace.connect(destination: ColorSpace = ColorSpaces.Srgb, intent: RenderIntent = RenderIntent.Perceptual)

Connects two color spaces to allow conversion from the source color space to the destination color space.

Extension functions

adapt

@JvmOverloads fun ColorSpace.adapt(
    whitePoint: WhitePoint,
    adaptation: Adaptation = Adaptation.Bradford
): ColorSpace

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

Parameters
whitePoint: WhitePoint The new white point
adaptation: Adaptation = Adaptation.Bradford The adaptation matrix
Return
A new color space if the specified color space has an RGB model and a white point different from the specified white point; the specified color space otherwise

See Also

connect

fun ColorSpace.connect(
    destination: ColorSpace = ColorSpaces.Srgb,
    intent: RenderIntent = RenderIntent.Perceptual
): Connector

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 as needed.

If the source and destination are the same, an optimized connector is returned to avoid unnecessary computations and loss of precision.

Parameters
destination: ColorSpace = ColorSpaces.Srgb The color space to convert colors to
intent: RenderIntent = RenderIntent.Perceptual The render intent to map colors from the source to the destination
Return
A non-null connector between the two specified color spaces