我有一个问题。 我需要将像Pixelate or Blur这样的滤镜应用到整个UIView 。 像eBay iPad应用程序一样。
我以为使用GPUImage但我不知道该怎么做。 有一种方法可以直接将过滤器应用于GPUImageView ,而无需传递UIImage ?
主要的问题是,在iPad 3上制作一个大UIView的截图会花费很多( UIWindow抓取需要2秒)。 所以完美的解决方案是直接应用过滤器的意见,就像易趣的应用程序,但..如何?
谢谢大家!
I've a problem. I need to apply a filter like Pixelate or Blur to an entire UIView. Like the eBay iPad app.
I thought to use GPUImage but I don't know how to do it. There is a way to apply a filter to a GPUImageView directly without pass a UIImage?
The primary problem is that making a screenshot of a large UIView on an iPad 3rd is to expensive (2 seconds for the UIWindow grab). So the perfect solution is to apply filter directly to the views, just like eBay app, but.. how?
Thanks to all!
最满意答案
要将视图拉入GPUImage,可以使用GPUImageUIElement源,该源将UIView或CALayer作为输入。 FilterShowcase示例应用程序中有一个例子。
这确实依赖于基础CALayer的-renderInContext:方法,这对于重新绘制视图可能是昂贵的。 但是,如果视图是静态的,则只需使用此更新一次,并将生成的图像作为纹理缓存在GPU上。 在该点之后应用到它的筛选器操作将非常快速。
To pull a view into GPUImage, you can use a GPUImageUIElement source, which takes a UIView or CALayer as input. There's an example of this in the FilterShowcase sample application.
This does rely on the -renderInContext: method of an underlying CALayer, which can be expensive for redrawing the view. However, if the view is static, you just need to use this update once and the resulting image will be cached on the GPU as a texture. Filter actions applied to it after that point will be very fast.
更多推荐
发布评论