UIGraphicsBeginImageContext wasteful?

502 views Asked by At

Is it not wasteful that there is a requirement that if you want to draw into a UIImage, that it always has to be into a new UIImage created with UIGraphicsBeginImageContext?

If frequent drawing needs to happen, why not let us draw into a preexisting UIImage?

Or is there a way to do this already?

2

There are 2 answers

0
Richard J. Ross III On

This is because UIImage is not mutable. If you are constantly rendering to a new CGBitmapContext, then you are doing something wrong in your application.

3
Omar Abdelhafith On

Nope there is not, but you could have a context that you keep updating it before you realize it to an image, that is one way to not begin a context and end it, keep it open for further drawings