CTM transforms vs Affine Transforms in iOS (for translate, rotate, scale)

1211 단어 currentMatrixmethods
참조 URL:http://stackoverflow.com/questions/30756907/ctm-transforms-vs-affine-transforms-in-ios-for-translate-rotate-scale
https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/CocoaDrawingGuide/Transforms/Transforms.html
https://developer.apple.com/library/ios/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_affine/dq_affine.html#//apple_ref/doc/uid/TP30001066-CH204-SW1
CTM is a current transformation matrix and the CTM methods will make operations on the current matrix.
The other version of functions will make the transformation on a given matrix which means you need to specify which matrix you are trying to transform. After you did so you may apply the transform to the CTM any way you want or use it for any other purpose.
For instance these 2 operations would be the same:
CGContextTranslateCTM(context, 10, 10);

Affine:
CGAffineTransform transform = CGAffineTransformIdentity;transform = CGAffineTransformTranslate(transform, 10, 10);CGContextConcatCTM(context, transform);

As you can see the first one is more or less just a convenience so you do not need to write so much code.

좋은 웹페이지 즐겨찾기