Пример #1
0
            public void DrawOverlappedRectangles()
            {
                var box0 = new List <Node>();
                {
                    {
                        Node node = new Node(0);
                        box0.Add(node);
                        var primitive = new PathPrimitive();
                        primitive.PathRect(new Point(10, 10), new Point(100, 100));
                        primitive.PathFill(Color.Orange);
                        node.Primitive = primitive;
                    }
                    {
                        Node node = new Node(1);
                        box0.Add(node);
                        var primitive = new PathPrimitive();
                        primitive.PathRect(new Point(9, 9), new Point(101, 101));
                        primitive.PathStroke(2, Color.Black);
                        node.Primitive = primitive;
                    }
                }
                var box1 = new List <Node>();
                {
                    {
                        Node node = new Node(3);
                        box1.Add(node);
                        var primitive = new PathPrimitive();
                        primitive.PathRect(new Point(50, 50), new Point(140, 140));
                        primitive.PathFill(Color.LightBlue);
                        node.Primitive = primitive;
                    }
                    {
                        Node node = new Node(4);
                        box1.Add(node);
                        var primitive = new PathPrimitive();
                        primitive.PathRect(new Point(49, 49), new Point(141, 141));
                        primitive.PathStroke(2, Color.Red);
                        node.Primitive = primitive;
                    }
                }

                {
                    var box0Foreground = new List <Node>();
                    box0Foreground.AddRange(box0);
                    box0Foreground.AddRange(box1);
                    Util.DrawNodesToImage(out var imageRawBytes, box0Foreground, 150, 150);
                    Util.CheckExpectedImage(imageRawBytes, 150, 150, @"Rendering\images\NodeFacts.Draw.DrawOverlappedRectangles.Before.png");
                }
                {
                    var box1Foreground = new List <Node>();
                    box1Foreground.AddRange(box1);
                    box1Foreground.AddRange(box0);
                    Util.DrawNodesToImage(out var imageRawBytes, box1Foreground, 150, 150);
                    Util.CheckExpectedImage(imageRawBytes, 150, 150, @"Rendering\images\NodeFacts.Draw.DrawOverlappedRectangles.After.png");
                }
            }
Пример #2
0
            public void Draw()
            {
                var primitive = new PathPrimitive();

                primitive.PathMoveTo(Point.Zero);
                primitive.PathArcFast(new Point(10, 0), 10, 6, 9);
                primitive.PathStroke(1, Color.Black);

                Util.DrawPathPrimitive(primitive);
            }
            public void StrokeAPath()
            {
                var primitive = new PathPrimitive();

                primitive.PathMoveTo(new Point(10, 10));
                primitive.PathLineTo(new Point(10, 80));
                primitive.PathLineTo(new Point(80, 80));
                primitive.PathLineTo(new Point(80, 10));
                primitive.PathClose();
                primitive.PathStroke(2, Color.Red);

                Util.CheckExpectedImage(primitive, 100, 100, @"GraphicsImplementation\Builtin\images\BuiltinPrimitiveRendererFacts.DrawPath.StrokeAPath.png");
            }