Esempio n. 1
0
        static void PNG2WCG(string from, string to)
        {
            Console.WriteLine("Converting {0} to {1}...", Path.GetFileName(from), Path.GetFileName(to));

            using (var img = Image.FromFile(from))
                using (var wcg = WcgImage.FromImage(img))
                {
                    wcg.Save(to);
                }
        }
Esempio n. 2
0
        static void PatchCanvas(string srcCanvas, string srcFolder, string dstCanvas)
        {
            Console.WriteLine("Patching {0}...", Path.GetFileName(srcCanvas));

            double scale = NEW_WIDTH / (double)OLD_WIDTH;

            var canvas = new LwgCanvas(srcCanvas);

            canvas.Width  = (int)(canvas.Width * scale);
            canvas.Height = (int)(canvas.Height * scale);

            foreach (var file in Directory.GetFiles(srcFolder))
            {
                string path = Path.GetFileNameWithoutExtension(file);

                if (!file.EndsWith(".png"))
                {
                    continue;
                }

                canvas.ReplaceImage(
                    path,
                    WcgImage.FromImage(file)
                    );

                var item = canvas.GetEntry(path);

                if (item.Flag == 0)
                {
                    item.Flag = byte.MaxValue;
                }

                item.X = (int)(item.X * scale);
                item.Y = (int)(item.Y * scale);
            }

            canvas.Save(dstCanvas);
        }