# Companion

object Companion

## Functions

adaptXyz
Link copied to clipboard
fun adaptXyz(@Size(value = 3) xyzIn: DoubleArray, @Size(value = 3) refIn: DoubleArray, @Size(value = 3) refOut: DoubleArray): DoubleArray

Adapts colour in XYZ from one reference white to another using Bradford adaptation method. NOTE: refIn, refOut, xyzIn must all be on the same scale

clipXyz
Link copied to clipboard
fun clipXyz(@Size(value = 3) xyz: DoubleArray, @Size(value = 3) xyzRef: DoubleArray): DoubleArray

Clips CIEXYZ values in between 0 and the value of the reference white to ensure X,Y,Z are in the proper range.

cmykToXyz
Link copied to clipboard
fun cmykToXyz(context: Context, @Size(value = 4) cmykIn: DoubleArray, @Size(value = 3) refOut: DoubleArray, bpc: Boolean): DoubleArray

Calculates XYZ value from CMYK input using built-in lookup tables

fun cmykToXyz(@Size(value = 4) cmykIn: DoubleArray, @Size(value = 3) refOut: DoubleArray, bpc: Boolean, m: Array<DoubleArray>, input: Array<IntArray>, clut: Array<IntArray>, output: Array<IntArray>): DoubleArray

Calculates XYZ value from CMYK input using lookup tables provided as input arguments

deltaE00
Link copied to clipboard
fun deltaE00(@Size(value = 3) lab1: DoubleArray, @Size(value = 3) lab2: DoubleArray, kL: Double = DELTA_E_KL_DEFAULT, kC: Double = DELTA_E_KC_DEFAULT, kH: Double = DELTA_E_KH_DEFAULT): Double

Takes two CIELAB values and calculates color difference (dE) using CIE2000 formula NOTE: both CIELAB values must share the same reference white. If they do not: convert to XYZ, adapt, convert back to CIELAB before calculating dE.

deltaE76
Link copied to clipboard
fun deltaE76(@Size(value = 3) lab1: DoubleArray, @Size(value = 3) lab2: DoubleArray): Double

Takes two CIELAB values and calculates color difference (dE) using CIE1976 formula. NOTE: both CIELAB values must share the same reference white. If they do not: convert to XYZ, adapt, convert back to CIELAB before calculating dE

deltaE94
Link copied to clipboard
fun deltaE94(@Size(value = 3) lab1: DoubleArray, @Size(value = 3) lab2: DoubleArray, kL: Double, k1: Double, k2: Double): Double

Takes two CIELAB values and calculates color difference (dE) using CIE1994 formula. Requires weighting factors kL, k1, and k2 which are dependent on application. Use the deltaE94G method for graphic design applications and the deltaE94T for textile applications. NOTE: both CIELAB values must share the same reference white. If they do not: convert to XYZ, adapt, convert back to CIELAB before calculating dE.

deltaE94G
Link copied to clipboard
fun deltaE94G(@Size(value = 3) lab1: DoubleArray, @Size(value = 3) lab2: DoubleArray): Double

Takes two CIELAB values and calculates color difference (dE) using CIE1994 formula for the graphic design application (kL = 1, k1 = 0.045, k2 = 0.015). NOTE: both CIELAB values must share the same reference white. If they do not: convert to XYZ, adapt, convert back to CIELAB before calculating dE.

deltaE94T
Link copied to clipboard
fun deltaE94T(@Size(value = 3) lab1: DoubleArray, @Size(value = 3) lab2: DoubleArray): Double

Takes two CIELAB values and calculates color difference (dE) using CIE1994 formula for the textiles application (kL = 2, k1 = 0.048, k2 = 0.014). NOTE: both CIELAB values must share the same reference white. If they do not: convert to XYZ, adapt, convert back to CIELAB before calculating dE.

deltaECmc
Link copied to clipboard
fun deltaECmc(@Size(value = 3) lab1: DoubleArray, @Size(value = 3) lab2: DoubleArray, l: Double, c: Double): Double

Takes two CIELAB values and calculates color difference (dE) using CMC(l:c) formula. Depends on model parameters l and c; common values used are CMC(2:1) for acceptability and CMC(1:1) for perceptibility. NOTE: both CIELAB values must share the same reference white. If they do not: convert to XYZ, adapt, convert back to CIELAB before calculating dE

labToLch
Link copied to clipboard
fun labToLch(@Size(value = 3) labIn: DoubleArray): DoubleArray

Takes CIELAB value and converts to polar coordinates (LCH)

labToXyz
Link copied to clipboard
fun labToXyz(@Size(value = 3) lab: DoubleArray, @Size(value = 3) xyzRef: DoubleArray): DoubleArray

Takes CIELAB value and its reference white to calculate CIEXYZ value

lchToLab
Link copied to clipboard
fun lchToLab(@Size(value = 3) lchIn: DoubleArray): DoubleArray

Takes LCHab value and converts to CIELAB

lchToLuv
Link copied to clipboard
fun lchToLuv(@Size(value = 3) lchIn: DoubleArray): DoubleArray

Takes LCHuv value and converts to CIELUV

luvToLch
Link copied to clipboard
fun luvToLch(@Size(value = 3) luvIn: DoubleArray): DoubleArray

Takes CIELUV value and converts to polar coordinates (LCH)

luvToXyz
Link copied to clipboard
fun luvToXyz(@Size(value = 3) luvIn: DoubleArray, @Size(value = 3) xyzRef: DoubleArray): DoubleArray

Takes CIELUV value and its reference white to calculate CIEXYZ value

rgbToXyz
Link copied to clipboard
fun rgbToXyz(@Size(value = 3) rgbIn: DoubleArray, @Size(value = 2) redChromaticity: DoubleArray, @Size(value = 2) greenChromaticity: DoubleArray, @Size(value = 2) blueChromaticity: DoubleArray, @Size(value = 2) whiteChromaticity: DoubleArray, @Size(value = 3) refOut: DoubleArray): DoubleArray

Calculates XYZ from linear RGB given chromaticity coordinates of RGB working space primaries and reference whites of RGB and XYZ value.

spectral10ToDensity
Link copied to clipboard
fun spectral10ToDensity(lambda: IntArray, reflectance: FloatArray, status: DensityStatus): DoubleArray

Takes reflectance data on 10 nm intervals and calculates CMYK densities according to ISO 5-3:2009. Data must be provided on 10 nm intervals corresponding to the nearest 10 nanometer. Density values are calculated across the range 340 - 770 nm. If the provided data spans a shorter range (eg - 400 - 700 nm), the values at the boundaries are repeated.

spectral10ToXyz
Link copied to clipboard
fun spectral10ToXyz(lambda: IntArray, reflectance: FloatArray, illuminant: Illuminant, observer: Observer): DoubleArray

Takes reflectance data on 10 nm intervals and calculates a CIEXYZ value according to ASTM E308. Data must be provided on 10 nm intervals corresponding to the nearest 10 nanometer. CIEXYZ values are calculated across the range 360 - 780 nm. If the provided data spans a shorter range (eg - 400 - 700 nm), the values at the boundaries are repeated.

sRgbToXyz
Link copied to clipboard
fun sRgbToXyz(@Size(value = 3) sRgb: IntArray, @Size(value = 3) refOut: DoubleArray): DoubleArray

Calculates XYZ from sRGB value.

xyzToCmyk
Link copied to clipboard
fun xyzToCmyk(context: Context, @Size(value = 3) xyzIn: DoubleArray, @Size(value = 3) xyzRef: DoubleArray, bpc: Boolean): DoubleArray

Calculates CMYK value from XYZ input using built in lookup tables

fun xyzToCmyk(@Size(value = 3) xyzIn: DoubleArray, @Size(value = 3) xyzRef: DoubleArray, bpc: Boolean, m: Array<DoubleArray>, inputCurves: Array<IntArray>, clut: Array<IntArray>, outputCurves: Array<IntArray>): DoubleArray

Calculates CMYK value from XYZ using lookup tables provided as `inputCurves` arguments

xyzToLab
Link copied to clipboard
fun xyzToLab(@Size(value = 3) xyz: DoubleArray, @Size(value = 3) xyzRef: DoubleArray): DoubleArray

Takes CIEXYZ value and its reference white to calculate CIELAB value. xyz and xyzRef can be either unity (0 - 1) or scaled (0 - 100) input, but both vectors must be the same scale. (IE - if xyz is unity scale, xyzRef must also be unity scale)

xyzToLuv
Link copied to clipboard
fun xyzToLuv(@Size(value = 3) xyzIn: DoubleArray, @Size(value = 3) xyzRef: DoubleArray): DoubleArray

Takes CIEXYZ value and its reference white to calculate CIELUV value.

xyzToRgb
Link copied to clipboard
fun xyzToRgb(@Size(value = 3) xyzIn: DoubleArray, @Size(value = 3) refIn: DoubleArray, @Size(value = 2) redChromaticity: DoubleArray, @Size(value = 2) greenChromaticity: DoubleArray, @Size(value = 2) blueChromaticity: DoubleArray, @Size(value = 2) whiteChromaticity: DoubleArray): DoubleArray

Calculates linear RGB from XYZ given chromaticity coordinates of RGB working space primaries and reference whites of RGB and XYZ value

xyzToSrgb
Link copied to clipboard
fun xyzToSrgb(@Size(value = 3) xyzIn: DoubleArray, @Size(value = 3) refIn: DoubleArray): IntArray

Calculates companded sRGB value from XYZ given reference white of XYZ value.