Example #1
0
        private void ProcessLayer(string layer, string SVGInput, string MD5, string svgDir, string tempDir, LoadingSVGFile popupForm, string sizeFormat)
        {
            popupForm.UpdateProcessText = "Processing Layer " + layer + " SVG";
            Process          processLayer1   = new Process();
            ProcessStartInfo startInfoLayer1 = new ProcessStartInfo();

            startInfoLayer1.FileName       = "inkscape.exe";
            startInfoLayer1.Arguments      = "--without-gui --file=\"" + svgInput + "\" --export-plain-svg=\"" + svgDir + "\\Layer" + layer + ".svg\" --export-area-page --export-id-only --export-id=layer" + layer;
            startInfoLayer1.CreateNoWindow = true;
            processLayer1.StartInfo        = startInfoLayer1;
            processLayer1.Start();
            processLayer1.WaitForExit();



            if (File.Exists(svgDir + "\\Layer" + layer + ".svg"))
            {
                popupForm.UpdateProcessText = "Processing Layer " + layer + " Image";
                Process          processLayer1PNG   = new Process();
                ProcessStartInfo startInfoLayer1PNG = new ProcessStartInfo();
                startInfoLayer1PNG.FileName               = "convert.exe";
                startInfoLayer1PNG.Arguments              = "-colors 2  -background none -geometry " + sizeFormat + " \"" + svgDir + "\\Layer" + layer + ".svg\" \"" + tempDir + "\\Layer" + layer + ".png\"";
                startInfoLayer1PNG.CreateNoWindow         = true;
                startInfoLayer1PNG.RedirectStandardInput  = true;
                startInfoLayer1PNG.RedirectStandardOutput = false;
                startInfoLayer1PNG.UseShellExecute        = false;
                processLayer1PNG.StartInfo = startInfoLayer1PNG;
                processLayer1PNG.Start();
                processLayer1PNG.WaitForExit();

                layerImages[Convert.ToInt16(layer)] = Image.FromFile(tempDir + "\\Layer" + layer + ".png");
                //((PictureBox)this.Controls.Find("layer" + layer + "Image", true)[0]).Image = layerImages[Convert.ToInt16(layer)];
            }
        }
Example #2
0
        private void processSVGFile(string SVGInput, string MD5, string svgDir, string tempDir, LoadingSVGFile popupForm)
        {
            popupForm.UpdateProcessText = "Importing SVG";
            double width  = processSVGWidth();
            double height = processSVGHeight();



            Debug.WriteLine(width);
            Debug.WriteLine(height);
            string imgFormat = width > height ? "96x" : "x96";

            ProcessLayer("1", SVGInput, MD5, svgDir, tempDir, popupForm, imgFormat);
            ProcessLayer("2", SVGInput, MD5, svgDir, tempDir, popupForm, imgFormat);
            ProcessLayer("3", SVGInput, MD5, svgDir, tempDir, popupForm, imgFormat);
            ProcessLayer("4", SVGInput, MD5, svgDir, tempDir, popupForm, imgFormat);
            ProcessLayer("5", SVGInput, MD5, svgDir, tempDir, popupForm, imgFormat);
            ProcessLayer("6", SVGInput, MD5, svgDir, tempDir, popupForm, imgFormat);
        }