How can I scale CGImage optimally?

One way to do this:

CGImageRef scaledImage(CGImageref, destination rect) { context = CGBitmapContextCreate(rect...); CGContextDrawImage(context, rect); return CGBitmapContextCreateImage(context) } 

Questions:

Creating a raster context can be quite expensive if the image scaling operation is very frequent. Is there any other way to scale CGimage? Or is caching such a raster context for the zoom operation the only option?

+5
source share
1 answer

scaling an image requires full image processing, so you can speed it up using a cached context (as you said earlier) or, for example, scale an image on a GPU.

+2
source

All Articles