From f4eb75a1d941d8f6629e03a5313c04bf8ebf189e Mon Sep 17 00:00:00 2001 From: "Adam D. Ruppe" Date: Mon, 15 Sep 2025 09:21:48 -0400 Subject: [PATCH] load this one bmp irc sent me --- bmp.d | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/bmp.d b/bmp.d index 61f6aec..ff7f4b7 100644 --- a/bmp.d +++ b/bmp.d @@ -421,10 +421,18 @@ MemoryImage readBmpIndirect(scope void delegate(void*, size_t) fread, bool lookF return img; } else { - if (compression != 0) throw new Exception("invalid bitmap compression"); + if (compression != 0 && compression != 3) throw new Exception("unsupported bitmap compression"); // true color image auto img = new TrueColorImage(width, height); + if(compression == 3) + foreach(idx; 0 .. 3) { + // so tbh I don't know what this actually is, it looks like an rgb mask, but why is it here? + // is this common or just the one file i happen to have? + // is there some header byte im missing? + read4(); + } + // no palette, so straight into the data int offsetStart = width * height * 4; int bytesPerPixel = 4;