【发布时间】:2011-05-12 19:05:06
【问题描述】:
#define radians(degrees) (degrees * M_PI/180)
UIImage *rotate(UIImage *image) {
CGSize size = image.size;;
UIGraphicsBeginImageContext(size);
CGContextRef context = UIGraphicsGetCurrentContext();
// If this is commented out, image is returned as it is.
CGContextRotateCTM (context, radians(90));
[image drawInRect:CGRectMake(0, 0, size.width, size.height)];
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return newImage;
}
会不会有其他问题?没有想法。
【问题讨论】:
-
在catamount.com/blog/1015/…查看 Hardy Macia 的简单而令人敬畏的代码,谢谢 Hardy Macia!
标签: iphone objective-c ios core-graphics