mirror of
https://github.com/crskycode/GARbro.git
synced 2026-07-08 01:30:18 +08:00
(Pt1Format): use ImageData.Create method.
This commit is contained in:
@@ -58,15 +58,15 @@ namespace GameRes.Formats.BlackPackage
|
|||||||
using (var input = new ArcView.Reader (stream))
|
using (var input = new ArcView.Reader (stream))
|
||||||
{
|
{
|
||||||
stream.Seek (0x10, SeekOrigin.Current);
|
stream.Seek (0x10, SeekOrigin.Current);
|
||||||
uint m_width = input.ReadUInt32();
|
uint width = input.ReadUInt32();
|
||||||
uint m_height = input.ReadUInt32();
|
uint height = input.ReadUInt32();
|
||||||
uint comp_size = input.ReadUInt32();
|
uint comp_size = input.ReadUInt32();
|
||||||
uint uncomp_size = input.ReadUInt32();
|
uint uncomp_size = input.ReadUInt32();
|
||||||
if (uncomp_size != m_width*m_height*3u)
|
if (uncomp_size != width*height*3u)
|
||||||
return null;
|
return null;
|
||||||
return new Pt1MetaData {
|
return new Pt1MetaData {
|
||||||
Width = m_width,
|
Width = width,
|
||||||
Height = m_height,
|
Height = height,
|
||||||
BPP = 24,
|
BPP = 24,
|
||||||
PackedSize = comp_size,
|
PackedSize = comp_size,
|
||||||
UnpackedSize = uncomp_size
|
UnpackedSize = uncomp_size
|
||||||
@@ -82,16 +82,8 @@ namespace GameRes.Formats.BlackPackage
|
|||||||
|
|
||||||
stream.Position = 0x20;
|
stream.Position = 0x20;
|
||||||
var reader = new Reader (stream, meta);
|
var reader = new Reader (stream, meta);
|
||||||
// try
|
reader.UnpackV2();
|
||||||
{
|
return ImageData.Create (meta, PixelFormats.Bgr24, null, reader.Data);
|
||||||
reader.UnpackV2();
|
|
||||||
}
|
|
||||||
// catch { }
|
|
||||||
byte[] pixels = reader.Data;
|
|
||||||
var bitmap = BitmapSource.Create ((int)meta.Width, (int)meta.Height, 96, 96,
|
|
||||||
PixelFormats.Bgr24, null, pixels, (int)meta.Width*3);
|
|
||||||
bitmap.Freeze();
|
|
||||||
return new ImageData (bitmap, meta);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class Reader
|
internal class Reader
|
||||||
@@ -100,8 +92,8 @@ namespace GameRes.Formats.BlackPackage
|
|||||||
byte[] m_output;
|
byte[] m_output;
|
||||||
int m_width;
|
int m_width;
|
||||||
int m_height;
|
int m_height;
|
||||||
|
int m_stride;
|
||||||
int m_left = 0;
|
int m_left = 0;
|
||||||
int m_stride = 0;
|
|
||||||
|
|
||||||
public byte[] Data { get { return m_output; } }
|
public byte[] Data { get { return m_output; } }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user