╭ changed ───────╮ │src/ui/Title.zig│ ╰────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────╮ │12 │ │13 const Self = @This(); │ │14 │ │15 -pub fn init(arena: *std.heap.ArenaAllocator, orig_content: []const u8) !Self { │ │15 +pub const Style = enum { solid, scanlines }; │ │16 + │ │17 +pub fn init(arena: *std.heap.ArenaAllocator, orig_content: []const u8, style: Style) !Self {│ │18 return .{ │ │17 - .content = try renderTitle(arena.allocator(), orig_content), │ │19 + .content = try renderTitle(arena.allocator(), orig_content, style), │ │20 }; │ │21 } │ │22 │ ╰────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────╮ │62 } │ │63 }; │ │64 │ │63 -// 3-row sextant title font with row-aligned dither. │ │65 +// 3-row sextant title font, optionally with scanlines. │ │66 // │ │67 // each glyph is a 6x9 sub-pixel bitmap that renders as a 3x3 grid of │ │68 // sextant-block characters (U+1FB00-1FB3B). the four 2x3 patterns that│ ╰───────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────╮ │522 }; │ │523 } │ │524 │ │523 -fn renderTitle(allocator: std.mem.Allocator, input: []const u8) ![]const u8 { │ │525 +fn renderTitle(allocator: std.mem.Allocator, input: []const u8, style: Style) ![]const u8 {│ │526 var rows: [3]std.ArrayList(u8) = .{ .empty, .empty, .empty }; │ │527 defer for (&rows) |*r| r.deinit(allocator); │ │528 │ ╰────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────╮ │530 for (input) |c| { │ │531 const glyph = glyphFor(c) orelse continue; │ │532 │ │531 - // row-aligned dither: keep on-pixels only at even bitmap rows.│ │533 + // scanlines: keep on-pixels only at even bitmap rows. │ │534 var kept: [9][6]bool = std.mem.zeroes([9][6]bool); │ │535 for (0..9) |r| { │ │534 - if (r % 2 != 0) continue; │ │536 + if (style == .scanlines and r % 2 != 0) continue; │ │537 for (0..6) |col| { │ │538 kept[r][col] = glyph[r][col] == '#'; │ │539 } │ ╰────────────────────────────────────────────────────────────────────────────╯