Ejemplo n.º 1
0
        private void demoGeometryFromPoints()
        {
            tess.Reset();
            tess.Forward(30);
            tess.Stamp();
            tess.Forward(30);
            Point[] pts = { new Point(-10, -10), new Point(15, 0), new Point(-10, 10), new Point(-4, 0) }; // a pointy arrowHead
            tess.SetAppearance(Turtle.GeometryFromPoints(pts), null, null);
            //     tess.TurtleUI.Opacity = 0.4;
            tess.Stamp();
            tess.Forward(30);
            tess.Stamp();
            tess.Forward(30);
            tess.Stamp();
            tess.Forward(30);

            BlurEffect be = new BlurEffect();

            be.Radius            = 10;
            tess.TurtleUI.Effect = be;

            tess.TurtleUI.Effect = new DropShadowEffect()
            {
                Direction = 3, Color = Colors.Black, ShadowDepth = 20
            };
        }
Ejemplo n.º 2
0
        private void demoImageTurtle()
        {
            tess.Reset();
            // We can make the linebrush an ImageBrush.   Creating a different shape outline for the
            // turtle works nicely too.

            ImageSource src = new BitmapImage(new Uri("pack://application:,,,/" + imageName[imageIndx]));

            imageIndx = (imageIndx + 1) % imageName.Length;

            // make the turtle geometry into a rectangle that can hold the image exactly
            double   halfWidth  = src.Width / 2.0;
            double   halfHeight = src.Height / 2.0;
            Geometry g          = Turtle.GeometryFromPoints(new Point[] {
                new Point(-halfWidth, -halfHeight), new Point(halfWidth, -halfHeight), new Point(halfWidth, halfHeight), new Point(-halfWidth, halfHeight)
            });

            //    Geometry g = new RectangleGeometry(new Rect(new Point(-halfWidth, -halfHeight), new Point(halfWidth, halfHeight)));
            //   Geometry g = new EllipseGeometry(new Point(0, 0), halfWidth, halfHeight);

            ImageBrush brsh = new ImageBrush()
            {
                ImageSource = src
            };

            tess.SetAppearance(g, Brushes.Transparent, brsh);

            doSomeStamping();
        }