图像旋转切边直立

时间:2017-03-04 05:22:44

标签: objective-c image rotation drawing image-rotation

我正在使用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;
}

有谁能告诉我这是什么问题?

0 个答案:

没有答案