mirror of
https://github.com/crskycode/GARbro.git
synced 2026-07-08 01:30:18 +08:00
(ImageFormat.ReadPalette): new static methods.
Generalized image palette deserializations.
This commit is contained in:
@@ -115,7 +115,7 @@ namespace GameRes.Formats.Abogado
|
||||
if (8 == m_info.BPP)
|
||||
{
|
||||
m_input.Position = m_info.PaletteOffset;
|
||||
ReadPalette();
|
||||
Palette = ImageFormat.ReadPalette (m_input.AsStream);
|
||||
}
|
||||
m_bits.Input.Position = m_info.DataOffset;
|
||||
ResetDict();
|
||||
@@ -181,20 +181,6 @@ namespace GameRes.Formats.Abogado
|
||||
m_pixel_size = 4;
|
||||
}
|
||||
|
||||
void ReadPalette ()
|
||||
{
|
||||
var palette_data = m_input.ReadBytes (0x400);
|
||||
if (palette_data.Length != 0x400)
|
||||
throw new EndOfStreamException();
|
||||
var palette = new Color[0x100];
|
||||
for (int i = 0; i < 0x100; ++i)
|
||||
{
|
||||
int c = i * 4;
|
||||
palette[i] = Color.FromRgb (palette_data[c+2], palette_data[c+1], palette_data[c]);
|
||||
}
|
||||
Palette = new BitmapPalette (palette);
|
||||
}
|
||||
|
||||
void UnpackChannel (int dst)
|
||||
{
|
||||
m_output[dst] = (byte)m_bits.GetBits (8);
|
||||
|
||||
Reference in New Issue
Block a user