コード例 #1
0
ファイル: WaterLilly.cs プロジェクト: Luckyknight1/LilyPath
        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);
        }
コード例 #2
0
        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]);
            }
        }
コード例 #3
0
        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]);
            }
        }
コード例 #4
0
ファイル: Game1.cs プロジェクト: Luckyknight1/LilyPath
        private static PathBuilder BuildLillyPad (Vector2 center, int radius, float rotation)
        {
            float segment = (float)(Math.PI * 2 / 32);

            PathBuilder builder = new PathBuilder();

            builder.AddPoint(center);
            builder.AddLine(radius, segment * 25 + rotation);
            builder.AddArcByAngle(center, segment * 30, radius / 2);

            return builder;
        }
コード例 #5
0
ファイル: Game1.cs プロジェクト: Luckyknight1/LilyPath
        private static PathBuilder BuildFlower (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;
        }