From 6ba65265365a393906f3398bb7ce9119e95403fd Mon Sep 17 00:00:00 2001 From: morkt Date: Sat, 11 Jul 2015 10:20:50 +0400 Subject: [PATCH] (ImageData.Create): allow custom stride. --- GameRes/Image.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/GameRes/Image.cs b/GameRes/Image.cs index b77e97fc..5f4204a2 100644 --- a/GameRes/Image.cs +++ b/GameRes/Image.cs @@ -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