Exemplo n.º 1
0
        public override void Setup (GraphicsDevice device)
        {
            _gradWidth = new GradientPen(Color.Lime, Color.Blue, 15);
            _gradLength = new PathGradientPen(Color.Lime, Color.Blue, 15);

            PathBuilder pathBuilder = new PathBuilder() { CalculateLengths = true };
            pathBuilder.AddPath(StarPoints(new Vector2(325, 75), 5, 50, 25, 0, false));

            _widthStar = pathBuilder.Stroke(_gradWidth, PathType.Open);
            _lengthStar = pathBuilder.Stroke(_gradLength, Matrix.CreateTranslation(0, 125, 0), PathType.Open);
        }
Exemplo n.º 2
0
        public GradientPens()
        {

            _gradWidth = new GradientPen(Microsoft.Xna.Framework.Color.Lime, Microsoft.Xna.Framework.Color.Blue, 15);
            _gradLength = new PathGradientPen(Microsoft.Xna.Framework.Color.Lime, Microsoft.Xna.Framework.Color.Blue, 15);

            PathBuilder pathBuilder = new PathBuilder() { CalculateLengths = true };
            pathBuilder.AddPath(StarPoints(new CCVector2(325, 75), 5, 50, 25, 0, false));

            _widthStar = pathBuilder.Stroke(_gradWidth, PathType.Open);
            _lengthStar = pathBuilder.Stroke(_gradLength, 
                CCAffineTransform.Translate(CCAffineTransform.Identity, 0, 125, 0), 
                PathType.Open);
        }
Exemplo n.º 3
0
        private void InitializePaths()
        {
            var bounds = VisibleBoundsWorldspace;
            var center = bounds.Center;
            //var center = new CCVector2(200, 200);

            Pen lilypadPen = new Pen(CCColor4B.Green, 15)
            {
                Alignment = PenAlignment.Center
            };

            _lilypadPath = BuildLillyPad(center, 150, 0);
            _lilypadStroke = _lilypadPath.Stroke(lilypadPen, PathType.Closed);

            Pen outerFlowerPen = new Pen(CCColor4B.White * 0.75f, 15)
            {
                Alignment = PenAlignment.Outset
            };

            _outerFlowerStroke = BuildFlower(center, 8, 120, 100, (float)(Math.PI / 8)).Stroke(outerFlowerPen, PathType.Closed);

            Pen innerFlowerPen = new Pen(Microsoft.Xna.Framework.Color.MediumPurple * 0.5f, 10)
            {
                Alignment = PenAlignment.Outset
            };

            _innerFlowerStroke = BuildFlower(center, 16, 105, 60, 0).Stroke(innerFlowerPen, PathType.Closed);
        }
Exemplo n.º 4
0
        private GraphicsPath CreateFlowerGP (Pen pen, Vector2 center, int petalCount, float petalLength, float petalWidth, float rotation)
        {
            List<Vector2> points = StarPoints(center, petalCount / 2, petalLength, petalLength, rotation, false);

            PathBuilder builder = new PathBuilder();
            builder.AddPoint(center);

            foreach (Vector2 point in points) {
                builder.AddArcByPoint(point, petalWidth / 2);
                builder.AddArcByPoint(center, petalWidth / 2);
            }

            return builder.Stroke(pen, PathType.Closed);
        }
        public override void Setup (GraphicsDevice device)
        {
            _gradWidthInner = new GradientPen(Color.Lime, Color.Cyan, 15) { Alignment = PenAlignment.Inset, StartCap = LineCap.Square, EndCap = LineCap.Square };
            _gradWidthCenter = new GradientPen(Color.Lime, Color.Cyan, 15) { StartCap = LineCap.Square, EndCap = LineCap.Square };
            _gradWidthOuter = new GradientPen(Color.Lime, Color.Cyan, 15) { Alignment = PenAlignment.Outset, StartCap = LineCap.Square, EndCap = LineCap.Square };

            Pen[] pens = new Pen[] { _gradWidthInner, _gradWidthCenter, _gradWidthOuter };
            for (int i = 0; i < _gPaths.Length; i++) {
                PathBuilder builder = new PathBuilder();
                foreach (Vector2 v in _baseCoords)
                    builder.AddPoint(v + Offset(i));
                _gPaths[i] = builder.Stroke(pens[i]);
            }
        }
        public GradientPensAlignment()
        {
            _gradWidthInner = new GradientPen(Microsoft.Xna.Framework.Color.Lime, Microsoft.Xna.Framework.Color.Cyan, 15) { Alignment = PenAlignment.Inset, StartCap = LineCap.Square, EndCap = LineCap.Square };
            _gradWidthCenter = new GradientPen(Microsoft.Xna.Framework.Color.Lime, Microsoft.Xna.Framework.Color.Cyan, 15) { StartCap = LineCap.Square, EndCap = LineCap.Square };
            _gradWidthOuter = new GradientPen(Microsoft.Xna.Framework.Color.Lime, Microsoft.Xna.Framework.Color.Cyan, 15) { Alignment = PenAlignment.Outset, StartCap = LineCap.Square, EndCap = LineCap.Square };

            Pen[] pens = new Pen[] { _gradWidthInner, _gradWidthCenter, _gradWidthOuter };
            for (int i = 0; i < _gPaths.Length; i++)
            {
                PathBuilder builder = new PathBuilder();
                foreach (CCVector2 v in _baseCoords)
                    builder.AddPoint(v + Offset(i));
                _gPaths[i] = builder.Stroke(pens[i]);
            }
        }
Exemplo n.º 7
0
        private void InitializePaths ()
        {
            Vector2 center = new Vector2(200, 200);

            Pen lilypadPen = new Pen(Color.Green, 15) {
                Alignment = PenAlignment.Center
            };

            _lilypadPath = BuildLillyPad(center, 150, 0);
            _lilypadStroke = _lilypadPath.Stroke(lilypadPen, PathType.Closed);

            Pen outerFlowerPen = new Pen(Color.White * 0.75f, 15) {
                Alignment = PenAlignment.Outset
            };

            _outerFlowerStroke = BuildFlower(center, 8, 120, 100, (float)(Math.PI / 8)).Stroke(outerFlowerPen, PathType.Closed);

            Pen innerFlowerPen = new Pen(Color.MediumPurple * 0.5f, 10) {
                Alignment = PenAlignment.Outset
            };

            _innerFlowerStroke = BuildFlower(center, 16, 105, 60, 0).Stroke(innerFlowerPen, PathType.Closed);
        }