我目前正在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];
它的效果非常好,但是我希望图像具有“光滑的边缘”,略微透明,因为我将它绘制在另一个图像的顶部...现在边缘非常粗糙。
感谢您的帮助!
答案 0 :(得分:0)
当您在图像上绘图时。所以我建议你使用以下代码......
其中YourImage是您正在绘制线条的UIImage。
[[UIColor colorWithPatternImage:YourImage] set];
希望,这会对你有帮助......