(AJP): fixed images without alpha-channel.

This commit is contained in:
morkt 2017-01-11 06:50:13 +04:00
parent 70eefd38f4
commit 2c20d845eb

View File

@ -78,6 +78,11 @@ namespace GameRes.Formats.AliceSoft
var decoder = new JpegBitmapDecoder (jpeg, var decoder = new JpegBitmapDecoder (jpeg,
BitmapCreateOptions.None, BitmapCacheOption.OnLoad); BitmapCreateOptions.None, BitmapCacheOption.OnLoad);
BitmapSource bitmap = decoder.Frames[0]; BitmapSource bitmap = decoder.Frames[0];
if (0 == meta.AlphaOffset || 0 == meta.AlphaSize)
{
bitmap.Freeze();
return new ImageData (bitmap, info);
}
if (bitmap.Format.BitsPerPixel != 32) if (bitmap.Format.BitsPerPixel != 32)
bitmap = new FormatConvertedBitmap (bitmap, PixelFormats.Bgr32, null, 0); bitmap = new FormatConvertedBitmap (bitmap, PixelFormats.Bgr32, null, 0);