CAReplicatorLayer背后的魔力是什么? [英] What's the magic behind CAReplicatorLayer?

查看:134
本文介绍了CAReplicatorLayer背后的魔力是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对CAReplicatorLayer感兴趣的是:

What I find interesting with CAReplicatorLayer:


  • 它能够非常有效地多次显示CALayer并具有不同的变换(如何?)

  • 似乎它以某种方式重复使用复制层的后备存储,甚至为它应用了一些颜色(如何?)

我想了解源代码或了解CAReplicatorLayer背后的魔力。我想有一个类似于CAReplicatorLayer的CALayer类,但有更多的控制权。我想对每个复制的实例单独控制转换

I would like to get hands on either the source code or get some knowledge of the magic behind CAReplicatorLayer. I would like to have a CALayer class similar to CAReplicatorLayer, but with more control. I would like to have control on the transform individually for each replicated instance.

所以要求完全不同方式:
是否有可能获得CALayer的后备商店并显示它但我想要多次我想要?

So asked in a totally different manner: is it possible to get the "backing store" for a CALayer and display it however I want as many times I want?

(通过支持 store我的意思是CALayer / UIView的渲染纹理。我不太了解CoreAnimation / QuartzCore引擎盖下发生的事情。

(by "backing store" I mean the rendered texture for the CALayer/UIView. I don't know much about what's happening under the hoods of CoreAnimation/QuartzCore).

为什么我不会选择像将CALayer渲染为UIImage:

Why I'm not looking at alternatives like e.g. rendering the CALayer to a UIImage:


  • 表现

  • 内容是动态的/经常变化的转换

  • 以其他方式做到这一点真是令人敬畏!

推荐答案

像CAReplicatorLayer或CAGradientLayer这样的专用CALayers能够(通过私有API)使用快速填充或复制直接在GPU上执行绘图。从某种意义上说,它们是不同的,因为后备存储不在普通RAM中,而是直接在GPU上。

The special-purpose CALayers like CAReplicatorLayer or CAGradientLayer are able (via private APIs) do execute their drawing directly on the GPU using fast filling or copying. In a sense they are different such that the backing store is not in normal RAM, but directly on the GPU.

这篇关于CAReplicatorLayer背后的魔力是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆