【问题标题】:How to fill space between two UIBezierPaths如何填充两个 UIBezierPaths 之间的空间
【发布时间】:2023-04-06 14:32:01
【问题描述】:

我正在开发绘图应用程序,该应用程序提供具有可变线宽的绘图线,这取决于绘图速度。这种行为受到 Paper 应用程序的启发。

我正在尝试实现的算法——绘制两条距离可变的贝塞尔路径。 sosborn's answer 中描述的解决方案。然后平滑路径并填充它们之间的距离。

其实我不知道如何填充路径之间的空间。

【问题讨论】:

    标签: iphone ios ipad core-graphics uibezierpath


    【解决方案1】:

    您从 2 条贝塞尔曲线创建一条路径并对其进行填充,如下所示:

    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];
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-05-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多