Esempio n. 1
0
        protected override void WriteImageToIsoInner(System.IO.Stream iso, System.Drawing.Image image)
        {
            ImageQuantization.PaletteQuantizer q = new ImageQuantization.PaletteQuantizer(greyscalePalette);

            using (System.Drawing.Bitmap b = q.Quantize(image))
            {
                List <byte> pixels = new List <byte>();
                for (int y = 0; y < Height; y++)
                {
                    for (int x = 0; x < Width; x++)
                    {
                        pixels.Add((byte)((b.GetPixel(x, y).R & 0xF0) >> 4));
                    }
                }

                List <byte> bytes = new List <byte>(pixels.Count / 2);
                for (int i = 0; i < pixels.Count; i += 2)
                {
                    bytes.Add((byte)(((pixels[i + 1] & 0x0F) << 4) | (pixels[i] & 0x0F)));
                }
                position.PatchIso(iso, bytes);
            }
        }
Esempio n. 2
0
        protected override void WriteImageToIsoInner( System.IO.Stream iso, System.Drawing.Image image )
        {
            ImageQuantization.PaletteQuantizer q = new ImageQuantization.PaletteQuantizer( greyscalePalette );

            using (System.Drawing.Bitmap b = q.Quantize( image ))
            {
                List<byte> pixels = new List<byte>();
                for (int y = 0; y < Height; y++)
                {
                    for (int x = 0; x < Width; x++)
                    {
                        pixels.Add( (byte)((b.GetPixel( x, y ).R & 0xF0) >> 4) );
                    }
                }

                List<byte> bytes = new List<byte>( pixels.Count / 2 );
                for (int i = 0; i < pixels.Count; i += 2)
                {
                    bytes.Add( (byte)(((pixels[i + 1] & 0x0F) << 4) | (pixels[i] & 0x0F)) );
                }
                position.PatchIso( iso, bytes );
            }
        }