How to fill space between two UIBezierPaths

烈酒焚心 提交于 2019-12-23 04:28:16

问题


I'm working on drawing application which provides drawing lines with variable line width which depends on drawing speed. This behavior inspired by Paper app.

Algorithm which I'm trying to implement -- draw two bezier path with variable distance between them. The solution which described in sosborn's answer. Then smooth paths and fill the distance between them.

Actually I don't figured out how to fill space between paths.


回答1:


You create a single path from the 2 bezier curves and fill it, like this:

NSBezierPath* path = [NSBezierPath bezierPath];

// Move to the start point
[path moveToPoint:startPt];

// Make the lower part of the curve
[path curveToPoint:endPt controlPoint1:cp1 controlPoint2:cp2];

// Make the upper part of the curve as part of the same path:
[path curveToPoint:startPt contorPoint1:cp3 controlPoint2:cp4];

// Now fill it
[path fill];


来源:https://stackoverflow.com/questions/12370841/how-to-fill-space-between-two-uibezierpaths

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!