开发者

How to smooth the edge of a zig-zag line?

开发者 https://www.devze.com 2022-12-29 14:32 出处:网络
Currently I draw a zig-zap line by CGContextMoveToPoint, CGContextAddLineToPoint, and CGContextStrokePath, following touchesMoved events. How can I smoo开发者_开发问答th the edges of the line? Such th

Currently I draw a zig-zap line by CGContextMoveToPoint, CGContextAddLineToPoint, and CGContextStrokePath, following touchesMoved events. How can I smoo开发者_开发问答th the edges of the line? Such that when the user draw a circle-like shape, the circle can be more round'ed. The GLPaint example use OpenGL, is that the only way to do it?


You can simply set the line join to round, to make the edges less visible:

CGContextSetLineJoin(ctx, kCGLineJoinRound);

Other than that you option would be to use some kind of spline interpolation.

0

精彩评论

暂无评论...
验证码 换一张
取 消