我正在使用CAShapeLayer
旋转视图并屏蔽视图的形状。我有绘制形状的视图框架和bezier路径,当我使用CGContext
绘制它的大小形状时,它正在切割我的形状的边缘。这是我的代码:
- (UIImage*) crop:(UIImage*)image rect:(CGRect)rect withRadian:(CGFloat)radian
{
float degree = RADIANS_TO_DEGREES(radian);
// // translated rectangle for drawing sub image
// float degree1 = fabsf(degree);
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
// translated rectangle for drawing sub image
CGRect drawRect = CGRectMake(-rect.origin.x, -rect.origin.y, image.size.width, image.size.height);
// grab image
UIImage* croppedImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return croppedImage;
}
有谁能告诉我这是什么问题?