相关疑难解决方法(0)

裁剪UIImage到alpha

我有一个相当大的,几乎全屏的图像,我将在iPad上显示.图像大约80%透明.我需要在客户端上确定不透明像素的边界框,然后裁剪到该边界框.

在StackOverflow上扫描其他问题并阅读一些CoreGraphics文档,我想我可以通过以下方式完成此任务:

CGBitmapContextCreate(...) // Use this to render the image to a byte array

 ..
   - iterate through this byte array to find the bounding box
 ..

CGImageCreateWithImageInRect(image, boundingRect);
Run Code Online (Sandbox Code Playgroud)

这似乎非常低效和笨重.有没有什么聪明的我可以使用CGImage蒙版或利用设备的图形加速来做到这一点?

core-graphics cgimage ipad ios4 ios

9
推荐指数
3
解决办法
2478
查看次数

标签 统计

cgimage ×1

core-graphics ×1

ios ×1

ios4 ×1

ipad ×1