allc
Version:
A small typescript package for color conversion.
63 lines (60 loc) • 2.24 kB
text/typescript
// This file was automatically generated by `src-comptime/precalculate.ts`.
import {
MATRIX_LINEAR_DCI_P3_D60_FROM_CIE_1931_XYZ_0_0,
MATRIX_LINEAR_DCI_P3_D60_FROM_CIE_1931_XYZ_0_1,
MATRIX_LINEAR_DCI_P3_D60_FROM_CIE_1931_XYZ_0_2,
MATRIX_LINEAR_DCI_P3_D60_FROM_CIE_1931_XYZ_1_0,
MATRIX_LINEAR_DCI_P3_D60_FROM_CIE_1931_XYZ_1_1,
MATRIX_LINEAR_DCI_P3_D60_FROM_CIE_1931_XYZ_1_2,
MATRIX_LINEAR_DCI_P3_D60_FROM_CIE_1931_XYZ_2_0,
MATRIX_LINEAR_DCI_P3_D60_FROM_CIE_1931_XYZ_2_1,
MATRIX_LINEAR_DCI_P3_D60_FROM_CIE_1931_XYZ_2_2,
} from "../../matrices";
/**
* Calculates the red component of linear DCI-P3 "D60 sim" from CIE 1931 XYZ.
*
* @param x The X component of CIE 1931 XYZ.
* @param y The Y component of CIE 1931 XYZ.
* @param z The Z component of CIE 1931 XYZ.
*
* @returns The red component of linear DCI-P3 "D60 sim".
*/
export const toLinearDCIP3D60RFromCIE1931XYZ = (
x: number,
y: number,
z: number,
) => x * MATRIX_LINEAR_DCI_P3_D60_FROM_CIE_1931_XYZ_0_0
+ y * MATRIX_LINEAR_DCI_P3_D60_FROM_CIE_1931_XYZ_0_1
+ z * MATRIX_LINEAR_DCI_P3_D60_FROM_CIE_1931_XYZ_0_2;
/**
* Calculates the green component of linear DCI-P3 "D60 sim" from CIE 1931 XYZ.
*
* @param x The X component of CIE 1931 XYZ.
* @param y The Y component of CIE 1931 XYZ.
* @param z The Z component of CIE 1931 XYZ.
*
* @returns The green component of linear DCI-P3 "D60 sim".
*/
export const toLinearDCIP3D60GFromCIE1931XYZ = (
x: number,
y: number,
z: number,
) => x * MATRIX_LINEAR_DCI_P3_D60_FROM_CIE_1931_XYZ_1_0
+ y * MATRIX_LINEAR_DCI_P3_D60_FROM_CIE_1931_XYZ_1_1
+ z * MATRIX_LINEAR_DCI_P3_D60_FROM_CIE_1931_XYZ_1_2;
/**
* Calculates the blue component of linear DCI-P3 "D60 sim" from CIE 1931 XYZ.
*
* @param x The X component of CIE 1931 XYZ.
* @param y The Y component of CIE 1931 XYZ.
* @param z The Z component of CIE 1931 XYZ.
*
* @returns The blue component of linear DCI-P3 "D60 sim".
*/
export const toLinearDCIP3D60BFromCIE1931XYZ = (
x: number,
y: number,
z: number,
) => x * MATRIX_LINEAR_DCI_P3_D60_FROM_CIE_1931_XYZ_2_0
+ y * MATRIX_LINEAR_DCI_P3_D60_FROM_CIE_1931_XYZ_2_1
+ z * MATRIX_LINEAR_DCI_P3_D60_FROM_CIE_1931_XYZ_2_2;