Beispiel #1
0
        public static Bitmap Get(string path, int scaleRatio, Brush brush, SmoothingMode mode = SmoothingMode.HighQuality)
        {
            int        svgPathSize = 8;
            int        width       = svgPathSize * scaleRatio + 1;
            int        height      = svgPathSize * scaleRatio + 1;
            List <Cmd> cmds;

            cmds = CmdParser.Parse(path);
            CmdValidator.ValidateCmds(cmds);
            cmds = CmdConverter.ExtractToSingleAndAbsolutePositionCmds(cmds);
            cmds = CmdScaler.Scale(cmds, scaleRatio);
            return(CmdDrawer.Draw(cmds, width, height, brush, mode));
        }
Beispiel #2
0
        private void DrawImage(List <Cmd> cmd)
        {
            InitBrushIfNeeded();
            int scale = (int)nudScale.Value;
            int @base = (int)nudBase.Value;

            // process commands
            List <Cmd> processedCmds = cmd;

            processedCmds = CmdConverter.ExtractToSingleAndAbsolutePositionCmds(processedCmds);
            processedCmds = CmdScaler.Scale(processedCmds, scale);

            // display drawned into text box
            var cmdText = new StringBuilder();

            processedCmds.ForEach(cm => cmdText.Append(cm.ToString()));
            txtParsedCmds.Text = cmdText.ToString();

            // draw image into preview
            pbPreview.Image = CmdDrawer.Draw(processedCmds, @base * scale, @base * scale, br);
        }