public Reader(Stream file, Ed8MetaData info) { m_width = (int)info.Width; m_input = file; m_data = new byte[info.Width * info.Height]; m_colors = info.PaletteSize; }
public Reader(Stream file, Ed8MetaData info) { m_width = (int)info.Width; int palette_size = (int)info.PaletteSize * 3; var palette_data = new byte[Math.Max(0x300, palette_size)]; if (palette_size != file.Read(palette_data, 0, palette_size)) { throw new InvalidFormatException(); } m_palette = new Color[0x100]; for (int i = 0; i < m_palette.Length; ++i) { m_palette[i] = Color.FromRgb(palette_data[i * 3 + 2], palette_data[i * 3 + 1], palette_data[i * 3]); } m_input = file; m_data = new byte[info.Width * info.Height]; }
public Reader(Stream file, Ed8MetaData info) { m_width = (int)info.Width; int palette_size = (int)info.PaletteSize*3; var palette_data = new byte[Math.Max (0x300, palette_size)]; if (palette_size != file.Read (palette_data, 0, palette_size)) throw new InvalidFormatException(); m_palette = new Color[0x100]; for (int i = 0; i < m_palette.Length; ++i) { m_palette[i] = Color.FromRgb (palette_data[i*3+2], palette_data[i*3+1], palette_data[i*3]); } m_input = file; m_data = new byte[info.Width * info.Height]; }