androidx.compose.ui.graphics.colorspace

Classes

Adaptation

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

Cmn
ColorModel

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

Cmn
ColorSpace

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

Cmn
Connector

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

Cmn
RenderIntent

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

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

Cmn
TransferParameters

Defines the parameters for the ICC parametric curve type 4, as defined in ICC.1:2004-10, section 10.15.

Cmn
WhitePoint

Class for constructing white points used in RGB color space.

Cmn

Objects

ColorSpaces
Cmn
Illuminant

Illuminant contains standard CIE white points.

Cmn

Extension functions summary

ColorSpace
ColorSpace.adapt(whitePoint: WhitePoint, adaptation: Adaptation)

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

Cmn
Connector
ColorSpace.connect(destination: ColorSpace, intent: RenderIntent)

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

Cmn

Extension functions

adapt

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

Returns
ColorSpace

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

Returns
Connector

A non-null connector between the two specified color spaces