public void Write(string filename) { using (Writer writer = new Writer(filename)) this.Write(writer); }
public void Write(System.IO.Stream stream) { using (Writer writer = new Writer(stream)) this.Write(writer); }
public void write(System.IO.Stream stream, bool dcVer = false) { using (Writer writer = new Writer(stream)) write(writer, dcVer); }
public void Write(Writer writer) { writer.WriteRSDKString(PlayerAnimLocation); writer.WriteRSDKString(PlayerScriptLocation); writer.WriteRSDKString(PlayerName); }
public void write(string filename, bool dcVer = false) { using (Writer writer = new Writer(filename)) write(writer, dcVer); }
public void Write(Writer writer) { Directory = Directory.Replace('\\', '/'); writer.Write(Directory); writer.Write(Address); }
public void Write(Writer writer, bool dcGFX = false, bool raw = false) { if (gfxImage == null) { throw new Exception("Image is NULL"); } if (gfxImage.Palette == null || gfxImage.Palette.Entries.Length == 0) { throw new Exception("Only indexed images can be converted to GFX format."); } if (gfxImage.Width > 65535) { throw new Exception("GFX Images can't be wider than 65535 pixels"); } if (gfxImage.Height > 65535) { throw new Exception("GFX Images can't be higher than 65535 pixels"); } int num_pixels = gfxImage.Width * gfxImage.Height; int[] pixels = new int[num_pixels]; //Pallete Indexes // Images can't contain index 255 for (int x = 0; x < num_pixels; x++) { if (pixels[x] == 255) { throw new Exception("Images to be converted to GFX format can't contain index 255."); } } int pix = 0; if (raw) //get data from "data" array { for (int h = 0; h < height; h++) { for (int w = 0; w < width; w++) { pixels[pix] = data[pix]; pix++; } } } else //Get Data from Bitmap Class { for (int h = 0; h < gfxImage.Height; h++) { for (int w = 0; w < gfxImage.Width; w++) { pixels[pix++] = Get8bppImagePixel(gfxImage, new Point(w, h)); } } } if (dcGFX) { byte z = 0; writer.Write(z); } // Output width and height writer.Write((byte)(gfxImage.Width >> 8)); writer.Write((byte)(gfxImage.Width & 0xff)); writer.Write((byte)(gfxImage.Height >> 8)); writer.Write((byte)(gfxImage.Height & 0xff)); for (int i = 0; i < gfxImage.Palette.Entries.Length; i++) { GFXpal[i].R = gfxImage.Palette.Entries[i].R; GFXpal[i].G = gfxImage.Palette.Entries[i].G; GFXpal[i].B = gfxImage.Palette.Entries[i].B; } // Output palette for (int x = 0; x < 255; x++) { writer.Write(GFXpal[x].R); writer.Write(GFXpal[x].G); writer.Write(GFXpal[x].B); } // Output data int p = 0; int cnt = 0; for (int x = 0; x < num_pixels; x++) { if (pixels[x] != p && x > 0) { rle_write(writer, p, cnt, dcGFX); cnt = 0; } p = pixels[x]; cnt++; } rle_write(writer, p, cnt, dcGFX); // End of GFX file writer.Write((byte)0xFF); writer.Write((byte)0xFF); writer.Close(); }
public void Write(System.IO.Stream stream, bool dcGFX = false) { using (Writer writer = new Writer(stream)) this.Write(writer, dcGFX); }
public void Write(string filename, bool dcGFX = false) { using (Writer writer = new Writer(filename)) this.Write(writer, dcGFX); }