gpt4 book ai didi

objective-c - Objective-C : How to use CGLayerCreate and CGContextDrawLayerAtPoint?

转载 作者:行者123 更新时间:2023-11-29 13:44:12 25 4
gpt4 key购买 nike

我正在研究 Core Graphics 来为我的项目制作动态纹理。

一个 friend 告诉我应该使用 CGLayerCreate 和 CGContextDrawLayerAtPoint改进我正在构建的画笔应用程序的纹理,但我还没有找到任何包含 CGLayerCreate 和 CGContextDrawAtPoint 的书籍或教程。

你们能告诉我这两个有什么用吗?如何编写它们?

另外,如果您知道任何包含这些内容的核心图形书籍,请告诉我,它一定会对我有所帮助。

谢谢!

最佳答案

Quartz 2D Programming Guide有一章讨论 CGLayer 对象。

你的 friend 可能会想到层的这种用法,引用那一章:

Repeated drawing. For example, you might want to create a pattern that consists of the same item drawn over and over. Draw the item to a layer and then repeatedly draw the layer, as shown in Figure 12-1. Any Quartz object that you draw repeatedly—including CGPath, CGShading, and CGPDFPage objects—benefits from improved performance if you draw it to a CGLayer. Note that a layer is not just for onscreen drawing; you can use it for graphics contexts that aren’t screen-oriented, such as a PDF graphics context.

Quartz2DBasics 中还有一个非常非常简单的示例示例应用程序。

关于objective-c - Objective-C : How to use CGLayerCreate and CGContextDrawLayerAtPoint?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8132987/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com