While researching about image manipulation for my next project, I came across an interesting piece of code, using which, we can merge two images into a single image. Here's the code:
-(UIImage*)mergeImage:(UIImage*)mask overImage:(UIImage*)source inSize:(CGSize)size
{
//Capture image context ref
UIGraphicsBeginImageContext(size);
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
//Draw images onto the context
[source drawInRect:CGRectMake(0, 0, source.size.width, source.size.height)];
[mask drawInRect:CGRectMake(0, 0, mask.size.width, mask.size.height)];
return viewImage;
}
Got the reference from here.
Subscribe to:
Post Comments (Atom)
Popular Posts
-
I spent a long time to config them. so tired, but now it run very good. It's work. Step 1: Download Source PhoneGap at PhoneGap.com...
-
Để chuyển 1 file .app sang .ipa đầu tiên các bận cần có là 1 file .app, trong hướng dẫn mình sử dụng file Tuvi.app 1. Mở xcode len 2. Men...
-
Trong bài này mình sẽ giới thiệu với các bạn về lập trình Socket(bài này mình chỉ nói đến lập trình Socket cho TCP/IP) trong Android. Lập ...
-
Xử lý ngày tháng trong PHP Trừ ngày $date = "2009-03-02"; $new_date = strtotime ( '-2 day' , strtotime ( $date ) ) ; ...
No comments:
Post a Comment