CloseSubpath() public method

public CloseSubpath ( ) : void
return void
コード例 #1
0
ファイル: Extensions.cs プロジェクト: nagyist/AppStoreWindow
        internal static CGPath CreateClippingPath(RectangleF rect, float radius)
        {
            var path = new CGPath();
            path.MoveToPoint(rect.GetMinX(), rect.GetMinY());
            path.AddLineToPoint(rect.GetMinX(), rect.GetMaxY() - radius);
            path.AddArcToPoint(rect.GetMinX(), rect.GetMaxY(), rect.GetMinX() + radius, rect.GetMaxY(), radius);
            path.AddLineToPoint(rect.GetMaxX() - radius, rect.GetMaxY());
            path.AddArcToPoint(rect.GetMaxX(), rect.GetMaxY(), rect.GetMaxX(), rect.GetMaxY() - radius, radius);
            path.AddLineToPoint(rect.GetMaxX(), rect.GetMinY());
            path.CloseSubpath();

            return path;
        }
コード例 #2
0
        /// <summary>
        /// Draws a polygon. The polygon can have stroke and/or fill.
        /// </summary>
        /// <param name="points">The points.</param>
        /// <param name="fill">The fill color.</param>
        /// <param name="stroke">The stroke color.</param>
        /// <param name="thickness">The stroke thickness.</param>
        /// <param name="dashArray">The dash array.</param>
        /// <param name="lineJoin">The line join type.</param>
        /// <param name="aliased">If set to <c>true</c> the shape will be aliased.</param>
        public override void DrawPolygon(IList<ScreenPoint> points, OxyColor fill, OxyColor stroke, double thickness, double[] dashArray, LineJoin lineJoin, bool aliased)
        {
            this.SetAlias (aliased);
            var convertedPoints = (aliased ? points.Select (p => p.ConvertAliased ()) : points.Select (p => p.Convert ())).ToArray ();
            if (fill.IsVisible ()) {
                this.SetFill (fill);
                using (var path = new CGPath ()) {
                    path.AddLines (convertedPoints);
                    path.CloseSubpath ();
                    this.gctx.AddPath (path);
                }

                this.gctx.DrawPath (CGPathDrawingMode.Fill);
            }

            if (stroke.IsVisible () && thickness > 0) {
                this.SetStroke (stroke, thickness, dashArray, lineJoin);

                using (var path = new CGPath ()) {
                    path.AddLines (convertedPoints);
                    path.CloseSubpath ();
                    this.gctx.AddPath (path);
                }

                this.gctx.DrawPath (CGPathDrawingMode.Stroke);
            }
        }