合成图片的两种方法,思路都是一样的
2013-01-18 09:48
253 查看
- (void)viewDidLoad {
[super
viewDidLoad];
CGRect frame=
CGRectMake(520,
280, 320,
480);
CGImageRef small;
small=
CGImageCreateWithImageInRect([[UIImage
imageNamed:@"3.png"]
CGImage],frame);
UIImageView *test=[[UIImageView
alloc] initWithImage:[UIImage
imageWithCGImage:small]];
[self.view
addSubview:test];
[test
release];
}
合成图片的两种方法,思路都是一样的
// Image+Image ICON
- (UIImage *)addImage:(UIImageView *)image1 toImage:(UIImageView *)image2 {
CGSize size=
CGSizeMake( image1.frame.size.width,image1.frame.size.height);
UIGraphicsBeginImageContext(size);
// Draw image1
[image2.image
drawInRect:CGRectMake(6,
6, image2.frame.size.width, image2.frame.size.height)];
// Draw image2
[image1.image
drawInRect:CGRectMake(0,
0, image1.frame.size.width, image1.frame.size.height)];
UIImage *resultingImage =
UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return resultingImage;
}
- (UIImage *)addImageview:(UIImage *)image1 toImage:(UIImage *)image2 {
CGSize size=
CGSizeMake( image1.size.width,image1.size.height);
UIGraphicsBeginImageContext(size);
// Draw image1
[image2
drawInRect:CGRectMake(4.5,
6, 77,
77)];
// Draw image2
[image1
drawInRect:CGRectMake(0,
0, image1.size.width, image1.size.height)];
UIImage *resultingImage =
UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return resultingImage;
}
[super
viewDidLoad];
CGRect frame=
CGRectMake(520,
280, 320,
480);
CGImageRef small;
small=
CGImageCreateWithImageInRect([[UIImage
imageNamed:@"3.png"]
CGImage],frame);
UIImageView *test=[[UIImageView
alloc] initWithImage:[UIImage
imageWithCGImage:small]];
[self.view
addSubview:test];
[test
release];
}
合成图片的两种方法,思路都是一样的
// Image+Image ICON
- (UIImage *)addImage:(UIImageView *)image1 toImage:(UIImageView *)image2 {
CGSize size=
CGSizeMake( image1.frame.size.width,image1.frame.size.height);
UIGraphicsBeginImageContext(size);
// Draw image1
[image2.image
drawInRect:CGRectMake(6,
6, image2.frame.size.width, image2.frame.size.height)];
// Draw image2
[image1.image
drawInRect:CGRectMake(0,
0, image1.frame.size.width, image1.frame.size.height)];
UIImage *resultingImage =
UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return resultingImage;
}
- (UIImage *)addImageview:(UIImage *)image1 toImage:(UIImage *)image2 {
CGSize size=
CGSizeMake( image1.size.width,image1.size.height);
UIGraphicsBeginImageContext(size);
// Draw image1
[image2
drawInRect:CGRectMake(4.5,
6, 77,
77)];
// Draw image2
[image1
drawInRect:CGRectMake(0,
0, image1.size.width, image1.size.height)];
UIImage *resultingImage =
UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return resultingImage;
}
相关文章推荐
- 合成图片的两种方法,思路都是一样的
- 合成图片的两种方法
- owb之使用OWB安全UI使目标方案称为OWB用户和repository assistant创建一个新用户两种方法作用都是一样的
- PHP基于imagick扩展实现合成图片的两种方法【附imagick扩展下载】
- 两种方法获取的类型都是一样的
- Android:将数字画在图片上合成一张图的两种实现方法(一)
- Android:将数字画在图片上合成一张图的两种实现方法(二)
- 保存图片,文本文件,word文档等等方法都是一样的
- VS 2008创建sql数据库(图片都是自己弄的转载的只是方法)
- AE 将地图导出为图片的两种方法
- Python读取并显示图片的两种方法
- Android从Camera中获取图片的两种方法
- 图片旋转的两种方法
- javascript图片延迟加载实现方法及思路
- php图片合成方法(多张图片合成一张)
- 将图片保存到系统相冊的两种方法
- 拉伸图片的两种方法
- UIScrollView+UIPageControl+NSTimer 图片自动滚动的两种实现方法
- 两种php实现图片上传的方法
- SpringBoot限制文件或图片上传大小的两种配置方法