gpt4 book ai didi

cocoa-touch - 如何使用某些CGContext函数重置 "current transformation matrix"的身份?

转载 作者:行者123 更新时间:2023-12-04 02:55:50 25 4
gpt4 key购买 nike

我正在CTM上进行一系列平移和旋转,有时我需要将其重置为身份,然后再进行转换。

我找不到任何合适的方法(显然应该有一个名为CGContextSetCTM的函数),并且由于效率是关键,所以我不想使用CGContextSaveGState/CGContextRestoreGState ...

最佳答案

通过CGContextGetCTM获取当前转换矩阵,将其与CGAffineTransformInvert求反,然后将当前矩阵乘以与CGContextConcatCTM求反的矩阵(这很重要!)。 CTM现在是身份。

关于cocoa-touch - 如何使用某些CGContext函数重置 "current transformation matrix"的身份?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/469505/

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