示例#1
0
        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);
            }
        }
示例#2
0
 public Image <Rgba32> GetTextureMapping()
 {
     return(NFTR.ToImage(font, palette));
 }
示例#3
0
 public XDocument GetXmlInfo()
 {
     return(NFTR.ExportInfo(charTile, font));
 }
示例#4
0
 public NFTRDumper(sNFTR font, Rgba32 background)
 {
     this.font    = font;
     this.palette = NFTR.CalculatePalette(font.plgc.depth, false, background);
     Fill_CharTile();
 }