-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcodegen.d.ts
More file actions
51 lines (36 loc) · 2.11 KB
/
Copy pathcodegen.d.ts
File metadata and controls
51 lines (36 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Type definitions for whitepoint/codegen — emit the same conversions, from
// the same constants, as JS, GLSL ES 3.00, or WGSL source.
export interface EmitOptions {
/** Function name in the emitted source (default: wp_<from>_to_<to>). */
name?: string;
}
/** GLSL ES 3.00 source for a from→to conversion (declare `precision highp float;`). */
export function glsl(from: string, to: string, opts?: EmitOptions): string;
/** WGSL source for a from→to conversion. */
export function wgsl(from: string, to: string, opts?: EmitOptions): string;
/** Standalone dependency-free JavaScript source for a from→to conversion. */
export function js(from: string, to: string, opts?: EmitOptions): string;
/** Space ids available to the codegen pipeline. */
export function supported(): string[];
/** GLSL gamut mapper: OKLCH in, gamut-mapped RGB (in `gamut` coords) out. */
export function glslGamutMap(gamut: string, opts?: EmitOptions): string;
/** WGSL gamut mapper. */
export function wgslGamutMap(gamut: string, opts?: EmitOptions): string;
/** Standalone JS gamut mapper (parity-tested against the library in CI). */
export function jsGamutMap(gamut: string, opts?: EmitOptions): string;
export interface MixEmitOptions extends EmitOptions {
/** CSS Color 4 §12.4 hue interpolation method (default 'shorter'). */
hue?: 'shorter' | 'longer' | 'increasing' | 'decreasing';
}
/** GLSL mixer for a space with a CSS Color 4 hue interpolation method. */
export function glslMix(space: string, opts?: MixEmitOptions): string;
/** WGSL mixer. */
export function wgslMix(space: string, opts?: MixEmitOptions): string;
/** Standalone JS mixer (parity-tested against the library mix in CI). */
export function jsMix(space: string, opts?: MixEmitOptions): string;
/** GLSL Porter-Duff compositor over premultiplied vec4. */
export function glslComposite(op?: string, opts?: EmitOptions): string;
/** WGSL Porter-Duff compositor. */
export function wgslComposite(op?: string, opts?: EmitOptions): string;
/** Standalone JS Porter-Duff compositor (parity-tested in CI). */
export function jsComposite(op?: string, opts?: EmitOptions): string;