Skip to content

Commit cea8aa8

Browse files
feat(cli): judge text behind a transparent video by its decoded alpha in check (#5657)
* feat(cli): judge text behind a transparent video by its decoded alpha in check The layout audit treated every <video> as opaque over its whole box, so a caption between footage and a remove-background cutout always failed text_occluded and needed data-layout-allow-occlusion, which also hid a word the subject's head fully covered. check now draws the video's current (seeked) frame into one reused, downscaled scratch canvas, once per sample and only for a video a text probe lands under. A fully opaque frame keeps today's behaviour. A frame with transparency is judged per rendered word against its alpha: partial cover is an info finding carrying the most covered word's share, and a word 80% hidden or two neighbouring words each half hidden is an error. A frame that cannot be read falls back to opaque with a video_alpha_unread info note. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * test(cli): serve the video-alpha fixtures from memory, not request paths Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * fix(cli): check finds words under narrow, mirrored or backed cutouts Review follow-ups on #5657: - A matte the probe walk passes over, even at clear-alpha points, now triggers the per-word check, so a feature between two probe columns (an arm, a mic stand) still fails the word it hides. - Mirrored videos and images map viewport points through the flip; a rotated, skewed or 3D-transformed video falls back to opaque with video_alpha_unread. - A video with an opaque CSS background keeps its whole box occluding. - cli.mdx lists every unread cause and why a fully transparent frame is one. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
1 parent 08ee1bd commit cea8aa8

10 files changed

Lines changed: 1095 additions & 25 deletions

File tree

‎docs/guides/remove-background.mdx‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@ The plate keeps the original surroundings and leaves a transparent
8484
person-shaped hole. It is not an inpainted empty background. Place an opaque
8585
graphic or scene beneath the hole, then place `subject.webm` above it.
8686

87+
`hyperframes check` judges text behind the cutout by the cutout's own alpha at
88+
each sample time. A word partly behind the subject is reported as info with the
89+
share it hides; a word 80% hidden, or two neighbouring words each half hidden,
90+
is an error. You do not need `data-layout-allow-occlusion` for this layering.
91+
8792
## Know when it will work well
8893

8994
The included model is designed for people. It works best with a clear human

‎docs/packages/cli.mdx‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -857,6 +857,21 @@ cover every finding from the full check.
857857
configured seek samples falls inside `--range`; a requested gate never silently
858858
passes without running.
859859

860+
Text under a `<video>` is judged by the frame the video shows at that sample.
861+
An opaque video covers its whole box, as an opaque image does. A video with
862+
transparency, such as a `remove-background` cutout, covers only where its
863+
alpha is: a word partly behind the subject is an info finding whose
864+
`coveredFraction` is the most covered word's share, and a word 80% hidden or two
865+
neighbouring words each half hidden are an error. A CSS background on the video
866+
still covers its whole box, and a mirrored video (`scaleX(-1)`) is read on the
867+
side it is painted. When a video's frame cannot be read, the audit treats the
868+
video as opaque and adds a `video_alpha_unread` info finding saying why: no frame
869+
decoded yet, the seek still landing, a cross-origin source, no frame size, a
870+
rotated, skewed or 3D-transformed video, or a frame that reads back fully
871+
transparent. A fully transparent frame is treated as unread on purpose, since a
872+
failed draw looks the same; mark text that sits under a cutout before its subject
873+
enters with `data-layout-allow-occlusion`.
874+
860875
Contrast failures are errors, and each one reports the sampled foreground and
861876
background colours, the measured ratio against the required one, and a
862877
compliant colour you could use instead.

‎docs/prompting/rules-and-anti-patterns.mdx‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,10 @@ Two more ways an SVG "line draws itself" effect (animated `strokeDasharray` / `s
6464
`hyperframes check` flags a text block covered by another element as `text_occluded`, and
6565
two attributes waive it: `data-layout-allow-overlap` for intentional layering, and
6666
`data-layout-allow-occlusion` for something deliberately painted over type. Both are
67-
legitimate — a caption designed to sit behind a matted subject needs one.
67+
legitimate. A caption behind a transparent `<video>` cutout needs neither: `check` reads the
68+
cutout's decoded alpha at each sample, reports how much of each word the subject covers as
69+
info, and fails only a word that is 80% hidden or two neighbouring words that are each half
70+
hidden.
6871

6972
Two things about them are worth knowing before you reach for either:
7073

0 commit comments

Comments
 (0)