diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-29 09:17:19 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:16 -0300 |
| commit | ab31baff1fbfd38180be8eed921b97082184f185 (patch) | |
| tree | d195c6804f8f7d9d82cea1d7445d0fec2f7482db /src/draw.zig | |
| parent | 99149638c2b89fd134131d081bfd5fc8f967c53e (diff) | |
| download | pardes-ab31baff1fbfd38180be8eed921b97082184f185.tar.gz pardes-ab31baff1fbfd38180be8eed921b97082184f185.zip | |
T3: PanelCurtain wipes behind a soft edge two cells wide
The curtain's glyph slide becomes a wipe: the new grid behind a head that
crosses the pane, the old ahead, and between them two columns whose colours
step from the old ground to the new in OKLab (CharSource.edge). Only the
head's columns change from frame to frame.
Diffstat (limited to 'src/draw.zig')
| -rw-r--r-- | src/draw.zig | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/draw.zig b/src/draw.zig index 93d5b2d9..b0b16e12 100644 --- a/src/draw.zig +++ b/src/draw.zig @@ -723,6 +723,7 @@ fn composedCell( return switch (animation.charSource(track, col - area.x0, row - area.y0, area)) { .old => canonical.previous_cells[index], .byte => |byte| withByte(canonical.cells[index], byte), + .edge => |weight| towardGround(canonical.cells[index], canonical.previous_cells[index].style.bg, weight), // Churn belongs on the glyph, not on the pane's empty space, and it // borrows whichever side of the diff actually has one. .churn => |byte| blk: { @@ -749,6 +750,25 @@ fn composedCell( }; } +/// A cell with its ink and ground drawn `weight` of the way toward another +/// ground, in OKLab. A palette or default colour cannot be mixed, so the +/// ground steps over at the halfway point instead. +fn towardGround(cell: Cell, ground: Color, weight: f32) Cell { + var out = cell; + const to = switch (ground) { + .rgb => |rgb| rgb, + .default, .index => return if (weight >= 0.5) blk: { + out.style.bg = ground; + break :blk out; + } else out, + }; + inline for (.{ &out.style.fg, &out.style.bg }) |color| switch (color.*) { + .rgb => |rgb| color.* = .{ .rgb = colors.mixOklab(rgb, to, weight) }, + .default, .index => {}, + }; + return out; +} + fn withByte(cell: Cell, byte: u8) Cell { var out = cell; out.text[0] = byte; |
