gpt4 book ai didi

ios - 我在理解 "scaling transform coordinates"时遇到问题。需要帮助

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

Using a scaling transform to negate the y-coordinate alters some conventions in Quartz drawing. For example, if you call CGContextDrawImage to draw an image into the context, the image is modified by the transform when it is drawn into the destination. Similarly, path drawing routines accept parameters that specify whether an arc is drawn in a clockwise or counterclockwise direction in the default coordinate system. If a coordinate system is modified, the result is also modified, as if the image were reflected in a mirror. In Figure 1-5, passing the same parameters into Quartz results in a clockwise arc in the default coordinate system and a counterclockwise arc after the y-coordinate is negated by the transform.

这是来自apple quartz2d guide关于坐标系。

第一行是什么意思? 使用缩放变换来否定 y 坐标会改变 Quartz 绘图中的一些约定。

在第二行中,他们给出了 thecgcontextdrawimage 示例,是的,它真正的 uikit 会自动将坐标从左下修改为左上角,那么这里有什么意义呢?

并且也不明白最后一点,将相同的参数传递给 Quartz 会在默认坐标系中产生顺时针弧,在 y 坐标被变换取反后产生逆时针弧。

提前致谢,问候。

最佳答案

他们只是提醒人们注意这样一个事实:使用带有负坐标(示例中的 y)的缩放变换会创建镜像效果。这可能并不明显,但当照镜子时,轴的方向会改变。在这个例子中,他们谈论的是 y 轴,这导致了上下概念的颠倒。如果您仔细思考镜子的类比,或者只是选择一面镜子并尝试:),您可以想象/看到顺时针绘制的弧线在镜子中看起来就像逆时针绘制的一样。

请注意,此缩放变换只是反转轴(上下),它对原点(视为 0,0 的点)根本没有影响。这就是为什么要获得完整的镜像效果,您还需要进行平移,足以将原点从左上角移动到右下角。

关于ios - 我在理解 "scaling transform coordinates"时遇到问题。需要帮助,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9666001/

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