我知道如何在平移时清除imageView,但是当我这样做时会清除带有锐边的图像但是我想要的是在使用Swift3在iOS上的ImageView上平移时用软/光滑的边缘清除ImageView?希望我对我的问题很清楚。
//For clearing the imageView I use this method.
func draw(fromPoint:CGPoint,toPoint:CGPoint) {
if draw {
UIGraphicsBeginImageContext(self.viewBelowScrollView.bounds.size)// ??
let context = UIGraphicsGetCurrentContext()
frontImageView.image?.draw(in: self.viewBelowScrollView.bounds)
context?.setLineCap(CGLineCap.round)
context?.setLineWidth(CGFloat(sizeSliderOutlet.value))
context?.move(to: CGPoint(x: fromPoint.x, y: fromPoint.y))
context?.addLine(to: CGPoint(x: toPoint.x, y: toPoint.y))
context?.setBlendMode(CGBlendMode.clear)
//Setting the Line Configuration
context?.strokePath()
//Setting all the things done on the Image View Now.
frontImageView.image = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
}
}
//将非常感谢任何帮助。提前谢谢。