示例#1
0
        public void Clear()
        {
            Shapes.Clear();

            Graphics = new wGraphic();
            Effects  = new wEffects();
            Fonts    = new wFont();

            Boundary = new wRectangle();
        }
示例#2
0
        public Path WpfCompoundPolyline(wShapeCollection Shapes)
        {
            Path X = new Path();
            PathFigureCollection Fc = new PathFigureCollection();
            PathGeometry         G  = new PathGeometry();

            Fc.Clear();

            foreach (wShape Shp in Shapes.Shapes)
            {
                PathSegmentCollection Sc = new PathSegmentCollection();
                PathFigure            Pf = new PathFigure();
                wCurve Crv        = Shp.Curve;
                wPoint StartPoint = Crv.Points[0];

                Pf.StartPoint = new System.Windows.Point(StartPoint.X * Scale, StartPoint.Y * Scale);

                PathGeometry          Geo  = (PathGeometry)WpfPolyline(Crv, Shapes.Graphics, Shapes.Effects).Data;
                PathFigureCollection  Fig  = (PathFigureCollection)Geo.Figures;
                PathFigure            PFig = (PathFigure)(Fig[0]);
                PathSegmentCollection Seg  = (PathSegmentCollection)PFig.Segments;

                PolyLineSegment Pl = (PolyLineSegment)Seg[0];
                PolyLineSegment S  = new PolyLineSegment(Pl.Points, true);

                Pf.IsClosed = true;

                Sc.Add(S);
                Pf.Segments = Sc;
                Fc.Add(Pf);
            }

            G.Figures = Fc;
            X.Data    = G;

            X.RenderTransform = Xform;

            wGraphic Graphics     = Shapes.Graphics;
            wEffects ShapeEffects = Shapes.Effects;

            X = SetPathFill(X, Graphics);
            X = SetPathStroke(X, Graphics);
            X = SetPathEffects(X, ShapeEffects);


            group.Shapes.Add(new wShape(G, Graphics));
            return(X);
        }
示例#3
0
        public Path WpfCompoundSpline(wShapeCollection Shapes)
        {
            Path X = new Path();
            PathFigureCollection Fc = new PathFigureCollection();
            PathGeometry         G  = new PathGeometry();

            Fc.Clear();

            foreach (wShape Shp in Shapes.Shapes)
            {
                PathSegmentCollection Sc = new PathSegmentCollection();
                PathFigure            Pf = new PathFigure();
                wBezierSpline         C  = (wBezierSpline)Shp.Curve;
                wPoint StartPoint        = C.Points[0];

                PolyBezierSegment S = new PolyBezierSegment();

                Pf.StartPoint = new System.Windows.Point(C.Points[0].X * Scale, C.Points[0].Y * Scale);

                for (int i = 1; i < C.Points.Count; i++)
                {
                    wPoint P = C.Points[i];
                    S.Points.Add(new System.Windows.Point(P.X * Scale, P.Y * Scale));
                }

                Sc.Add(S);
                Pf.Segments = Sc;
                //Pf.IsClosed = true;
                Fc.Add(Pf);
            }

            G.Figures = Fc;
            X.Data    = G;

            X.RenderTransform = Xform;

            wGraphic Graphics     = Shapes.Graphics;
            wEffects ShapeEffects = Shapes.Effects;

            X = SetPathStroke(X, Graphics);
            X = SetPathFill(X, Graphics);
            X = SetPathEffects(X, ShapeEffects);


            group.Shapes.Add(new wShape(G, Graphics));
            return(X);
        }
示例#4
0
        public Path WpfLine(wCurve Shp, wGraphic Graphics, wEffects ShapeEffects)
        {
            Path         X = new Path();
            wLine        C = (wLine)Shp;
            LineGeometry L = new LineGeometry();

            L.StartPoint = new System.Windows.Point(C.Start.X * Scale, C.Start.Y * Scale);
            L.EndPoint   = new System.Windows.Point(C.End.X * Scale, C.End.Y * Scale);

            X.Data = L;

            X.RenderTransform = Xform;

            X = SetPathEffects(X, ShapeEffects);
            X = SetPathStroke(X, Graphics);

            group.Shapes.Add(new wShape(L, Graphics));
            return(X);
        }
示例#5
0
        public Path WpfArc(wCurve Shp, wGraphic Graphics, wEffects ShapeEffects)
        {
            wArc       C = (wArc)Shp;
            ArcSegment S = new ArcSegment();

            S.Point = new System.Windows.Point(C.EndPoint.X * Scale, C.EndPoint.Y * Scale);
            S.Size  = new System.Windows.Size(C.Radius * Scale, C.Radius * Scale);

            if (C.Clockwise)
            {
                S.SweepDirection = SweepDirection.Clockwise;
            }
            else
            {
                S.SweepDirection = SweepDirection.Counterclockwise;
            }

            Path                  X  = new Path();
            PathFigure            Pf = new PathFigure();
            PathGeometry          G  = new PathGeometry();
            PathFigureCollection  Fc = new PathFigureCollection();
            PathSegmentCollection Sc = new PathSegmentCollection();

            Pf.StartPoint = new System.Windows.Point(C.StartPoint.X * Scale, C.StartPoint.Y * Scale);

            Sc.Add(S);
            Pf.Segments = Sc;
            Fc.Add(Pf);
            G.Figures = Fc;
            X.Data    = G;

            X.RenderTransform = Xform;

            X = SetPathFill(X, Graphics);
            X = SetPathStroke(X, Graphics);
            X = SetPathEffects(X, ShapeEffects);


            group.Shapes.Add(new wShape(G, Graphics));
            return(X);
        }
示例#6
0
        public Path WpfCircle(wCurve Shp, wGraphic Graphics, wEffects ShapeEffects)
        {
            Path    X = new Path();
            wCircle C = (wCircle)Shp;

            EllipseGeometry E = new EllipseGeometry();

            E.Center  = new System.Windows.Point((C.Center.X) * Scale, (C.Center.Y) * Scale);
            E.RadiusX = C.Radius * Scale;
            E.RadiusY = C.Radius * Scale;

            X.Data            = E;
            X.RenderTransform = Xform;

            X = SetPathFill(X, Graphics);
            X = SetPathStroke(X, Graphics);
            X = SetPathEffects(X, ShapeEffects);

            group.Shapes.Add(new wShape(E, Graphics));
            return(X);
        }
示例#7
0
        public Path WpfText(wCurve Shp, wGraphic Graphics, wEffects ShapeEffects)
        {
            Path        X = new Path();
            wTextObject Z = (wTextObject)Shp;
            wText       Y = Z.Text;
            wFontMedia  F = Y.Font.ToMediaFont();

            FormattedText T = new FormattedText("Test", CultureInfo.GetCultureInfo("en-us"), FlowDirection.LeftToRight, new Typeface("Arial"), 24, new SolidColorBrush(Colors.Black));

            //FormattedText T = new FormattedText(Y.Text,CultureInfo.GetCultureInfo("en-us"),FlowDirection.LeftToRight, F.GetTypeFace(),F.Size, Graphics.WpfFill);

            X.Data = T.BuildGeometry(new System.Windows.Point(Z.Plane.Origin.X, Z.Plane.Origin.Y));

            X.RenderTransform = Xform;

            //X = SetPathFill(X, Graphics);
            //X = SetPathEffects(X, ShapeEffects);
            //X = SetPathStroke(X, Graphics);

            group.Shapes.Add(new wShape(Shp, Graphics));
            return(X);
        }
示例#8
0
        public Path WpfSpline(wCurve Shp, wGraphic Graphics, wEffects ShapeEffects)
        {
            wBezierSpline C = (wBezierSpline)Shp;

            PathFigure            Pf = new PathFigure();
            PolyBezierSegment     S  = new PolyBezierSegment();
            PathGeometry          G  = new PathGeometry();
            PathFigureCollection  Fc = new PathFigureCollection();
            PathSegmentCollection Sc = new PathSegmentCollection();

            Path X = new Path();

            Pf.StartPoint = new System.Windows.Point(C.Points[0].X * Scale, C.Points[0].Y * Scale);

            for (int i = 1; i < C.Points.Count; i++)
            {
                wPoint P = C.Points[i];
                S.Points.Add(new System.Windows.Point(P.X * Scale, P.Y * Scale));
            }

            Sc.Add(S);
            Pf.Segments = Sc;
            Fc.Add(Pf);
            G.Figures = Fc;
            X.Data    = G;

            X.StrokeMiterLimit = 1.0;

            X.RenderTransform = Xform;

            X = SetPathFill(X, Graphics);
            X = SetPathStroke(X, Graphics);
            X = SetPathEffects(X, ShapeEffects);


            group.Shapes.Add(new wShape(G, Graphics));
            return(X);
        }
示例#9
0
        private hFilter SetEffects(wEffects Effects, int Index)
        {
            string InID  = "SourceGraphic";
            string OutID = "Result";

            hFilter Filter = new hFilter(Index.ToString());

            if (Effects.Blur.Active)
            {
                Filter.AddEffect(new hBlur(Effects.Blur, InID, OutID).Value);
                InID  = OutID;
                OutID = "ResultBlur";
            }

            if (Effects.DropShadow.Active)
            {
                Filter.AddEffect(new hDropShadow(Effects.DropShadow, InID, OutID).Value);
                InID  = OutID;
                OutID = "ResultShadow";
            }

            Filter.Build();
            return(Filter);
        }
示例#10
0
 public Path SetPathEffects(Path ShapePath, wEffects ShapeEffects)
 {
     ShapePath.Effect = ShapeEffects.CurrentEffect;
     //ShapePath.OpacityMask = ShapePath.Fill;
     return(ShapePath);
 }