/** * Colour transforms between the document's sRGB colours and a CMYK output * profile: the separation postext-pdf writes, and the soft proof the * canvas viewers paint (CMYK → Lab → screen sRGB). */ import type { IccProfile, XYZ } from './icc.js'; export type RenderingIntent = 'perceptual' | 'relative' | 'saturation' | 'absolute'; export interface Lab { L: number; a: number; b: number; } export interface Cmyk { /** 0..1 each. */ c: number; m: number; y: number; k: number; } export declare const D50: XYZ; export declare function xyzToLab(v: XYZ, white?: XYZ): Lab; export declare function labToXyz(lab: Lab, white?: XYZ): XYZ; /** CIE76 colour difference. */ export declare function deltaE(p: Lab, q: Lab): number; export declare function srgbToLinear(v: number): number; export declare function linearToSrgb(v: number): number; export declare function srgbToXyz(r: number, g: number, b: number): XYZ; export declare function xyzToSrgb(v: XYZ): [number, number, number]; export declare function srgbToLab(r: number, g: number, b: number): Lab; export declare function labToSrgb(lab: Lab): [number, number, number]; /** Device CMYK (0..1) → Lab through the profile's A2B table. `absolute` * maps paper white to the paper's own colour (soft proof with paper * simulation); the other intents give media-relative Lab. */ export declare function cmykToLab(profile: IccProfile, cmyk: Cmyk, intent?: RenderingIntent): Lab; /** Lab → device CMYK through the profile's B2A table. */ export declare function labToCmyk(profile: IccProfile, lab: Lab, intent?: RenderingIntent): Cmyk; /** Total area coverage of a CMYK value, in percent (0..400). */ export declare function totalAreaCoverage(cmyk: Cmyk): number; export interface OutputTransformOptions { intent?: RenderingIntent; /** Scale the source so sRGB black lands on the profile's darkest * printable black instead of being clipped (relative intent only). */ blackPointCompensation?: boolean; /** Neutral colours (r = g = b) become K only, with K picked so L* matches. */ preserveNeutrals?: boolean; } export interface OutputTransform { profile: IccProfile; /** sRGB 0..1 → CMYK 0..1. */ fromRgb(r: number, g: number, b: number): Cmyk; /** CMYK → media-relative Lab (relative) or paper-simulating Lab. */ toLab(cmyk: Cmyk, paper?: boolean): Lab; /** CMYK → screen sRGB 0..1, the soft proof of one colour. */ proof(cmyk: Cmyk, paper?: boolean): [number, number, number]; /** The profile's darkest black (relative Lab of its B2A for L* 0). */ blackPoint: Lab; /** L* of paper with K only at `k` (relative): the K-only neutral ramp. */ kOnlyFor(L: number): number; } /** Build (and memoize per profile + options) a transform from the * document's sRGB colours to an output CMYK profile. */ export declare function outputTransform(profile: IccProfile, options?: OutputTransformOptions): OutputTransform; /** A dense RGB → RGBA-ish lookup (`size³` entries × `channels`), filled by * `fn` and applied per pixel with trilinear interpolation. */ export interface RgbLut { size: number; channels: number; data: Float32Array; } export declare function buildRgbLut(size: number, channels: number, fn: (r: number, g: number, b: number) => number[]): RgbLut; /** Evaluate an `RgbLut` at 0..255 integer RGB into `out` (tetrahedral). */ export declare function sampleRgbLut(lut: RgbLut, r8: number, g8: number, b8: number, out: Float32Array | number[]): void; //# sourceMappingURL=transform.d.ts.map