public void fromImage(Gfx img)
        {
            // Create image
            width  = img.width;
            height = img.height;

            for (int i = 0; i < 0xFF; i++)
            {
                palette[i].R = img.palette[i].R;
                palette[i].G = img.palette[i].G;
                palette[i].B = img.palette[i].B;
            }
            palette[0xFF].R = 0x00;
            palette[0xFF].G = 0x00;
            palette[0xFF].B = 0x00;

            pixels = new byte[width * height];
            Array.Copy(img.pixels, pixels, pixels.Length);
        }
        public Gfx toGfx()
        {
            // Create image
            Gfx img = new Gfx();

            img.width  = (ushort)width;
            img.height = (ushort)height;

            for (int i = 0; i < 0xFF; i++)
            {
                img.palette[i].R = palette[i].R;
                img.palette[i].G = palette[i].G;
                img.palette[i].B = palette[i].B;
            }
            img.palette[0xFF].R = 0xFF;
            img.palette[0xFF].G = 0x00;
            img.palette[0xFF].B = 0xFF;

            img.pixels = new byte[width * height];
            Array.Copy(pixels, img.pixels, pixels.Length);

            return(img);
        }