画图片
2016-02-29 11:25
113 查看
`- (void)rotateTapped:(id)sender {
UIImage *currentImage = _imageView.image;
CGImageRef currentCGImage = currentImage.CGImage;
}
`
UIImage *currentImage = _imageView.image;
CGImageRef currentCGImage = currentImage.CGImage;
CGSize originalSize = currentImage.size; CGSize rotatedSize = CGSizeMake(originalSize.height, originalSize.width); CGContextRef context = CGBitmapContextCreate(NULL, rotatedSize.width, rotatedSize.height, CGImageGetBitsPerComponent(currentCGImage), CGImageGetBitsPerPixel(currentCGImage) * rotatedSize.width, CGImageGetColorSpace(currentCGImage), CGImageGetBitmapInfo(currentCGImage)); CGContextTranslateCTM(context, rotatedSize.width, 0.0f); CGContextRotateCTM(context, M_PI_2); CGContextDrawImage(context, (CGRect){.origin=CGPointZero, .size=originalSize}, currentCGImage); CGImageRef newCGImage = CGBitmapContextCreateImage(context); UIImage *newImage = [UIImage imageWithCGImage:newCGImage]; self.imageView.image = newImage;
}
`
相关文章推荐
- 游程编码问题
- Linux关闭防火墙
- 解决SharePoint2013产品过期问题
- Nginx在安装过程经常出现的问题
- bzoj 1015: [JSOI2008]星球大战starwar
- imooc movie
- iOS开发--xcode快捷键
- iOS打电话
- STP协议的形象化理解
- iOS开发之首次启动引导页的两种处理方法简析
- JavaScript实现斗地主游戏的思路
- EditText监听方法以及关闭软键盘
- const的用法详解
- SVN切换账号(TortoiseSVN+IDE)
- 扫描线算法
- iOS开发笔记--xcode7安装Alcatraz插件管理器
- 跳跃表-随机化数据结构
- iOS/mac开发的一些知名个人博客
- 为什么学习linux,知乎转载
- Android使用BitmapFactory.Options解决加载大图片内存溢出问题