byte[] LoadPalette(BinaryReader reader, BitmapEntryType type) { byte[] pal = reader.ReadBytes(3 * 256); switch (type) { case BitmapEntryType.DosPalette: // 0x22 palettes are DOS-style. r,g,b values in range 0..64 for (int i = 0; i < 768; i++) { pal[i] = (byte)(pal[i] << 2); } return(pal); case BitmapEntryType.Palette: // 0x24 palettes have r,g,b in range 0..255. Nothing to do return(pal); default: //throw new NotImplementedException(); return(null); } }
byte[] LoadPalette(BinaryReader reader, BitmapEntryType type) { byte[] pal = reader.ReadBytes(3 * 256); switch (type) { case BitmapEntryType.DosPalette: // 0x22 palettes are DOS-style. r,g,b values in range 0..64 for (int i = 0; i < 768; i++) { pal[i] = (byte)(pal[i] << 2); } return pal; case BitmapEntryType.Palette: // 0x24 palettes have r,g,b in range 0..255. Nothing to do return pal; default: //throw new NotImplementedException(); return null; } }