0

有人可以向我解释为什么这会不正确地显示图像:

var image = UIImage(named: "test-pattern.jpg")
let ciImage = CIImage(image: image)
myUIImageView.image = UIImage(CIImage: ciImage)

但这不是:

var image = UIImage(named: "test-pattern.jpg")
var ciImage = CIImage(image: image)

UIGraphicsBeginImageContext(CGSizeMake(ciImage.extent().size.height,ciImage.extent().size.width))

var testUIImage = UIImage(CIImage: ciImage)

testUIImage?.drawInRect(CGRectMake(0, 0, ciImage.extent().size.height, ciImage.extent().size.width))

let finalImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext()

var image = UIImage(named: "test-pattern.jpg")
let ciImage = CIImage(image: image)

这是它应该完成的方式,还是可以更有效地完成?

4

0 回答 0