One ways to do is:
CGImageRef scaledImage(CGImageref, destination rect)
{
context = CGBitmapContextCreate(rect...);
CGContextDrawImage(context, rect);
return CGBitmapContextCreateImage(context)
}
Questions:
Creating bitmap context can be quite expensive if image scale operation is very frequent. Is there any other way we can scale CGimage? Or caching such bitmap context for scaling operation is the only option?
image scaling required full image processing, so you can speed up it using cached context (as you said before), or for example to scale image on GPU.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With