ColorModel

Class

Common
value class ColorModel
internal constructor(
    /**
     * pack both the number of components and an ordinal value to distinguish between different
     * ColorModel types that have the same number of components
     */
    internal val packedValue: Long
)

A color model is required by a ColorSpace to describe the way colors can be represented as tuples of numbers. A common color model is the RGB color model which defines a color as represented by a tuple of 3 numbers (red, green and blue).

Properties

Common
@get:IntRange(from = 1, to = 4)

val componentCount: Int

Returns the number of components for this color model.

Returns

An integer between 1 and 4

Companion Object

Properties

Common
val Rgb = ColorModel(packInts(3, 0))

The RGB model is a color model with 3 components that refer to the three additive primiaries: red, green and blue.

Common
val Xyz = ColorModel(packInts(3, 1))

The XYZ model is a color model with 3 components that are used to model human color vision on a basic sensory level.

Common
val Lab = ColorModel(packInts(3, 2))

The Lab model is a color model with 3 components used to describe a color space that is more perceptually uniform than XYZ.

Common
val Cmyk = ColorModel(packInts(4, 3))

The CMYK model is a color model with 4 components that refer to four inks used in color printing: cyan, magenta, yellow and black (or key). CMYK is a subtractive color model.