From 0471c7bdf91ea342f271bd155a873628ada9a82b Mon Sep 17 00:00:00 2001 From: "Jeffrey C. Ollie" Date: Sun, 20 Sep 2026 01:01:37 -0500 Subject: [PATCH] A painted panel frames every key A photograph of an Original V2 showing the panel through its odd-numbered keys had stripes intruding at the edges of the numbered ones as well, which they should not have had. The same thing had shown up on a Neo a while earlier and been written off as the key cap catching light from its neighbours. It is not. Paint the panel green, write a flat black image to every key, and every key keeps a green border -- on an Original V2, a Neo and a Plus alike. The key cap shows slightly more of the panel than the key image covers. Nothing here is doing it. The image occupies its documented size exactly; the cap is simply wider than it and shows some of the gap around it. A Classic panel is 480x272 carrying fifteen keys of 72x72, which leaves a hundred and twenty pixels across and fifty-six down for margins and gaps, and node-elgato-stream-deck models a key's bounds as exactly its image size with twenty-five pixel gaps between. Neither it nor Elgato's documentation says any of that is visible. Worth knowing rather than worth fixing, and probably what a background is meant to look like: whatever is on the panel becomes a frame around every key, so artwork drawn key by key sits in it rather than against black. A key that has to be covered edge to edge needs the panel behind it painted too. `zig build probe -- --inset` is the test. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01WUvf9zwMsPMwUDkUFViFbu --- README.md | 20 +++++++++++++++ src/Panel.zig | 21 ++++++++++++++++ tools/probe.zig | 66 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 107 insertions(+) diff --git a/README.md b/README.md index ee75c6f..0ac48ce 100644 --- a/README.md +++ b/README.md @@ -484,6 +484,26 @@ Confirmed on a Stream Deck Original V2, a Neo and a Plus: panel painted with diagonal stripes, key images drawn over the even-numbered keys only, and the odd-numbered keys show the stripes. +### A painted panel frames every key + +A key cap shows slightly more of the panel than the key image covers, so a +painted panel is visible as a border around *every* key, not only the ones left +alone. Paint the panel green, write a flat black image to every key, and all of +them keep a green edge — confirmed on the same three models. + +That is the physical cap rather than anything this library does: the image +occupies its documented size exactly, and the cap is wider than it, so it also +shows some of the gap around it. A Classic panel is 480×272 carrying fifteen +72×72 keys, which leaves 120 pixels across and 56 down for margins and gaps. +Neither Elgato's documentation nor either reference implementation mentions +that any of it is visible — node-elgato-stream-deck models a key's bounds as +exactly its image size. + +It is worth knowing rather than worth fixing, and it is probably what a +background is meant to look like: whatever is on the panel becomes a frame +around every key, so artwork drawn key by key sits in it rather than against +black. If you want a key covered edge to edge, paint the panel behind it too. + ### Why it is the application's feature and not the device's Elgato's own description gives it away three times over. A background is set by diff --git a/src/Panel.zig b/src/Panel.zig index 776064d..cf8504c 100644 --- a/src/Panel.zig +++ b/src/Panel.zig @@ -24,6 +24,27 @@ //! the foreground is transparent" means nothing more than not writing //! that key. Confirmed on an Original V2, a Neo and a Plus. //! +//! ## A painted panel frames every key +//! +//! A key cap shows slightly more of the panel than the key image +//! covers. Paint the panel green and write a flat black image to every +//! key, and every key keeps a green border -- confirmed on an Original +//! V2, a Neo and a Plus, all three. +//! +//! That is the physical cap rather than anything this library does. +//! The image occupies its documented size exactly, and the caps are +//! wider than it, so they also show some of the gap around it: a +//! Classic panel is 480x272 carrying fifteen keys of 72x72, which +//! leaves a hundred and twenty pixels across and fifty-six down for +//! margins and gaps, and node-elgato-stream-deck puts twenty-five pixel +//! gaps between the keys and eleven before the first column. Neither it +//! nor Elgato's documentation mentions that any of that is visible. +//! +//! It is worth knowing rather than worth fixing, and it is probably +//! what a background is supposed to look like: whatever is on the panel +//! becomes a border around every key, so artwork drawn key by key sits +//! in a frame of it rather than against black. +//! //! `setBackground` further down is a different thing that happens to //! share the name: a real HID command for storing an image *in* the //! device, which nothing here has ever been able to make visible. diff --git a/tools/probe.zig b/tools/probe.zig index a8df49b..76bf101 100644 --- a/tools/probe.zig +++ b/tools/probe.zig @@ -39,6 +39,7 @@ pub fn main(init: std.process.Init) !void { var wake = false; var transparent = false; var composite = false; + var inset = false; var args = init.minimal.args.iterate(); _ = args.next(); while (args.next()) |arg| { @@ -54,6 +55,7 @@ pub fn main(init: std.process.Init) !void { if (std.mem.eql(u8, arg, "--wake")) wake = true; if (std.mem.eql(u8, arg, "--transparent")) transparent = true; if (std.mem.eql(u8, arg, "--composite")) composite = true; + if (std.mem.eql(u8, arg, "--inset")) inset = true; } var decks: streamdeck.Enumerator = undefined; @@ -66,6 +68,20 @@ pub fn main(init: std.process.Init) !void { try out.print("\n=== {t} ===\n", .{sd.type}); + // Paint the panel a bright flat colour and then cover every key + // with a flat black key image. + // + // Both a Neo and an Original V2 have shown panel content at the + // edges of a key that had an image written to it. If the key + // image does not quite fill the aperture the key looks onto, + // every key here keeps a bright border. If it fills it exactly, + // every key goes black and what was seen before was light + // bleeding between the physical key caps. + if (inset) { + try tryInset(io, alloc, &sd, out); + continue; + } + // What Elgato's application calls a background, done with the // commands this library already has: paint the panel, then draw // key images over only the keys that want one. A key left alone @@ -268,6 +284,56 @@ pub fn main(init: std.process.Init) !void { try out.flush(); } +/// Panel bright, every key flat black. +fn tryInset( + io: std.Io, + alloc: std.mem.Allocator, + sd: *const streamdeck.StreamDeck, + out: *std.Io.Writer, +) !void { + const panel = sd.panel.getFeature() orelse { + try out.print(" no writable panel\n", .{}); + return; + }; + + try sd.setBrightness(io, 80); + + var surface = (try sd.panel.blankImage(alloc)).?; + defer surface.deinit(alloc); + for (0..panel.height) |y| { + for (0..panel.width) |x| { + surface.putPixel(@intCast(x), @intCast(y), .{ .rgb = .{ + .r = 0, + .g = 255, + .b = 0, + } }); + } + } + try sd.panel.setImage(io, alloc, surface); + + const feature = sd.keys.getImageFeature(0) orelse return; + var black = try image_blank(alloc, feature.width, feature.height); + defer black.deinit(alloc); + // `blankImage` is already black; say so rather than relying on it. + for (0..feature.height) |y| { + for (0..feature.width) |x| { + black.putPixel(@intCast(x), @intCast(y), .{ .rgb = .{ .r = 0, .g = 0, .b = 0 } }); + } + } + + var drawn: usize = 0; + for (0..sd.keys.count()) |i| { + const key: u8 = @intCast(i); + if (sd.keys.getImageFeature(key) == null) continue; + sd.keys.setImage(io, alloc, key, black) catch continue; + drawn += 1; + } + + try out.print(" panel green {d}x{d}, {d} key(s) filled black {d}x{d}\n", .{ + panel.width, panel.height, drawn, feature.width, feature.height, + }); +} + /// Paint the panel, then draw over every other key. fn tryComposite( io: std.Io, -- knotmirror 0.0.1