mirror of
https://github.com/crskycode/GARbro.git
synced 2024-11-27 07:34:00 +08:00
(PnaDecoder): derive from BinaryImageDecoder.
This commit is contained in:
parent
543fad3fb6
commit
882f3ec461
@ -91,32 +91,16 @@ namespace GameRes.Formats.Will
|
||||
}
|
||||
}
|
||||
|
||||
internal sealed class PnaDecoder : IImageDecoder
|
||||
internal sealed class PnaDecoder : BinaryImageDecoder
|
||||
{
|
||||
IBinaryStream m_input;
|
||||
ImageMetaData m_info;
|
||||
ImageData m_image;
|
||||
public PnaDecoder (IBinaryStream input, ImageMetaData info) : base (input, info)
|
||||
{
|
||||
}
|
||||
|
||||
public Stream Source { get { m_input.Position = 0; return m_input.AsStream; } }
|
||||
public ImageFormat SourceFormat { get { return null; } }
|
||||
public ImageMetaData Info { get { return m_info; } }
|
||||
public ImageData Image
|
||||
{
|
||||
get
|
||||
{
|
||||
if (null == m_image)
|
||||
protected override ImageData GetImageData ()
|
||||
{
|
||||
var pixels = ReadPixels();
|
||||
m_image = ImageData.Create (m_info, PixelFormats.Bgra32, null, pixels);
|
||||
}
|
||||
return m_image;
|
||||
}
|
||||
}
|
||||
|
||||
public PnaDecoder (IBinaryStream input, ImageMetaData info)
|
||||
{
|
||||
m_input = input;
|
||||
m_info = info;
|
||||
return ImageData.Create (Info, PixelFormats.Bgra32, null, pixels);
|
||||
}
|
||||
|
||||
byte[] ReadPixels ()
|
||||
@ -146,15 +130,5 @@ namespace GameRes.Formats.Will
|
||||
}
|
||||
return pixels;
|
||||
}
|
||||
|
||||
bool m_disposed = false;
|
||||
public void Dispose ()
|
||||
{
|
||||
if (!m_disposed)
|
||||
{
|
||||
m_input.Dispose();
|
||||
m_disposed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user