diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-17 01:10:28 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-17 12:15:01 -0300 |
| commit | 9d10fc880bf4e62f8421d351ce15bddeec075322 (patch) | |
| tree | c452f42bb3c6fa94033eff9fad9851106f2a024c /src/sketch/root.zig | |
| parent | d302e4887c4c3fa534fec73a2141d3dc78436ccd (diff) | |
| download | sketchbook-9d10fc880bf4e62f8421d351ce15bddeec075322.tar.gz sketchbook-9d10fc880bf4e62f8421d351ce15bddeec075322.zip | |
examples: manual, Figure 2-1 of the Intel SDM comes alive, as a talk
examples/manual.zig is a live scene with pauses, played by the stock
player: page 31 of the SDM's Vol. 2 (Typst's import of the PDF, every
glyph a shape) fades in on paper beside a title; the camera closes on
Figure 2-1, the instruction format, while the rest of the page greys
and its footnotes go; each field (Prefixes, Opcode, ModR/M, SIB,
Displacement, Immediate) is tinted and glows in turn; 83 C0 01, add
eax, 1, is written below; each byte flies into its field as the fields
it has none for fade; C0 morphs down the arrow into the ModR/M byte's
boxes as 11000000, which splits into 11, 000 and 000 over Mod, Reg and
R/M, each with what it says (direct, /0 ADD, EAX); and the camera goes
back to the page, filled in. Twelve steps, 18 s played straight.
The labels, the ModR/M boxes, the figure and its footnotes are parts of
the page, by rectangles in the page's units read off pdftotext -bbox
(points to units: (pt - 306) * 4/3, (pt - 396) * 4/3) and checked with
the guides; each tint is the s.rect of its label's rectangle. The bits
are parts of a Typst object, cut by character (0.6 em of DejaVu Sans
Mono at 14 pt).
The PDF is never committed. build.zig's -Dmanual names it, by default
~/01-resources/intel-devref-ii.pdf; when the file is not there the
scene is one line saying how to build with it. zig build manual plays
it in a window. test/manual.script, run by zig build test (and
test-manual) only when the file is there, steps through the talk with
pixel checks (the paper, a tint where it should be and not where it
should not, a step back) and exports it twice at 10 fps, the same
frames both times.
zig build bench also times the manual's page (its one #image source,
when the build has the PDF), with a budget of its own for a drawing of
over 1000 shapes: parse under 25 ms, CPU draw under 10, GPU record under
4, at 1280x720. Measured: 6.4, 1.9 and 0.77 ms on a quiet run; 14.8, 3.5
and 1.4 at load average 34; once 28.6 ms to parse, at that load, which
failed it (the simple objects' 1 ms is as sensitive: 0.87 ms then). The
manual's simple objects are not benched: a two-glyph 83 fitted to the
whole canvas takes 1.1-1.2 ms on the CPU.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'src/sketch/root.zig')
0 files changed, 0 insertions, 0 deletions
