[英]Appearance of drawn circle on the apple watch is not smooth enough. How can I do it better?
One approach I tried is the following:我尝试的一种方法如下:
let circle = Circle.init()
let path = circle.path(in: kServiceRightFrame)
let serviceRightPath = UIBezierPath.init(cgPath: path.cgPath)
serviceRightPath.lineWidth = 2.0
serviceRightPath.fill()
serviceRightPath.stroke()
I played around with flatness too, but that did not get the job done either.我也玩过平坦度,但这也没有完成工作。 How can a smoother looking circle be drawn programmatically?
如何以编程方式绘制更平滑的圆?
EDIT:A more extensive view of my code:编辑:我的代码的更广泛的视图:
UIGraphicsBeginImageContext(kWatchInterfaceSize)
let context = UIGraphicsGetCurrentContext()
//draw service path
kSBScoreLabelFontColor.setStroke()
kSBServiceBallColor.setFill()
---> code from above
// Convert to UIImage
let cgimage = context!.makeImage()
//create scoreboardimage
let scoreBoardImage = UIImage(cgImage: cgimage!)
// End the graphics context'
UIGraphicsEndImageContext()
George put me on the right track.乔治让我走上了正轨。 It was a scaling issue.
这是一个扩展问题。 The code that I changed was the following:
我更改的代码如下:
//Replaced this
//UIGraphicsBeginImageContext(kWatchInterfaceSize)
//with this
UIGraphicsBeginImageContextWithOptions(kWatchInterfaceSize,
false, 4.0)
That fixed it.那解决了它。 Now the circle looks a lot smoother in appearance.
现在这个圆圈在外观上看起来更平滑了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.