0
我想在90度用此方法旋轉的UIImage:旋轉UIImage的給予空白的UIImage
static inline double radians (double degrees) {return degrees * M_PI/180;}
UIImage* rotate(UIImage* src, UIImageOrientation orientation)
{
UIGraphicsBeginImageContext(src.size);
CGContextRef context = UIGraphicsGetCurrentContext();
if (orientation == UIImageOrientationRight) {
CGContextRotateCTM (context, radians(90));
} else if (orientation == UIImageOrientationLeft) {
CGContextRotateCTM (context, radians(-90));
} else if (orientation == UIImageOrientationDown) {
// NOTHING
} else if (orientation == UIImageOrientationUp) {
CGContextRotateCTM (context, radians(90));
}
[src drawAtPoint:CGPointMake(0, 0)];
return UIGraphicsGetImageFromCurrentImageContext();
}
的問題是,它給我一個空白的UIImage
我發現CIImage範圍在旋轉後不會改變。任何建議?我的圖像的displayImage.extents是640 x 480.旋轉後,displayImage.extents仍然是640 x 480。 – Christopher