Which is the right way to flip coordinate in CGContext?

Updated
Mar 28, 2021 11:15 AM
Created
Mar 28, 2021 9:23 AM
Tags
CoreGraphics
Keywords
Date
let boundingBox = context.boundingBoxOfClipPath
context.scaleBy(x: 1, y: -1)
context.translateBy(x: 0, y: -(boundingBox.maxY + boundingBox.minY))    
assert(context.boundingBoxOfClipPath == boundingBox)

or

context.translateBy(x: 0, y: context.boundingBoxOfClipPath.height)
context.scaleBy(x: 1, y: -1)

or?

context.translateBy(x: 0, y: context.boundingBoxOfClipPath.maxY)
context.scaleBy(x: 1, y: -1)