iphone 使用Core Graphics 剪贴图片
2010-10-22 20:56
239 查看
(void)cutOutImage:(UIImage *)cutedImage{
//设置要保存图片的大小
CGSize subImageSize=cutLocation.textureRect.size;
//初始化一个矩形,这个矩形是设置剪贴以后图片得大小
CGRect subImageRect=CGRectMake(KcutStartX, KcutStartY, KcutWidth, KcutHeight);
CGImageRef imageRef=cutedImage.CGImage;
CGImageRef subImageRef=CGImageCreateWithImageInRect(imageRef, subImageRect);
UIGraphicsBeginImageContext(subImageSize);
CGContextRef context=UIGraphicsGetCurrentContext();
CGContextDrawImage(context, subImageRect, subImageRef);
//得到新得图片
UIImage *subImage=[UIImage imageWithCGImage:subImageRef];
UIGraphicsEndImageContext();
}
//设置要保存图片的大小
CGSize subImageSize=cutLocation.textureRect.size;
//初始化一个矩形,这个矩形是设置剪贴以后图片得大小
CGRect subImageRect=CGRectMake(KcutStartX, KcutStartY, KcutWidth, KcutHeight);
CGImageRef imageRef=cutedImage.CGImage;
CGImageRef subImageRef=CGImageCreateWithImageInRect(imageRef, subImageRect);
UIGraphicsBeginImageContext(subImageSize);
CGContextRef context=UIGraphicsGetCurrentContext();
CGContextDrawImage(context, subImageRect, subImageRef);
//得到新得图片
UIImage *subImage=[UIImage imageWithCGImage:subImageRef];
UIGraphicsEndImageContext();
}
相关文章推荐
- iphone 使用Core Graphics 剪贴图片
- iphone 使用Core Graphics 合成图片
- iphone-CoreGraphics切割图片
- iOS开发的2D绘制--CoreGraphics的简单使用三(画文字和图片)
- iphone:使用NSURLConnection下载网络图片
- 使用CoreGraphics中的函数画线条
- iphone 怎么使用图片选取器 UIImagePickerController
- iOS8使用Core Graphics实现渐变效果-Swift基础教程
- 使用Core Graphics绘画一个山寨微信icon
- iOS开发的2D绘制--CoreGraphics的简单使用二(画图形)
- 【转】使用Core Graphics绘画一个山寨微信icon
- iOS底层绘图机制,CoreGraphics框架,和Context使用详解
- iphone ios core image core graphics core video定义及区别
- Swift - Core Graphics绘图框架详解4(绘制图片、图形变换)
- iOS底层绘图机制,CoreGraphics框架,和Context使用详解
- 在lion 中使用xcode4.2.1 和 Core Plot 0.9版本对iphone 手机应用开发 图表
- CSS3制作精美的iphone电话图标,不使用图片
- iOS底层绘图机制,CoreGraphics框架,和Context使用详解
- iphone 数据存储--Core-Data的使用
- Graphics 导出图片使用【这个主要是画图类图的使用,记录一下】