【问题标题】:Core Graphics rounded corner not sharp核心显卡圆角不锋利
【发布时间】:2016-04-05 11:34:05
【问题描述】:

我正在绘制圆角矩形。问题 - 角落不锋利。这个问题有解决办法吗?

这是我的绘图代码 (Xamarin)

var thickness = (nfloat)Math.Min (Math.Min (_renderer.View.Thickness.Left, _renderer.View.Thickness.Right), Math.Max (_renderer.View.Thickness.Top, _renderer.View.Thickness.Bottom));
var path = UIBezierPath.FromRoundedRect (new CGRect(this.Bounds.X + thickness / 2, this.Bounds.Y + thickness / 2, this.Bounds.Width - thickness, this.Bounds.Height - thickness), (nfloat)_renderer.View.CornerRadius);

context.SetShouldAntialias (true);
context.SetStrokeColor (_renderer.View.Color.ToCGColor ());
context.SetFillColor (_renderer.View.BackgroundColor.ToCGColor ());
path.LineWidth = thickness;

path.Fill ();
path.Stroke ();

【问题讨论】:

标签: ios xamarin core-graphics rounded-corners antialiasing


【解决方案1】:

你为什么不使用圆角半径来代替?

顺便说一句,您必须检查图层的比例属性。它必须设置为与主视图比例相同的值(即:视网膜设备上的 2)。默认为 1。

【讨论】:

    猜你喜欢
    • 2016-04-15
    • 1970-01-01
    • 1970-01-01
    • 2013-07-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-05-08
    相关资源
    最近更新 更多