public static void DumpTexture(Texture2D tex, string s) { if (Directory.Exists(Path.GetDirectoryName(s))) { Extended.Save_As_PNG(tex, s, tex.Width, tex.Height); } }
public override void SaveCLUT(string path) { using (var clut = new Texture2D(Memory.Graphics.GraphicsDevice, _texture.NumOfColors, _texture.NumOfCluts)) { for (ushort i = 0; i < _texture.NumOfCluts; i++) { clut.SetData(0, new Rectangle(0, i, _texture.NumOfColors, 1), GetClutColors(i), 0, _texture.NumOfColors); } Extended.Save_As_PNG(clut, path, _texture.NumOfColors, _texture.NumOfCluts); } }
public override void SaveCLUT(string path) { if (!CLP) { return; } using (var br = new BinaryReader(new MemoryStream(Buffer))) using (var clut = new Texture2D(Memory.Graphics.GraphicsDevice, Texture.NumOfColors, Texture.NumOfCluts)) { for (ushort i = 0; i < Texture.NumOfCluts; i++) { clut.SetData(0, new Rectangle(0, i, Texture.NumOfColors, 1), GetClutColors(br, i), 0, Texture.NumOfColors); } Extended.Save_As_PNG(clut, path, Texture.NumOfColors, Texture.NumOfCluts); } }
public override void SavePNG(string path, short clut = -1) { if (Buffer == null || Memory.Graphics == null) { return; } if (clut == -1) { if (Texture.NumOfCluts > 0) { Enumerable.Range(0, Texture.NumOfCluts).ForEach(x => SavePNG(path, (short)x)); return; } clut = 0; } using (var br = new BinaryReader(new MemoryStream(Buffer))) using (var tex = GetTexture(br, !CLP ? null : GetClutColors(br, (ushort)clut))) if (tex != null) { Extended.Save_As_PNG(tex, $"{path}{(CLP && Texture.NumOfCluts > 1 ? "_" + clut.ToString("D") : "")}.png", GetWidth, GetHeight); } }