From e68b7a5edeb2f6c1a4830d90d5b54a8140afcea3 Mon Sep 17 00:00:00 2001 From: morkt Date: Thu, 7 Sep 2023 12:32:52 +0400 Subject: [PATCH] (BMP): inverted alpha channel. commented out for now, as there's no way to correctly recognize it. --- GameRes/ImageBMP.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/GameRes/ImageBMP.cs b/GameRes/ImageBMP.cs index 9c8af046..8ee0c054 100644 --- a/GameRes/ImageBMP.cs +++ b/GameRes/ImageBMP.cs @@ -220,6 +220,13 @@ namespace GameRes file.Read (pixels, dst, stride); for (int x = 3; !has_alpha && x < stride; x += 4) has_alpha = pixels[dst+x] != 0; + /* // sometimes alpha channel is inverted + for (int x = 3; x < stride; x += 4) + { + pixels[dst+x] ^= 0xFF; + has_alpha = has_alpha || pixels[dst+x] != 0; + } + */ } PixelFormat format = has_alpha ? PixelFormats.Bgra32 : PixelFormats.Bgr32; return ImageData.Create (info, format, null, pixels, stride);