我正在尝试将我的CIImage水平翻转到:
image = [image imageByApplyingTransform:CGAffineTransformMakeScale(1, -1)];
image = [image imageByApplyingTransform:CGAffineTransformMakeTranslation(0, sourceExtent.size.height)];但是我总是把图像垂直翻转
发布于 2016-05-01 13:12:30
试着这样做:
image = [image imageByApplyingTransform:CGAffineTransformMakeScale(-1, 1)];
image = [image imageByApplyingTransform:CGAffineTransformMakeTranslation(0, sourceExtent.size.height)];发布于 2018-01-02 22:05:17
这将正确地翻转图像水平,并保持适当的坐标。
在Obj-C:
image = [image imageByApplyingCGOrientation: kCGImagePropertyOrientationUpMirrored];在Swift:
image = image.oriented(.upMirrored)https://developer.apple.com/documentation/coreimage/ciimage/2919727-oriented
如果您想要的是以一种可以在UIImage中使用它的方式来定位它,那么您需要在两个轴上翻转它。
image = image.oriented(.downMirrored)发布于 2016-10-13 16:25:33
亚历克斯差一点就有了,但你也需要调整翻译:
image = [image imageByApplyingTransform:CGAffineTransformMakeScale(-1, 1)];
image = [image imageByApplyingTransform:CGAffineTransformMakeTranslation(sourceExtent.size.width, 0)];https://stackoverflow.com/questions/36966854
复制相似问题