From dbe979c8f963a809ad660c4aba6f8aea6b8cd8af Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 4 Aug 2026 19:06:22 +0000 Subject: [PATCH 1/2] Initial plan From 5f4bb0f2e78abe457fc240493e30a4ca96ed032d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 4 Aug 2026 19:09:08 +0000 Subject: [PATCH 2/2] fix: use BI_BITFIELDS with RGB565 masks in BMP writer to fix green channel corruption Co-authored-by: bdbarnett <127794626+bdbarnett@users.noreply.github.com> --- lib/pygraphics/_bmp565.py | 21 +++++++++++++++++---- src/gfx_bmp565.c | 18 +++++++++++++----- 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/lib/pygraphics/_bmp565.py b/lib/pygraphics/_bmp565.py index 5605703..9c0dece 100644 --- a/lib/pygraphics/_bmp565.py +++ b/lib/pygraphics/_bmp565.py @@ -29,6 +29,9 @@ def read_bmp565_header(f): bpp = struct.unpack("width) < 0 || write_u32_le(f, (uint32_t)bmp->height) < 0 || write_u16_le(f, 1) < 0 || write_u16_le(f, GFX_BMP565_BPP) < 0 - || fwrite("\x00\x00\x00\x00", 1, 4, f) != 4 + || write_u32_le(f, 3) < 0 /* BI_BITFIELDS */ || write_u32_le(f, (uint32_t)data_size) < 0 - || fwrite("\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 1, 16, f) != 16) { + || fwrite("\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 1, 16, f) != 16 + || write_u32_le(f, 0xF800) < 0 /* R mask */ + || write_u32_le(f, 0x07E0) < 0 /* G mask */ + || write_u32_le(f, 0x001F) < 0) { /* B mask */ fclose(f); return -1; }