mirror of
https://github.com/crskycode/GARbro.git
synced 2026-06-30 18:30:20 +08:00
(ImageData.Create): new convenient static method.
This commit is contained in:
@@ -24,6 +24,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Windows.Media;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
|
|
||||||
namespace GameRes
|
namespace GameRes
|
||||||
@@ -66,6 +67,16 @@ namespace GameRes
|
|||||||
OffsetX = x;
|
OffsetX = x;
|
||||||
OffsetY = y;
|
OffsetY = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ImageData Create (ImageMetaData info, PixelFormat format, BitmapPalette palette,
|
||||||
|
byte[] pixel_data)
|
||||||
|
{
|
||||||
|
int stride = (int)info.Width*((format.BitsPerPixel+7)/8);
|
||||||
|
var bitmap = BitmapSource.Create ((int)info.Width, (int)info.Height, 96, 96,
|
||||||
|
format, palette, pixel_data, stride);
|
||||||
|
bitmap.Freeze();
|
||||||
|
return new ImageData (bitmap, info);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract class ImageFormat : IResource
|
public abstract class ImageFormat : IResource
|
||||||
|
|||||||
Reference in New Issue
Block a user