UIGraphicsBeginImageContextWithOptions(startingImageL.size, false, 0.0)
let context = UIGraphicsGetCurrentContext()!
startingImageL.draw(in: CGRect(origin: CGPoint.zero, size: startingImageL.size), blendMode: .copy, alpha: 1.0)
context.setBlendMode(.copy)
context.setFillColor(UIColor.clear.cgColor)
let rectPath = UIBezierPath(rect: CGRect(origin: CGPoint.zero, size: startingImageL.size))
let cropRectPath = UIBezierPath(rect: cropZone)
print("cropRectPath \(cropRectPath.debugDescription) ")
print("cropZone \(cropZone.debugDescription) ")
print("cropZone width \(cropZone.width) ")
print("cropZone height \(cropZone.height) ")
print("cropZone maxX \(cropZone.maxX) ")
print("cropZone maxY \(cropZone.maxY) ")
rectPath.append(cropRectPath)
rectPath.usesEvenOddFillRule = true
context.saveGState()
rectPath.fill()
context.clip(to: cropZone)
// UIRectClip(cropZone) <-nope
// UIRectFrame(cropZone) <- nope
// rectPath.addClip() <nope
before image
It crops great but I want it to delete all the space around it instead of fill (the pink) and then the image would fill up the view. Thanks!