CGContextResetTopGState 和 CGContextReplaceTopGState?
我一直在研究私有 CoreGraphics API 并发现 CGContextResetTopGState 和 CGContextReplaceTopGState。我想知道是否有人知道 TopGState 是什么?
I have been looking into private CoreGraphics API and found CGContextResetTopGState and CGContextReplaceTopGState. I was wondering if anyone knows What is TopGState?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您查看公共 API,您会发现保存和恢复图形状态 (gstate) 的函数。他们的文档解释说 gsave 将 gstate 压入堆栈,而 grestore 从该堆栈中弹出当前 gstate,将以前的 gstate 恢复为新的当前 gstate。
有了这些知识,“TopGState”的含义就非常明显了,“ReplaceTopGState”可能的作用也相当清楚了——恢复可以通过替换以前的上一个/新的当前 gstate 来实现。
我可以猜测 Reset 也使用 Replace,将其传递给默认/初始 gstate。
If you look at the public API, you'll find functions to save and restore the graphics state (gstate). Their documentation explains that gsave pushes the gstate onto a stack, and grestore pops the current gstate from that stack, restoring the previous gstate as the new current gstate.
With that knowledge, the meaning of “TopGState” is pretty obvious, and it's also fairly clear what “ReplaceTopGState” probably does—Restore could be implemented by passing Replace the former previous/new current gstate.
I can guess that Reset also uses Replace, passing it the default/initial gstate.