コード例 #1
0
            public static GraphicsPath get_svg(System.Drawing.Graphics graphics)
            {
                if (_of_s_path != null)
                {
                    return(_of_s_path);
                }
                string _of_s_data  = "m 0,0 c 0,-8.6 0.1,-17.3 1.8,-25.8   0.6,-2.5 1.2,-5.4 3.2,-7.3   1,-1 3,0 3.9,1.0   2.5,3.2 3.1,7.5 3.3,12.5";
                string _of_s_data2 = "m 0,0 c 0,8.6 -0.1,17.3 -1.8,25.8   -0.6,2.5 -1.2,5.4 -3.2,7.3   -1,1 -3,-0 -3.9,-1.0   -2.5,-3.2 -3.1,-7.5 -3.3,-12.5";
                string _of_s_data3 = "";// "m 9,0 a 9,9 360 true,true 9,0";

                System.Windows.Media.GeometryGroup gg = new System.Windows.Media.GeometryGroup();
                gg.Children.Add(System.Windows.Media.Geometry.Parse(_of_s_data));
                gg.Children.Add(System.Windows.Media.Geometry.Parse(_of_s_data2));
                gg.Children.Add(System.Windows.Media.Geometry.Parse(_of_s_data3));
                System.Windows.Shapes.Path am = new System.Windows.Shapes.Path();
                am.Data = gg;

                Svg.SvgPath sp = new Svg.SvgPath();
                sp.PathData = Svg.SvgPathBuilder.Parse(_of_s_data + _of_s_data2 + _of_s_data3);


                Svg.ISvgRenderer render = Svg.SvgRenderer.FromGraphics(graphics);

                //var converter = TypeDescriptor.GetConverter(typeof(Svg.Pathing.SvgPathSegmentList));
                //GraphicsPath ttt = sp.Path(render);
                _of_s_path = sp.Path(render);
                return(_of_s_path);
            }
コード例 #2
0
            public static GraphicsPath get_svg2(System.Drawing.Graphics graphics)
            {
                if (_of_s_path != null)
                {
                    return(_of_s_path.Clone() as GraphicsPath);
                }
                string _of_s_data  = "m 0,0 c 0,-8.6 0.1,-17.3 1.8,-25.8   0.6,-2.5 1.2,-5.4 3.2,-7.3   1,-1 3,0 3.9,1.0   2.5,3.2 3.1,7.5 3.3,12.5";
                string _of_s_data2 = "M 0,0 c 0,8.6 -0.1,17.3 -1.8,25.8   -0.6,2.5 -1.2,5.4 -3.2,7.3   -1,1 -3,-0 -3.9,-1.0   -2.5,-3.2 -3.1,-7.5 -3.3,-12.5";

                Svg.SvgPath sp = new Svg.SvgPath();
                sp.PathData = Svg.SvgPathBuilder.Parse(_of_s_data + _of_s_data2);
                Svg.ISvgRenderer render = Svg.SvgRenderer.FromNull();
                _of_s_path = sp.Path(render);
                return(_of_s_path.Clone() as GraphicsPath);
            }