如何删除用户移动手指的 UIImage 区域?
How to remove area of UIImage where user move his finger?
- IMAGECROPPER
- UIGESTURE
- 触摸
需要实现此目的,用户选择图像,然后使用触摸拖动将其剪切,例如 Photo Editing App.
UIGraphicsBeginImageContext(drawImage.frame.size)
var context = UIGraphicsGetCurrentContext()
drawImage.image.draw(in: CGRect(x: 0, y: 0, width: view.frame.size.width, height: view.frame.size.height - 50))
context?.move(to: fromPoint)
context?.addLine(to: toPoint)
context?.setLineCap(.butt)
context?.setLineWidth(2)
context?.setBlendMode(.clear)
context?.setShouldAntialias(true)
UIColor.clear.set()
context?.strokePath()
let newImage = UIGraphicsGetImageFromCurrentImageContext()!
- IMAGECROPPER
- UIGESTURE
- 触摸
需要实现此目的,用户选择图像,然后使用触摸拖动将其剪切,例如 Photo Editing App.
UIGraphicsBeginImageContext(drawImage.frame.size)
var context = UIGraphicsGetCurrentContext()
drawImage.image.draw(in: CGRect(x: 0, y: 0, width: view.frame.size.width, height: view.frame.size.height - 50))
context?.move(to: fromPoint)
context?.addLine(to: toPoint)
context?.setLineCap(.butt)
context?.setLineWidth(2)
context?.setBlendMode(.clear)
context?.setShouldAntialias(true)
UIColor.clear.set()
context?.strokePath()
let newImage = UIGraphicsGetImageFromCurrentImageContext()!