0
votes

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.

this is from apple quartz2d guide regarding coordinate system.

What do they mean by this first line? Using a scaling transform to negate the y-coordinate alters some conventions in Quartz drawing.

and in second line they have given thecgcontextdrawimage example, yes its true uikit automatically modifies the coordinates from lower left to upper left, so whats the point here?

and also didn't understand the last point of this, 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.

Thanks in advance, Regards.

1

1 Answers

1
votes

They just draw attention to the fact that using a scaling transform with a negative coordinate, y in the example, creates a mirror effect. It might not be obvoius, but when looking in a mirror, the direction of the axes change. In the example they are talking about the y axys which results in reversing the notion of up and down. If you think carefully to the mirror analogy, or just pick a mirror and try :), you can imagine/see that an arc drawn clockwise will look in the mirror as drawn counter-clockwise.

Please alos note that this scaling transform just reverses the axes (up-down), it has no effect on the origin (point considered as 0,0 ) at all. This is why for a complete mirror effect you also do a translation, enought to move the origin from upper-left to lower-right corner.