Adaptation

Class

Common
abstract class Adaptation private constructor(internal val transform: FloatArray)

List of adaptation matrices that can be used for chromatic adaptation using the von Kries transform. These matrices are used to convert values in the CIE XYZ space to values in the LMS space (Long Medium Short).

Given an adaptation matrix A, the conversion from XYZ to LMS is straightforward:

See equation(https://developer.android.com/reference/android/graphics/ColorSpace.Adaptation.html)

The complete von Kries transform T uses a diagonal matrix noted D to perform the adaptation in LMS space. In addition to A and D, the source white point W1 and the destination white point W2 must be specified:

See equation(https://developer.android.com/reference/android/graphics/ColorSpace.Adaptation.html)

As an example, the resulting matrix T can then be used to perform the chromatic adaptation of sRGB XYZ transform from D65 to D50:

See equation(https://developer.android.com/reference/android/graphics/ColorSpace.Adaptation.html)

Companion Object

Properties

Common
val Bradford =
        object :
            Adaptation(
                floatArrayOf(
                    0.8951f,
                    -0.7502f,
                    0.0389f,
                    0.2664f,
                    1.7135f,
                    -0.0685f,
                    -0.1614f,
                    0.0367f,
                    1.0296f,
                )
            ) {
            override fun toString() = "Bradford"
        }

Bradford chromatic adaptation transform, as defined in the CIECAM97s color appearance model.

Common
val VonKries =
        object :
            Adaptation(
                floatArrayOf(
                    0.40024f,
                    -0.22630f,
                    0.00000f,
                    0.70760f,
                    1.16532f,
                    0.00000f,
                    -0.08081f,
                    0.04570f,
                    0.91822f,
                )
            ) {
            override fun toString() = "VonKries"
        }

von Kries chromatic adaptation transform.

Common
val Ciecat02 =
        object :
            Adaptation(
                floatArrayOf(
                    0.7328f,
                    -0.7036f,
                    0.0030f,
                    0.4296f,
                    1.6975f,
                    0.0136f,
                    -0.1624f,
                    0.0061f,
                    0.9834f,
                )
            ) {
            override fun toString() = "Ciecat02"
        }

CIECAT02 chromatic adaption transform, as defined in the CIECAM02 color appearance model.