使用swift通过图像选择器选择后如何镜像图像?

南地尼布
@IBAction func mirrorBtn(sender: AnyObject){
    self.makeMirroredImage(imageView)
    pickImage.image = imageView

}

func makeMirroredImage(image: UIImage) -> UIImage {
    var flippedOrientation: UIImageOrientation = .UpMirrored
    switch image.imageOrientation {
    case .Down:
        flippedOrientation = .DownMirrored
    case .Left:
        flippedOrientation = .LeftMirrored
    default :
        flippedOrientation = .LeftMirrored
    }

    let flippedImage: UIImage = UIImage(CGImage: image.CGImage!, scale: image.scale, orientation: flippedOrientation)
    return flippedImage
}
伊森

选择图像后,您应该能够使用翻译反转它。我不是 iOS/swift 的专业人士,但在 Android 中,我通过将XY转换为-1. 希望这能让你走上正轨

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章