fix support of 4 BPP

This commit is contained in:
ManicSteiner
2025-01-20 12:28:55 +08:00
parent 7971bd0d4d
commit dd7f1cc9ec
2 changed files with 18 additions and 10 deletions

View File

@@ -71,8 +71,8 @@ namespace GameRes
BgrX = 6,
RgbA = 9,
BgrA = 10,
RgbA7 = 55,
BgrA7 = 66,
RgbA7 = 55,
BgrA7 = 66,
}
public class ImageData
@@ -126,7 +126,8 @@ namespace GameRes
public static ImageData Create (ImageMetaData info, PixelFormat format, BitmapPalette palette,
Array pixel_data)
{
return Create (info, format, palette, pixel_data, (int)info.Width*((format.BitsPerPixel+7)/8));
return Create (info, format, palette, pixel_data,
format.BitsPerPixel == 4 ? (int)info.Width*format.BitsPerPixel/8 : (int)info.Width*((format.BitsPerPixel+7)/8));
}
public static ImageData CreateFlipped (ImageMetaData info, PixelFormat format, BitmapPalette palette,