gle*_*udr 5 objective-c uiimage cgimage ios
想象一下,我有一个UIImage.我需要旋转然后在全局坐标系(而不是UIImage坐标系)中裁剪它.因此,生成的图像将被裁剪和旋转.
我怎样才能做到这一点?CGImageCreateWithImageInRect将仅在图像相对坐标中裁剪图像.

PS在评论中回答.你应该使用CIImage.
也许这可以帮助
//init
CIImage *image = [CIImage imageWithCGImage:CGImageRef];
//rotation
CIImage *rotatedImage = [image imageByApplyingTransform:someTransform];
//crop
CIImage *croppedImage = [rotatedImage imageByCroppingToRect:someRect];
Run Code Online (Sandbox Code Playgroud)