iPhone - How do I draw a CGImage on anouther CGImage
- (UIImage*) getImage {开发者_StackOverflow
CGImage imgA = ....
CGImage imgB = ....
// ...
// I want to draw imgA onto imgB and return the result
Do I need a Graphics then use CGContextDrawImage();
or can I do it another way?
- Create a context. (e.g. a Bitmap context CGBitmapContextCreate)
- Draw image A with CGContextDrawImage
- Draw image B with CGContextDrawImage
- Obtain the composited image with CGBitmapContextCreateImage (if you are using a Bitmap context)
This blog post has a code sample:
http://www.realdevelopers.com/blog/code/compositing-two-uiimages-in-objective-c
精彩评论