private void DrawBorder(CGContext ctx) { if (!HasBorder()) { return; } if (IsBorderDashed()) { ctx.SetLineDash(0, new [] { (nfloat)_dashWidth, (nfloat)_dashGap }); } // Stroke is inner, the outer will be clipped. So double the value to get the real one! ctx.SetLineWidth(2 * _strokeWidth); ctx.AddPath(GetClipPath()); if (_strokeGradientProvider != null && _strokeGradientProvider.HasGradient) { ctx.ReplacePathWithStrokedPath(); ctx.Clip(); _strokeGradientProvider.DrawGradient(ctx, Bounds); } else if (_strokeColor != null) { ctx.SetStrokeColor(_strokeColor.CGColor); ctx.DrawPath(CGPathDrawingMode.Stroke); } }
private void DrawGradient(CGContext ctx) { if (_gradientProvider != null && _gradientProvider.HasGradient) { _gradientProvider.DrawGradient(ctx, Bounds); } else if (_color != null) { ctx.SetFillColor(_color.CGColor); ctx.AddPath(GetClipPath()); ctx.DrawPath(CGPathDrawingMode.Fill); } }