合成图片的两种方法,思路都是一样的
2014-10-17 14:37
113 查看
- (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创建一个新用户两种方法作用都是一样的
- 合成图片的两种方法
- 两种方法获取的类型都是一样的
- Android:将数字画在图片上合成一张图的两种实现方法(二)
- Android:将数字画在图片上合成一张图的两种实现方法(一)
- PHP基于imagick扩展实现合成图片的两种方法【附imagick扩展下载】
- 保存图片,文本文件,word文档等等方法都是一样的
- 动态改变TabActivity标签的tab图片的两种方法浅析
- ASPX保存远程图片到本地的两种方法的函数
- VC下加载JPG/GIF/PNG图片的两种方法
- VC中获取BMP图片高度与宽度的两种方法
- 合成图片的简单方法示例
- 两种修改png图片颜色方法的对比/游戏帧速度处理/J2me中实现淡入淡出效果
- 图片循环滚动的两种方法
- 图片保存的两种方法
- 两种方法 向 Excel中插入图片
- VC采用GDI+合成JPEG图片的方法
- 两种AS3加载图片的方法
- Gridview显示图片的两种方法