问题
I am wondering how to combine drawn pixels in a UIView with the image in a UIImageView and save it as a new image? I have no clue how to go about this.
If anyone could point me in the right direction, I would love it.
Thank you!
回答1:
Check out Quartz 2D. Specifically, CGContextDrawImage() can be used to load an image, draw whatever you want on this context, and then you can CGBitmapContextCreateImage() to create a CGImageRef from which you can create an image with UIImage's imageWithCGImage. Finally, you use UIImagePngRepresentation() or UIImageJPEGRepresentation() to get a NSData that you can then use writeToFile with.
来源:https://stackoverflow.com/questions/10126729/how-to-combine-drawn-pixels-in-a-uiview-with-the-image-in-a-uiimageview-and-save