-3

我正在尝试使用下面的代码混合两个相同大小的图像,但是“filteredImage.image?.draw(in: areaSize, blendMode: .normal, alpha: opa)”此代码将显示错误消息“表达式类型不明确更多上下文”.. 有什么问题?

        let originalWidth:CGFloat  = originalImageView.frame.size.width
        let originalHeight:CGFloat = originalImageView.frame.size.height
        var opa = intensity * 0.01

        let size = CGSize(width: originalWidth, height: originalHeight)

        UIGraphicsBeginImageContext(size)

        let areaSize = CGRect(x: 0, y: 0, width: size.width, height: size.height)
        let blendImageSize = areaSize

        originalImageView.image?.draw(in: areaSize, blendMode: .normal, alpha: 1.0)

        filteredImageView.image?.draw(in: areaSize, blendMode: .normal, alpha: opa)

        originalImageView.image = UIGraphicsGetImageFromCurrentImageContext()

        UIGraphicsEndImageContext()
4

1 回答 1

1

改变

alpha: opa

alpha: CGFloat(opa)
于 2019-11-27T06:55:12.927 回答