iOS UIImage 图像旋转
来源:互联网 发布:php 数值比较 编辑:程序博客网 时间:2024/04/29 01:36
/* iOS UIImage 图像旋转 vImg:待旋转的图 vAngle:旋转角度 vIsExpand:是否扩展,如果不扩展,那么图像大小不变,但被截掉一部分 */- (UIImage*)rotateImageWithAngle:(UIImage*)vImg Angle:(CGFloat)vAngle IsExpand:(BOOL)vIsExpand{ CGSize imgSize = CGSizeMake(vImg.size.width * vImg.scale, vImg.size.height * vImg.scale); CGSize outputSize = imgSize; if (vIsExpand) { CGRect rect = CGRectMake(0, 0, imgSize.width, imgSize.height); //旋转 rect = CGRectApplyAffineTransform(rect, CGAffineTransformMakeRotation(vAngle*M_PI/180.0)); //NSLog(@"rotateImageWithAngle, size0:%f, size1:%f", imgSize.width, rect.size.width); outputSize = CGSizeMake(CGRectGetWidth(rect), CGRectGetHeight(rect)); } UIGraphicsBeginImageContext(outputSize); CGContextRef context = UIGraphicsGetCurrentContext(); CGContextTranslateCTM(context, outputSize.width / 2, outputSize.height / 2); CGContextRotateCTM(context, vAngle*M_PI/180.0); CGContextTranslateCTM(context, -imgSize.width / 2, -imgSize.height / 2); [vImg drawInRect:CGRectMake(0, 0, imgSize.width, imgSize.height)]; UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return image;}
0 0
- iOS UIImage 图像旋转
- UIImage图像旋转
- UIImage图像--IOS开发
- ios 中图片uiimage旋转
- UIImage 图像-IOS开发
- UIImage 图像-IOS开发
- iOS:UIImage详解&图像处理
- UIImage 图像-IOS开发
- UIImage 图像-IOS开发
- [ios image]UIImage 图像-IOS开发
- ios修正图像旋转
- UIImage旋转
- UIImage 图像-IOS开发 (实例)
- UIImage 图像
- IOS 图像OPENGLES中的旋转
- iOS 相册图片,相机图片被旋转问题 uiimage orientation
- 旋转翻转UIImage 不是UIImageView 适用于源图像的处理,例如截图后旋转
- 旋转翻转UIImage 不是UIImageView 适用于源图像的处理,例如截图后旋转----改变图片大小
- 项目license证书文件找不到
- C/C++中struct和typedef struct
- 利用阿里云搭建NFS服务器
- 网络基本功(八):细说TCP滑动窗口
- 字节对齐注意事项
- iOS UIImage 图像旋转
- Linux下Git用法总结
- 一半圆角矩形
- MongoDB权威指南-增删查改
- FreeRTOS系列第17篇---FreeRTOS队列
- C语言变量名命名规则
- 【网络基本功(九)】细说TCP重传
- 设计模式——职责链
- Android获取本地图片展示GridView