(ImageData.Create): allow custom stride.

This commit is contained in:
morkt 2015-07-11 10:20:50 +04:00
parent 57b0115d41
commit 6ba6526536

View File

@ -83,14 +83,19 @@ namespace GameRes
}
public static ImageData Create (ImageMetaData info, PixelFormat format, BitmapPalette palette,
byte[] pixel_data)
byte[] pixel_data, int stride)
{
int stride = (int)info.Width*((format.BitsPerPixel+7)/8);
var bitmap = BitmapSource.Create ((int)info.Width, (int)info.Height, DefaultDpiX, DefaultDpiY,
format, palette, pixel_data, stride);
bitmap.Freeze();
return new ImageData (bitmap, info);
}
public static ImageData Create (ImageMetaData info, PixelFormat format, BitmapPalette palette,
byte[] pixel_data)
{
return Create (info, format, palette, pixel_data, (int)info.Width*((format.BitsPerPixel+7)/8));
}
}
public abstract class ImageFormat : IResource