核心动画架构

发布于 2024-11-19 01:32:37 字数 499 浏览 1 评论 0原文

来自 文档 看来核心动画层位于 OpenGL 之上并且Quartz2D。 IE 执行核心动画命令应该产生一系列 Quartz2D 和 OpenGL 命令,我说得对吗?

在界面生成器中的“视图效果”选项卡下,我们可以设置核心动画层。内部发生了什么?当我们勾选上下文视图选项时,屏幕上的内容(按钮、滚动条等)不是使用主上下文或 currentContext(view) 绘制的,而是为它们创建新的位图上下文。引擎盖下到底发生了什么?

有人可以解释一下 CoreAnimation Layer 和 Quartz2d/OpenGL 之间的关系吗?

From the documentation it appears that core animation layer is above OpenGL and Quartz2D. i.e.
executing a core animation command should produce a sequence of Quartz2D and OpenGL commands Am I right?

In interface builder, under the View Effects tab, we can set the core animation layer. What happens internally there?When we tick Context View option, contents on screen (buttons, scrolls etc) are not drawn using main context or currentContext(view), but new Bitmap Context is created for them. What is happening under the hood there?

Can somebody please explain me relationship between CoreAnimation Layer and Quartz2d/OpenGL?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

追我者格杀勿论 2024-11-26 01:32:37

核心动画层本质上是 OpenGL 表面的高级抽象。它们由 GPU 存储和操作,因此层的操作速度非常快。 CALayer 对象本身非常轻量级,并且没有事件处理。

Layer-backed NSView 对象(这是在 Interface Builder 中启用复选框后得到的)是将其内容绘制到核心动画层中的视图,同样存储在 GPU 内存中并具有相同的性能作为普通 CALayer 对象的优点,但具有普通 NSView 的所有功能。

发生的情况是视图的内容被渲染(通过 Quartz)到它的支持层(本质上是一个 OpenGL 纹理)。如果图层的内容发生变化,视图只需再次绘制。

视图层的位置、比例、旋转等的变化不需要重新绘制视图的内容。这意味着大多数时候 CPU 不必参与不断地重绘视图。

Core Animation layers are essentially high-level abstractions of OpenGL surfaces. They are stored and manipulated by the GPU and so manipulation of the layers is extremely fast. CALayer objects by themselves are very lightweight and have no event handling.

Layer-backed NSView objects (which is what you get if you enable the checkboxes in Interface Builder) are views that draw their content into a Core Animation layer, again stored in the GPU's memory and with the same performance advantages as plain CALayer objects, but with all the functionality of a normal NSView.

What happens is that the view's content is rendered (via Quartz) to its backing layer (essentially an OpenGL texture). The view then only needs to draw again if the content of the layer changes.

Changes in position, scale, rotation etc of the view's layer do not require the view's content be redrawn. This means that most of the time the CPU does not have to get involved in constantly redrawing the view.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文