【问题标题】:How do I scale a CGImage in an optimal way?如何以最佳方式缩放 CGImage?
【发布时间】:2015-08-13 05:06:48
【问题描述】:

一种方法是:

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

问题:

如果图像缩放操作非常频繁,则创建位图上下文可能会非常昂贵。还有其他方法可以缩放 CGimage 吗?或者缓存这样的位图上下文进行缩放操作是唯一的选择?

【问题讨论】:

    标签: ios image-processing core-graphics


    【解决方案1】:

    图像缩放需要完整的图像处理,因此您可以使用缓存上下文(如您之前所说)加速它,或者例如在 GPU 上缩放图像。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-03-25
      • 2010-09-15
      • 1970-01-01
      • 2011-10-03
      • 1970-01-01
      • 2021-11-23
      • 1970-01-01
      相关资源
      最近更新 更多