diff --git a/GameRes/Image.cs b/GameRes/Image.cs index da5e4105..2b353174 100644 --- a/GameRes/Image.cs +++ b/GameRes/Image.cs @@ -126,8 +126,11 @@ namespace GameRes public static ImageData Create (ImageMetaData info, PixelFormat format, BitmapPalette palette, Array pixel_data) { - return Create (info, format, palette, pixel_data, - format.BitsPerPixel == 4 ? (int)info.Width*format.BitsPerPixel/8 : (int)info.Width*((format.BitsPerPixel+7)/8)); + if (format.BitsPerPixel == 4) + return Create(info, format, palette, pixel_data, + (int)info.Width*format.BitsPerPixel/8); + return Create(info, format, palette, pixel_data, + (int)info.Width*((format.BitsPerPixel+7)/8)); } public static ImageData CreateFlipped (ImageMetaData info, PixelFormat format, BitmapPalette palette, @@ -218,10 +221,10 @@ namespace GameRes Func get_color; if (PaletteFormat.Bgr == format || PaletteFormat.BgrX == format) get_color = x => Color.FromRgb (palette_data[x+2], palette_data[x+1], palette_data[x]); - else if (PaletteFormat.BgrA7 == format) - get_color = x => Color.FromArgb(palette_data[x+3] >= byte.MaxValue / 2 ? byte.MaxValue : (byte)(palette_data[x+3] << 1), palette_data[x+2], palette_data[x+1], palette_data[x]); else if (PaletteFormat.BgrA == format) get_color = x => Color.FromArgb (palette_data[x+3], palette_data[x+2], palette_data[x+1], palette_data[x]); + else if (PaletteFormat.BgrA7 == format) + get_color = x => Color.FromArgb (palette_data[x+3] >= byte.MaxValue / 2 ? byte.MaxValue : (byte)(palette_data[x+3] << 1), palette_data[x+2], palette_data[x+1], palette_data[x]); else if (PaletteFormat.RgbA == format) get_color = x => Color.FromArgb (palette_data[x+3], palette_data[x], palette_data[x+1], palette_data[x+2]); else if (PaletteFormat.RgbA7 == format)