NetDeck: transparent color-key dither for the freeze tint
- stampImage16_P(): PROGMEM 16bpp stamp with color-key transparency (ND_TRANS16 pixels leave the destination untouched) — TFT_eSprite has no transparent pushImage variant, so it composites via drawPixel on both backends (sprite RAM on device, host framebuffer in the emulator) - shim: pgm_read_byte/word/dword macros (flash is memory-mapped on host and ESP32 alike) - pattern: 2px checker of black dots + transparent cells — half-visible dither, map/units stay readable underneath - E2E now proves the transparency itself: wall pixels survive under transparent cells, dots render black, key color never rendered
This commit is contained in:
@@ -12,6 +12,9 @@
|
||||
// Host flash is memory-mapped, so flash-resident data needs no special read
|
||||
// macro (same as on ESP32; real AVR pgm_read is not used by our sketches).
|
||||
#define PROGMEM
|
||||
#define pgm_read_byte(addr) (*(const unsigned char *)(addr))
|
||||
#define pgm_read_word(addr) (*(const unsigned short *)(addr))
|
||||
#define pgm_read_dword(addr) (*(const unsigned long *)(addr))
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstddef>
|
||||
|
||||
@@ -106,6 +106,7 @@ TEST(e2e/boot_and_controls)
|
||||
schedule(2.2, 'p'); // -> Network view
|
||||
schedule(2.6, ' '); // freeze OFF
|
||||
schedule(3.0, 'r'); // reset (re-pauses)
|
||||
schedule(3.4, 'p'); // back to Cameras (full map)
|
||||
test::serialClear();
|
||||
EXPECT(pumpFor(4.5)); // run the inputs through loop()
|
||||
EXPECT(test::serialHas("[key] view -> NETWORK"));
|
||||
@@ -114,12 +115,13 @@ TEST(e2e/boot_and_controls)
|
||||
|
||||
// HUD separator rendered across the top of the HUD bar
|
||||
EXPECT(test::pixelIs565(160, nd::HUD_Y, nd::C_BORDER));
|
||||
// paused -> checkered freeze tint: 2px checker of black + dark teal
|
||||
// P(x,y): black when ((x>>1)+(y>>1)) is even
|
||||
EXPECT(test::pixelIs565(50, 0, 0x1F1F)); // (25+0) odd -> teal
|
||||
EXPECT(test::pixelIs565(50, 2, 0x0000)); // (25+1) even -> black
|
||||
EXPECT(test::pixelIs565(52, 0, 0x0000)); // (26+0) even -> black
|
||||
EXPECT(!test::pixelIs565(52, 0, 0x1F1F));
|
||||
// paused -> dithered freeze tint with color-key transparency:
|
||||
// black dots where ((x>>1)+(y>>1)) is even, map shows through elsewhere
|
||||
EXPECT(test::pixelIs565(50, 2, 0x0000)); // dither dot drawn
|
||||
EXPECT(test::pixelIs565(52, 0, 0x0000)); // dither dot drawn
|
||||
EXPECT(test::pixelIs565(50, 0, nd::C_WALL)); // transparent: wall pixel
|
||||
EXPECT(test::pixelIs565(50, 4, nd::C_WALL)); // survives untouched
|
||||
EXPECT(!test::pixelIs565(50, 0, 0x1F1F)); // key color never rendered
|
||||
}
|
||||
|
||||
TEST(e2e/network_journey)
|
||||
|
||||
Reference in New Issue
Block a user