private void CheckForPalette(byte [] data) { PicDecoder decoder = new PicDecoder(data); if (decoder.hasPalette) { PalDecoder paldecoder = new PalDecoder(data, 6); palette = paldecoder.Palette; } }
private void ShowPic(byte [] data) { PicDecoder decoder = new PicDecoder(data); /// Output image as picture box Bitmap bitmap = new Bitmap(decoder.width, decoder.height); byte[] line = new byte[decoder.width]; for (int y = 0; y < decoder.height; y++) { decoder.DecodeNextBytes(line); for (int x = 0; x < decoder.width; x++) { byte value = line[x]; bitmap.SetPixel(x, y, palette[value]); } } pictureBox1.Image = bitmap; }