Exemplo n.º 1
0
        public void Test_DrawablePath()
        {
            DrawablePath path = new DrawablePath();

            Assert.AreEqual(0, path.Paths.Count());

            ((IDrawingWand)path).Draw(null);
        }
Exemplo n.º 2
0
        public void Test_DrawablePath()
        {
            DrawablePath path = new DrawablePath();

            EnumerableAssert.IsEmpty(path.Paths);

            ((IDrawingWand)path).Draw(null);
        }
Exemplo n.º 3
0
        private void FromDrawablePath(DrawablePath drawablePath, IList <IBaseShape> shapes, IFactory factory)
        {
            var path = drawablePath.Path;

            if (path == null)
            {
                return;
            }
            var stroke    = drawablePath.Stroke;
            var fill      = drawablePath.Fill;
            var style     = factory.CreateShapeStyle(ProjectEditorConfiguration.DefaulStyleName);
            var geometry  = PathGeometryConverter.ToPathGeometry(path, 0.0, 0.0, factory);
            var pathShape = factory.CreatePathShape(
                "Path",
                style,
                geometry,
                stroke != null,
                fill != null);

            shapes.Add(pathShape);
        }
Exemplo n.º 4
0
            public void ShouldSetPathsToEmptyCollection()
            {
                var path = new DrawablePath();

                Assert.Empty(path.Paths);
            }
Exemplo n.º 5
0
        public override void Reset()
        {
            base.Reset();

            int     width           = 20;
            Texture gradientTexture = new Texture(width, 1, true);

            byte[] data = new byte[width * 4];
            for (int i = 0; i < width; ++i)
            {
                float brightness = (float)i / (width - 1);
                int   index      = i * 4;
                data[index + 0] = (byte)(brightness * 255);
                data[index + 1] = (byte)(brightness * 255);
                data[index + 2] = (byte)(brightness * 255);
                data[index + 3] = 255;
            }
            gradientTexture.SetData(new TextureUpload(data));

            Add(new Container()
            {
                RelativeSizeAxes = Axes.Both,
                Children         = new[]
                {
                    new FlowContainer
                    {
                        RelativeSizeAxes = Axes.Both,
                        Children         = new[]
                        {
                            new Container
                            {
                                RelativeSizeAxes = Axes.Both,
                                Size             = new Vector2(0.5f),
                                Children         = new Drawable[]
                                {
                                    new SpriteText
                                    {
                                        Text     = "Simple path",
                                        TextSize = 20,
                                        Colour   = Color4.White,
                                    },
                                    new Path
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Positions        = new List <Vector2> {
                                            Vector2.One * 50, Vector2.One * 100
                                        },
                                        Texture = gradientTexture,
                                        Colour  = Color4.Green,
                                    },
                                }
                            },
                            new Container
                            {
                                RelativeSizeAxes = Axes.Both,
                                Size             = new Vector2(0.5f),
                                Children         = new Drawable[]
                                {
                                    new SpriteText
                                    {
                                        Text     = "Curved path",
                                        TextSize = 20,
                                        Colour   = Color4.White,
                                    },
                                    new Path
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Positions        = new List <Vector2>
                                        {
                                            new Vector2(50, 50),
                                            new Vector2(50, 250),
                                            new Vector2(250, 250),
                                            new Vector2(250, 50),
                                            new Vector2(50, 50),
                                        },
                                        Texture = gradientTexture,
                                        Colour  = Color4.Blue,
                                    },
                                }
                            },
                            new Container
                            {
                                RelativeSizeAxes = Axes.Both,
                                Size             = new Vector2(0.5f),
                                Children         = new Drawable[]
                                {
                                    new SpriteText
                                    {
                                        Text     = "Self-overlapping path",
                                        TextSize = 20,
                                        Colour   = Color4.White,
                                    },
                                    new Path
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Positions        = new List <Vector2>
                                        {
                                            new Vector2(50, 50),
                                            new Vector2(50, 250),
                                            new Vector2(250, 250),
                                            new Vector2(250, 150),
                                            new Vector2(20, 150),
                                        },
                                        Texture = gradientTexture,
                                        Colour  = Color4.Red,
                                    },
                                }
                            },
                            new Container
                            {
                                RelativeSizeAxes = Axes.Both,
                                Size             = new Vector2(0.5f),
                                Children         = new Drawable[]
                                {
                                    new SpriteText
                                    {
                                        Text     = "Draw something ;)",
                                        TextSize = 20,
                                        Colour   = Color4.White,
                                    },
                                    drawablePath = new DrawablePath
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Texture          = gradientTexture,
                                        Colour           = Color4.White,
                                    },
                                }
                            },
                        }
                    }
                }
            });
        }
Exemplo n.º 6
0
            public void ShouldSupportNullArgument()
            {
                var path = new DrawablePath();

                ((IDrawingWand)path).Draw(null);
            }