正文
UIBezierPath *aPath = [UIBezierPath bezierPath];
//起点
NSValue * v = pointArr[0];
CGPoint p = [v CGPointValue];
CGPoint m_p = [self convertCGPoint:p fromRect1:imageV.frame.size toRect2:imageV.frame.size];
[aPath moveToPoint:m_p];
//其他点
for (int i = 1; i< pointArr.count; i++) {
NSValue * v1 = pointArr[i];
CGPoint p1 = [v1 CGPointValue];
CGPoint m_p = [self convertCGPoint:p1 fromRect1:imageV.frame.size toRect2:imageV.frame.size];
[aPath addLineToPoint:m_p];
}
[aPath closePath];
[aPath fill];
//遮罩层
UIImage *mask = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIGraphicsBeginImageContextWithOptions(rect.size, NO, 0.0);
CGContextClipToMask(UIGraphicsGetCurrentContext(), rect, mask.CGImage);
[imageV.image drawAtPoint:CGPointZero];
UIImage *maskedImage = UIGraphicsGetImageFromCurrentImageContext();