1

我目前正在 UIBezierPath 中绘制 UIImage,如下所示:

UIGraphicsBeginImageContextWithOptions(rect.size, NO, 0);
UIBezierPath *polygonPath = [UIBezierPath bezierPath];

CGPoint curPoint = [self originalPoint:[[drawArray objectAtIndex:0]CGPointValue]];

// set the starting point for the lines
[polygonPath moveToPoint:curPoint];

// go through each point in drawArray and add it to polygonPath
for(NSInteger i = 1; i < [drawArray count]; i++) {
    curPoint = [self originalPoint:[[drawArray objectAtIndex:i]CGPointValue]];
    // scale point
    curPoint = CGPointMake(curPoint.x, curPoint.y);

    [polygonPath addLineToPoint:curPoint];
}

[polygonPath closePath];

[polygonPath addClip];

[image drawAtPoint:CGPointZero];

它效果很好,但是我希望图像具有“平滑边缘”,略微透明,因为我正在将它绘制在另一个图像之上......现在边缘非常粗糙。

谢谢你的帮助!

4

1 回答 1

0

当您在图像上绘图时。所以我建议你使用下面的代码......

其中 YourImage 是您在其上绘制线条的 UIImage。

[[UIColor colorWithPatternImage:YourImage] set];

有关更多信息,请访问此参考

希望对你有帮助...

于 2012-04-30T02:15:47.623 回答