mirror of
https://github.com/crskycode/GARbro.git
synced 2026-07-08 01:30:18 +08:00
added BitmapSourceDecoder class.
This commit is contained in:
@@ -179,31 +179,8 @@ namespace GameRes.Formats.Palette
|
|||||||
var bmp = new RenderTargetBitmap (base_frame.PixelWidth, base_frame.PixelHeight,
|
var bmp = new RenderTargetBitmap (base_frame.PixelWidth, base_frame.PixelHeight,
|
||||||
base_frame.DpiX, base_frame.DpiY, PixelFormats.Pbgra32);
|
base_frame.DpiX, base_frame.DpiY, PixelFormats.Pbgra32);
|
||||||
bmp.Render (visual);
|
bmp.Render (visual);
|
||||||
var base_info = new ImageMetaData {
|
return new BitmapSourceDecoder (bmp);
|
||||||
Width = (uint)bmp.PixelWidth,
|
|
||||||
Height = (uint)bmp.PixelHeight,
|
|
||||||
BPP = bmp.Format.BitsPerPixel,
|
|
||||||
};
|
|
||||||
return new BitmapSourceDecoder (bmp, base_info);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class BitmapSourceDecoder : IImageDecoder
|
|
||||||
{
|
|
||||||
public Stream Source { get { return null; } }
|
|
||||||
public ImageFormat SourceFormat { get { return null; } }
|
|
||||||
public ImageMetaData Info { get; private set; }
|
|
||||||
public ImageData Image { get; private set; }
|
|
||||||
|
|
||||||
public BitmapSourceDecoder (BitmapSource bmp, ImageMetaData info)
|
|
||||||
{
|
|
||||||
Info = info;
|
|
||||||
Image = new ImageData (bmp, info);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose ()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -257,26 +257,4 @@ namespace GameRes.Formats.Tamamo
|
|||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class BitmapSourceDecoder : IImageDecoder
|
|
||||||
{
|
|
||||||
public Stream Source { get { return null; } }
|
|
||||||
public ImageFormat SourceFormat { get { return null; } }
|
|
||||||
public ImageMetaData Info { get; private set; }
|
|
||||||
public ImageData Image { get; private set; }
|
|
||||||
|
|
||||||
public BitmapSourceDecoder (BitmapSource bitmap)
|
|
||||||
{
|
|
||||||
Info = new ImageMetaData {
|
|
||||||
Width = (uint)bitmap.PixelWidth,
|
|
||||||
Height = (uint)bitmap.PixelHeight,
|
|
||||||
BPP = bitmap.Format.BitsPerPixel,
|
|
||||||
};
|
|
||||||
Image = new ImageData (bitmap);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose ()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
|
||||||
namespace GameRes
|
namespace GameRes
|
||||||
{
|
{
|
||||||
@@ -165,4 +166,26 @@ namespace GameRes
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class BitmapSourceDecoder : IImageDecoder
|
||||||
|
{
|
||||||
|
public Stream Source { get; set; }
|
||||||
|
public ImageFormat SourceFormat { get; set; }
|
||||||
|
public ImageMetaData Info { get; private set; }
|
||||||
|
public ImageData Image { get; private set; }
|
||||||
|
|
||||||
|
public BitmapSourceDecoder (BitmapSource bitmap)
|
||||||
|
{
|
||||||
|
Info = new ImageMetaData {
|
||||||
|
Width = (uint)bitmap.PixelWidth,
|
||||||
|
Height = (uint)bitmap.PixelHeight,
|
||||||
|
BPP = bitmap.Format.BitsPerPixel,
|
||||||
|
};
|
||||||
|
Image = new ImageData (bitmap);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user