Skip to content

Commit 84e36fc

Browse files
vanceingallsclaude
andauthored
feat(runtime): data-vfx-chain backdrop capture and two-source kernels (luma-matte, noise) (#4330)
* feat(runtime): data-vfx-chain backdrop capture and ref second sources Interface v1.1's two remaining capture shapes, in the runtime. `backdrop`: a host resolves its source from a sibling `<canvas layoutsubtree class="hf-vfx-src" data-vfx-for="<host id>">` before its own child wrapper, so the same kernel reads either its own pixels or every layer below it — which element the wrapper holds is the exporter's placement, not a def's declaration. `VfxEntry.capture` now reports what was resolved rather than what the defs asked for. The trap that shape creates: a `backdrop` wrapper lives OUTSIDE the host, and children of a `layoutsubtree` canvas are never painted by the page compositor. Skipping a hidden host the way a `self` host is skipped would therefore delete every layer below the adjustment instead of passing it through. A hidden backdrop host now still captures and KEEPS the bitmap, painting no kernel. `ref` params: a node's second source, captured into `u_src2` from the wrapper the exporter emitted around the referenced element. Per node, not per entry, and shared when two nodes name the same element. Every source is drawn at the host's device size so `u_src`/`u_src2`/`.hf-vfx-out` share one coordinate space, and each source's canvas gets its own `paint` wait — paint records are per canvas. A source the clip runtime has hidden captures EMPTY rather than waiting out a paint that cannot come and then throwing "No cached paint record" every frame; an empty matte is also what After Effects shows outside a matte layer's window. Also: a `.hf-vfx-in` that measures 0×0 is now reported once instead of capturing nothing in silence, and one that is not the canvas's immediate child is refused at registration instead of throwing every frame. Both are measured Chrome rules (vault `layoutsubtree-capture-rules`). Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * feat(runtime): luma-matte and noise two-source vfx kernels `luma-matte` is the first def with a `ref` param: `out = src · coverage(u_src2)` with Alpha / Alpha Inverted / Luma / Luma Inverted coverage. It is not one After Effects effect but the runtime form of all of them — unsupported track-matte sources, stencils, silhouettes, Set Matte — which the exporter distinguishes by choosing what the host wraps and what `matte` names. `src` is premultiplied, so one scalar multiply covers all four channels, and Luma reads the matte over black, which is what a premultiplied texel already holds. `noise` ports `ADBE Noise` from `AEFX_Noise.metallib`: Bob Jenkins' 1997 integer mix over `(x, y, seed32)`, the two glibc-style LCG rounds, and the `0x7F80`/`0xFF` byte the IR XORs out of them — no table, no state, so it is seek-safe by construction. Reading the metallib's struct metadata rather than the deep dive's prose settles two of its open questions: `ADBE Noise-0002` is `inUseColorNoise` (a checkbox), not a Uniform/Gaussian popup, and the mystery seed floats are `inRandomSeed_High`/`_Low`, the two halves of one 32-bit seed. What the CPU puts in those halves per frame is still unprobed (plan Task 4.3), so the kernel seeds the low half with the frame index; the tests assert distribution and seek determinism, not parity. The shader declares `precision highp int` — the whole port rests on 32-bit wraparound and a fragment shader's integers default to mediump, which ESSL guarantees only 16 bits of. Both defs declare `capture: "self"`, which says a texture is needed and nothing about whose: `noise` on an adjustment layer is the same kernel, and the runtime reads the `backdrop` placement off the DOM. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * test(vfx): browser checks for backdrop capture, luma-matte and noise Task 2.6 Step 5 and Task 2.7's owed browser checks, folded into the existing puppeteer harness: an identity backdrop kernel composites two stacked blocks captured through a data-vfx-for sibling wrapper back over themselves (PSNR >= 40dB vs a plain-DOM control panel); a backdrop host outside its own clip window still keeps those blocks on the wrapper canvas's own bitmap via capturePassThrough; luma-matte's four modes are checked against alpha- and luma-varying matte strips at four sample points each; noise is checked for amount=0 identity, same-time determinism, and a changed pattern when its only seed (seek time) changes. Co-Authored-By: Claude Sonnet 5 <[email protected]> * feat(runtime): external displacement maps and visible ref sources Two gaps the exporter side found in the `ref` plumbing. 1. `displacement-map` had no `map` ref param, so the exporter's `params.map = "<element id>"` was dropped by `normalizeVfxParams` (it iterates the def) and the node silently self-displaced. `map` is now a ref param, bound to `u_src2` and selected by a new `u_hasSrc2` uniform the runtime sets from whether the ref resolved. Refs gain `optional: true` — empty `map` is the self-referential form every corpus instance uses, while an empty `matte` stays a loud failure — and a ref naming its own host resolves to self rather than capturing the same pixels twice (on a backdrop host it would otherwise have read the layers below as the map). 2. Interface v1.1 assumed a ref source is invisible in After Effects. retro-wave `Logo Anim` layer 5 is layer 4's displacement map AND an enabled, opaque layer, and the runtime cleared its wrapper's bitmap after the upload, deleting it from the frame. A wrapper marked `data-vfx-ref-visible` now keeps its bitmap and is captured at the REF's own box instead of the host's, so it paints at its own size and resolution. The three capture shapes are one `{ upload, keepBitmap }` mode: texture only, bitmap only (a backdrop pass-through), or both. Sampling is unaffected by the box choice, and the browser test proves it rather than assuming it: `drawElementImage` scales the element into the whole canvas, so a 320px-wide matte's four strips still land as four 40px bands in a 160px host. The v1 rule — a ref is scaled into the host's box, not placed in composition space — is unchanged. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * fix(runtime): capture a visible ref while its host is hidden; review nits Addresses PR #4330 review feedback (jrusso1020, CHANGES_REQUESTED). Blocking: both the engine-mode and preview-mode capture paths treated "host not paintable" as binary — a backdrop entry got a pass-through capture, everything else was skipped outright, including a ref source that lives on a different, independently-visible element (e.g. retro-wave's Logo Anim layer, which is simultaneously layer 4's displacement map and its own fully opaque visible layer). Adds visibleRefSources()/captureVisibleRefsOnly() and a unified FrameCaptureMode discriminator so a visible ref still gets captured even while its own host is hidden, on both paths. Non-blocking, addressed: - luma-matte's mandatory ref that names its own host now resolves to an explicit RefResolution {kind:"self"} and binds u_src2 to unit 0, instead of relying on an unbound sampler's implicit default. displacement-map's optional self-ref is unaffected (still folds into {kind:"none"}, using its existing u_hasSrc2 shader branch). - noise shader now enforces rgb<=a (valid premultiplied alpha) after adding noise, independent of u_clipping — documented why u_clipping is currently a permanent no-op on this runtime's 8-bit render targets. - added a hash-pinning test for hfJenkinsMix; documented, with a brute-force proof, which one of the reviewer's suggested mutations is unobservable within this fixture's reachable seed range. - fixed two misplaced doc comments. fallow flagged resolveVfxCapture/resolveRefSource as newly over the complexity threshold after this diff; extracted resolveEmptyRefParam() and captureHiddenEntry() to bring both back under. Co-Authored-By: Claude Sonnet 5 <[email protected]> * fix(runtime): capture a visible ref while a hidden BACKDROP host passes through Re-review of #4330 at b6d51bd: the visible-ref-while-hidden fix only covered non-backdrop hosts. captureHiddenEntry returned capturePassThrough(entry) for a backdrop and never reached captureVisibleRefsOnly; frameCaptureMode picked "passThrough" before considering refs and sourcesForFrame("passThrough") was [entry.src] alone. An adjustment layer whose displacement map is itself a visible layer still lost that layer outside the adjustment's window. - captureHiddenEntry runs the pass-through AND the visible-ref capture, OR-ing the results. - sourcesForFrame("passThrough") is the backdrop wrapper plus any visible refs, and capturePaintedHost's pass-through branch also calls captureVisibleRefsOnly. - Tests for the backdrop+visible-ref shape in both engine and preview modes (the reviewer's probe). Also closes the non-blocking display:none item: isPaintableHost(src.inner) missed a ref whose OWNING element is display:none, since display does not inherit — the preview path waited out the 2 s ceiling, then failed with a misleading 0×0 report. New isPaintableSource walks inner's ancestors for display:none (visibility inherits, so one read suffices there); used at both source-side sites. checkVisibility()/offsetParent are absent or always-null in the unit harness's DOM. Test added; verified it fails on the old inner-only check. Co-Authored-By: Claude Fable 5.1 <[email protected]> --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
1 parent d1048cf commit 84e36fc

11 files changed

Lines changed: 2522 additions & 127 deletions

File tree

‎packages/core/src/runtime/vfx.test.ts‎

Lines changed: 638 additions & 57 deletions
Large diffs are not rendered by default.

‎packages/core/src/runtime/vfx.ts‎

Lines changed: 627 additions & 62 deletions
Large diffs are not rendered by default.

‎packages/core/src/vfx.ts‎

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
import { FRACTAL_NOISE_FRAG } from "./vfx/fractalNoise.frag";
1212
import { DISPLACEMENT_MAP_FRAG } from "./vfx/displacementMap.frag";
13+
import { LUMA_MATTE_FRAG } from "./vfx/lumaMatte.frag";
14+
import { NOISE_FRAG } from "./vfx/noise.frag";
1315
import { WAVE_WARP_FRAG } from "./vfx/waveWarp.frag";
1416

1517
export const HF_VFX_ATTR = "data-vfx-chain";
@@ -67,6 +69,14 @@ export interface HfVfxRefParam {
6769
kind: "ref";
6870
key: string;
6971
label: string;
72+
/**
73+
* The kernel works without it. `displacement-map` reads its own pixels as
74+
* the map when `map` is empty (every corpus instance is self-referential),
75+
* while `luma-matte` without a matte has nothing to do, so a missing id
76+
* there is a loud failure. Spec amendment to v1.1, which had no optional
77+
* refs because its only ref was required.
78+
*/
79+
optional?: boolean;
7080
}
7181

7282
export type HfVfxParam = HfVfxNumberParam | HfVfxEnumParam | HfVfxBoolParam | HfVfxRefParam;
@@ -323,6 +333,14 @@ export const HF_VFX: readonly HfVfxDef[] = [
323333
capture: "self",
324334
frag: DISPLACEMENT_MAP_FRAG,
325335
params: [
336+
{
337+
kind: "ref",
338+
key: "map",
339+
label: "Displacement Map Layer",
340+
// Optional: empty means the AE default the corpus uses, a map layer
341+
// pointing at the layer itself, which `u_src` already holds.
342+
optional: true,
343+
},
326344
{
327345
kind: "enum",
328346
key: "useH",
@@ -385,6 +403,67 @@ export const HF_VFX: readonly HfVfxDef[] = [
385403
},
386404
],
387405
},
406+
{
407+
id: "luma-matte",
408+
label: "Matte",
409+
// Not one AE effect: the runtime form of every matte the exporter cannot
410+
// express as CSS — unsupported track-matte sources, stencils and
411+
// silhouettes, Set Matte. Which element is the source and which the matte
412+
// is the exporter's choice of what to wrap and what to name in `matte`.
413+
capture: "self",
414+
frag: LUMA_MATTE_FRAG,
415+
params: [
416+
{ kind: "ref", key: "matte", label: "Matte Layer" },
417+
{
418+
kind: "enum",
419+
key: "mode",
420+
label: "Matte Mode",
421+
options: [
422+
{ value: 1, label: "Alpha" },
423+
{ value: 2, label: "Alpha Inverted" },
424+
{ value: 3, label: "Luma" },
425+
{ value: 4, label: "Luma Inverted" },
426+
],
427+
default: 1,
428+
},
429+
],
430+
},
431+
{
432+
id: "noise",
433+
label: "Noise",
434+
ae: "ADBE Noise",
435+
// `self` on a content layer and `backdrop` on an adjustment layer are the
436+
// same kernel reading the same `u_src`; the runtime resolves which from
437+
// the DOM (a `data-vfx-for` wrapper), so the def declares only that a
438+
// texture is needed.
439+
capture: "self",
440+
frag: NOISE_FRAG,
441+
params: [
442+
{
443+
kind: "number",
444+
key: "amount",
445+
label: "Amount of Noise",
446+
unit: "%",
447+
min: 0,
448+
max: 400,
449+
step: 0.1,
450+
default: 0,
451+
animatable: true,
452+
},
453+
{
454+
kind: "bool",
455+
key: "useColorNoise",
456+
label: "Use Color Noise",
457+
default: false,
458+
},
459+
{
460+
kind: "bool",
461+
key: "clipping",
462+
label: "Clip Result Values",
463+
default: true,
464+
},
465+
],
466+
},
388467
] as const;
389468

390469
const BY_ID = new Map(HF_VFX.map((d) => [d.id, d]));

‎packages/core/src/vfx/displacementMap.frag.ts‎

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
/**
22
* `displacement-map` kernel — GLSL ES 3.00, capture `self`.
33
*
4-
* **Scope (v1, recorded rather than implied):** every corpus instance points
5-
* its Displacement Map Layer at **the layer itself** (retro-wave `Main/Text`
6-
* → idx 5 = Text; `Logo Anim/Text Site` and `Logo Anim/Logo` likewise), so
7-
* `u_src` is both the source and the map and no second capture is needed. A
8-
* map that is a *different* layer is out of v1 — it needs a second source,
9-
* which is Phase 2b's `ref`-param shape; the exporter emits a structural
10-
* capability for it instead.
4+
* **The map layer.** Every corpus instance points its Displacement Map Layer
5+
* at **the layer itself** (retro-wave `Main/Text` → idx 5 = Text; `Logo Anim/
6+
* Text Site` and `Logo Anim/Logo` likewise), so `u_src` is both the source and
7+
* the map and no second capture is needed — that is what the `map` ref param
8+
* being EMPTY means, and it stays the default. An external map layer is the
9+
* same kernel reading `u_src2`: the exporter names that element in `map` and
10+
* wraps it in its own `.hf-vfx-src` capture, and `u_hasSrc2` switches the
11+
* sampler. The two inputs are read at the same `v_uv`, so an external map is
12+
* scaled into the host's box (see `captureSource`), not placed in composition
13+
* space.
1114
*
1215
* Per axis: `d = (channel(map) − 0.5) · 2 · max`, then sample `u_src` at
1316
* `uv + d/u_size` with **clamp-to-transparent** edges (Edge = Off, the only
@@ -51,6 +54,10 @@ uniform vec2 u_size;
5154
uniform float u_t;
5255
uniform float u_fps;
5356
uniform sampler2D u_src;
57+
uniform sampler2D u_src2;
58+
// 1 when the map ref named another element, 0 when the map is the layer
59+
// itself. Set by the runtime for every pass, from whether a ref resolved.
60+
uniform float u_hasSrc2;
5461
uniform float u_useH;
5562
uniform float u_maxH;
5663
uniform float u_useV;
@@ -78,7 +85,7 @@ float hfMapChannel(vec4 premultiplied, float selector) {
7885
}
7986
8087
void main() {
81-
vec4 mapTexel = texture(u_src, v_uv);
88+
vec4 mapTexel = u_hasSrc2 > 0.5 ? texture(u_src2, v_uv) : texture(u_src, v_uv);
8289
float h = hfMapChannel(mapTexel, u_useH);
8390
float v = hfMapChannel(mapTexel, u_useV);
8491
vec2 d = vec2((h - 0.5) * 2.0 * u_maxH, (v - 0.5) * 2.0 * u_maxV);
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
/**
2+
* `luma-matte` kernel — GLSL ES 3.00, capture `self` plus a `ref` second
3+
* source.
4+
*
5+
* **What it ports.** Not a single After Effects effect: this is the runtime
6+
* form of every matte the exporter cannot express as CSS — a track matte whose
7+
* source layer is unsupported (`matte-source-unsupported:*`), a stencil or
8+
* silhouette (`stencil-*`), and Set Matte. All of them are the same
9+
* per-pixel operation, `out = src · coverage(matte)`, differing only in which
10+
* element is the source and which is the matte. The exporter decides that by
11+
* choosing which element the host wraps and which the `matte` ref names; a
12+
* stencil is this kernel with the host's own content as the matte.
13+
*
14+
* **Coverage.** `src` arrives premultiplied, so scaling all four channels by a
15+
* single coverage value is the whole operation — no unpremultiply/repremultiply
16+
* round trip, and a coverage of 0 yields a genuinely empty pixel rather than a
17+
* black one.
18+
*
19+
* - Alpha (1) / Alpha Inverted (2): the matte's alpha.
20+
* - Luma (3) / Luma Inverted (4): the matte's luminance **composited over
21+
* black**, which is what the premultiplied texel already holds — a matte that
22+
* is 50 % grey at 50 % opacity reads as 0.25, matching After Effects, where a
23+
* luma matte's transparent regions are black rather than ignored.
24+
*
25+
* Rec.601 weights, shared with `displacement-map`'s Luminance channel selector
26+
* so the two agree on what "luminance" means.
27+
*
28+
* **Out of scope in v1, recorded rather than implied:** the matte is sampled at
29+
* the host's own `v_uv`, so the runtime captures it into the host's box (see
30+
* `captureSource`). After Effects places a matte layer in composition space
31+
* with its own transform; a matte whose box differs from the layer's is
32+
* therefore stretched here, not positioned. Every corpus matte is a
33+
* full-frame sibling of its layer, where the two agree.
34+
*/
35+
36+
import { DISPLACEMENT_MAP_CONSTANTS } from "./displacementMap.frag";
37+
38+
const { lumaR, lumaG, lumaB } = DISPLACEMENT_MAP_CONSTANTS;
39+
40+
/** The `mode` enum, named once so the def, the shader and the reference agree. */
41+
export const LUMA_MATTE_MODES = {
42+
alpha: 1,
43+
alphaInverted: 2,
44+
luma: 3,
45+
lumaInverted: 4,
46+
} as const;
47+
48+
export const LUMA_MATTE_FRAG = `#version 300 es
49+
precision highp float;
50+
51+
in vec2 v_uv;
52+
out vec4 fragColor;
53+
54+
uniform vec2 u_size;
55+
uniform float u_t;
56+
uniform float u_fps;
57+
uniform sampler2D u_src;
58+
uniform sampler2D u_src2;
59+
uniform float u_mode;
60+
61+
// The matte texel is premultiplied, so its rgb is already "over black" — the
62+
// composite After Effects reads a luma matte through.
63+
float hfCoverage(vec4 matte, float mode) {
64+
if (mode < 1.5) return matte.a;
65+
if (mode < 2.5) return 1.0 - matte.a;
66+
float luma = dot(matte.rgb, vec3(${lumaR}, ${lumaG}, ${lumaB}));
67+
if (mode < 3.5) return luma;
68+
return 1.0 - luma;
69+
}
70+
71+
void main() {
72+
vec4 src = texture(u_src, v_uv);
73+
vec4 matte = texture(u_src2, v_uv);
74+
fragColor = src * clamp(hfCoverage(matte, u_mode), 0.0, 1.0);
75+
}
76+
`;
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
import { describe, expect, it } from "vitest";
2+
import { LUMA_MATTE_FRAG, LUMA_MATTE_MODES } from "./lumaMatte.frag";
3+
import { lumaMatteCoverageRef, lumaMatteSampleRef, type Rgba } from "./refs/lumaMatte";
4+
import { getVfxDef, normalizeVfxParams } from "../vfx";
5+
6+
/** An opaque mid-grey source, premultiplied like the capture texture. */
7+
const SRC: Rgba = { r: 0.4, g: 0.6, b: 0.8, a: 1 };
8+
const OPAQUE_WHITE: Rgba = { r: 1, g: 1, b: 1, a: 1 };
9+
const CLEAR: Rgba = { r: 0, g: 0, b: 0, a: 0 };
10+
11+
describe("luma-matte def", () => {
12+
it("is registered as a capturing kernel with a ref param and the real fragment source", () => {
13+
const def = getVfxDef("luma-matte")!;
14+
const ref = def.params.find((p) => p.kind === "ref");
15+
expect(def.capture).toBe("self");
16+
expect(ref?.key).toBe("matte");
17+
expect(def.frag).toBe(LUMA_MATTE_FRAG);
18+
expect(LUMA_MATTE_FRAG.startsWith("#version 300 es")).toBe(true);
19+
// The second source is what makes this kernel possible at all.
20+
expect(LUMA_MATTE_FRAG).toContain("uniform sampler2D u_src2;");
21+
});
22+
23+
it("keeps a ref param's element id and falls back to empty for a non-string", () => {
24+
expect(normalizeVfxParams("luma-matte", { matte: "rw-matte-1" })["matte"]).toBe("rw-matte-1");
25+
expect(normalizeVfxParams("luma-matte", { matte: 7 })["matte"]).toBe("");
26+
expect(normalizeVfxParams("luma-matte", {})["matte"]).toBe("");
27+
});
28+
29+
it("normalizes an unknown mode back to Alpha", () => {
30+
expect(normalizeVfxParams("luma-matte", { mode: 9 })["mode"]).toBe(LUMA_MATTE_MODES.alpha);
31+
});
32+
});
33+
34+
describe("lumaMatteCoverageRef", () => {
35+
it("reads the matte's alpha, and its complement when inverted", () => {
36+
const matte: Rgba = { r: 0, g: 0, b: 0, a: 0.25 };
37+
expect(lumaMatteCoverageRef(matte, LUMA_MATTE_MODES.alpha)).toBe(0.25);
38+
expect(lumaMatteCoverageRef(matte, LUMA_MATTE_MODES.alphaInverted)).toBe(0.75);
39+
});
40+
41+
it("reads luma as the matte composited over black", () => {
42+
// Premultiplied: a 50 % grey at 50 % opacity carries rgb 0.25, and After
43+
// Effects' luma matte sees exactly that — transparent is black, not absent.
44+
const half: Rgba = { r: 0.25, g: 0.25, b: 0.25, a: 0.5 };
45+
expect(lumaMatteCoverageRef(half, LUMA_MATTE_MODES.luma)).toBeCloseTo(0.25, 12);
46+
expect(lumaMatteCoverageRef(half, LUMA_MATTE_MODES.lumaInverted)).toBeCloseTo(0.75, 12);
47+
});
48+
49+
it("weights the channels the way the Luminance channel selector does", () => {
50+
const red: Rgba = { r: 1, g: 0, b: 0, a: 1 };
51+
const green: Rgba = { r: 0, g: 1, b: 0, a: 1 };
52+
const blue: Rgba = { r: 0, g: 0, b: 1, a: 1 };
53+
const luma = (m: Rgba): number => lumaMatteCoverageRef(m, LUMA_MATTE_MODES.luma);
54+
expect(luma(green)).toBeGreaterThan(luma(red));
55+
expect(luma(red)).toBeGreaterThan(luma(blue));
56+
expect(luma(red) + luma(green) + luma(blue)).toBeCloseTo(1, 12);
57+
});
58+
});
59+
60+
describe("lumaMatteSampleRef", () => {
61+
it("is the identity under a fully opaque alpha matte", () => {
62+
expect(lumaMatteSampleRef(SRC, OPAQUE_WHITE, 0, { mode: LUMA_MATTE_MODES.alpha })).toEqual(SRC);
63+
});
64+
65+
it("empties the pixel — alpha included — where the matte does not cover", () => {
66+
expect(lumaMatteSampleRef(SRC, CLEAR, 0, { mode: LUMA_MATTE_MODES.alpha })).toEqual({
67+
r: 0,
68+
g: 0,
69+
b: 0,
70+
a: 0,
71+
});
72+
});
73+
74+
it("scales every channel by one coverage, keeping the pixel premultiplied", () => {
75+
const out = lumaMatteSampleRef(
76+
{ r: 0.5, g: 0.5, b: 0.5, a: 0.5 },
77+
{ r: 0, g: 0, b: 0, a: 0.5 },
78+
0,
79+
{ mode: LUMA_MATTE_MODES.alpha },
80+
);
81+
// rgb <= a before, so rgb <= a after: a scalar multiply cannot break it.
82+
expect(out).toEqual({ r: 0.25, g: 0.25, b: 0.25, a: 0.25 });
83+
});
84+
85+
it("inverts, so an opaque matte hides the layer under Alpha Inverted", () => {
86+
const out = lumaMatteSampleRef(SRC, OPAQUE_WHITE, 0, {
87+
mode: LUMA_MATTE_MODES.alphaInverted,
88+
});
89+
expect(out).toEqual({ r: 0, g: 0, b: 0, a: 0 });
90+
});
91+
92+
it("is a pure function of its inputs", () => {
93+
const at = (): Rgba => lumaMatteSampleRef(SRC, OPAQUE_WHITE, 0.37, { mode: 3 });
94+
expect(at()).toEqual(at());
95+
});
96+
});

0 commit comments

Comments
 (0)