{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

ColorSpaceKt

public final class ColorSpaceKt


Summary

Public methods

static final @NonNull ColorSpace
adapt(
    @NonNull ColorSpace receiver,
    @NonNull WhitePoint whitePoint,
    @NonNull Adaptation adaptation
)

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

static final @NonNull Connector
connect(
    @NonNull ColorSpace receiver,
    @NonNull ColorSpace destination,
    @NonNull RenderIntent intent
)

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

Public methods

adapt

public static final @NonNull ColorSpace adapt(
    @NonNull ColorSpace receiver,
    @NonNull WhitePoint whitePoint,
    @NonNull Adaptation adaptation
)

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
@NonNull WhitePoint whitePoint

The new white point

@NonNull Adaptation adaptation

The adaptation matrix

Returns
@NonNull 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

connect

public static final @NonNull Connector connect(
    @NonNull ColorSpace receiver,
    @NonNull ColorSpace destination,
    @NonNull RenderIntent intent
)

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
@NonNull ColorSpace destination

The color space to convert colors to

@NonNull RenderIntent intent

The render intent to map colors from the source to the destination

Returns
@NonNull Connector

A non-null connector between the two specified color spaces