如何将CGAffineTransform应用于CGPoint

rmp*_*251 7 vector core-graphics objective-c matrix ios

如果我有一个变换矩阵,作为a CGAffineTransform和a点,作为a CGPoint,我如何得到矩阵向量乘积?

对于那些想知道我为什么要问的人,我正在寻找一种在用户坐标和设备坐标之间转换点的方法.功能CGContextConvertPointToUserSpaceCGContextConvertPointToDeviceSpace仅似乎工作drawRect.我希望能够从设备坐标中的手势识别器获取触摸输入,并使用保存的变换矩阵(CGContextGetCTM)将其转换为用户坐标.

use*_*321 12

该功能CGPointApplyAffineTransform()似乎做你想要的.

  • `CGPointApplyAffineTransform` 已被实例方法 `CGPoint.applying(_:)` 替换 (2认同)