我在上下文中添加了一条贝塞尔路径,如下所示
for (Face* face in facesArray) {
UIBezierPath* customPath = [UIBezierPath bezierPath];
[customPath moveToPoint:face.rightEyePosition];
[customPath addQuadCurveToPoint:face.leftEyePosition controlPoint:face.foreheadPosition];
[customPath addQuadCurveToPoint:face.mouthPosition controlPoint:face.lowerLeftContrlPoint];
[customPath moveToPoint:face.rightEyePosition];
[customPath addQuadCurveToPoint:face.mouthPosition controlPoint:face.lowerRightContrlPoint];
UIGraphicsBeginImageContextWithOptions(originalImage.size, NO, 0.0);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextBeginPath (context);
CGContextAddPath(context,customPath.CGPath);
CGContextClosePath (context);
CGContextClip (context);
[imageView.image drawInRect: CGRectMake(0, 0, imageView.image.size.width, imageView.image.size.height)];
UIImage* resultImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
}
上面的代码根据贝塞尔形状裁剪图像。我希望裁剪图像的边框透明。我应该如何设置角ob bezier路径的透明度