static void Main(string[] args) { if (args.Length < 2) { Console.WriteLine("Usage: NFTRFontDump [nftr file] [size]"); } if (!File.Exists(args[0])) { Console.WriteLine($"{args[0]} not found."); Environment.Exit(1); } Rgba32 color = Rgba32.FromHex("ff00ff"); try { color = Rgba32.FromHex(args[1]); } catch { } Stream nftrData = File.OpenRead(args[0]); var font = NFTR.Read(nftrData); var dumper = new NFTRDumper(font, color); using (var file = File.OpenWrite(Path.GetFileNameWithoutExtension(args[0]) + ".xml")) { dumper.GetXmlInfo().Save(file); } int counter = 0; var encoder = new PngEncoder(); using (var file = File.OpenWrite($"{args[1]}_font_{counter}.png")) { dumper.GetTextureMapping().Save(file, encoder); } }
public Image <Rgba32> GetTextureMapping() { return(NFTR.ToImage(font, palette)); }
public XDocument GetXmlInfo() { return(NFTR.ExportInfo(charTile, font)); }
public NFTRDumper(sNFTR font, Rgba32 background) { this.font = font; this.palette = NFTR.CalculatePalette(font.plgc.depth, false, background); Fill_CharTile(); }