Get CGPoints from CGMutablePath || Find min and max values from CGMutablePath || iOS find MINX,MINY,MAXX,MAXY from CGMutablePath
Solution:
let value = path.getPathElementsPoints()
let xArray = value.map(\.x)
let yArray = value.map(\.y)
let minX = xArray.min()!-drawingPenRectAdj
let maxX = xArray.max()!+drawingPenRectAdj
let minY = yArray.min()!-drawingPenRectAdj
let maxY = yArray.max()!+drawingPenRectAdj
print("min x",minX)
print("max x",maxX)
print("min y",minY)
print("max y",maxY)
let points = NSMutableArray()
points.add(CGPoint(x: minX, y: minY))
points.add(CGPoint(x: maxX, y: maxY))
var covertPoints:[CGPoint] = []
var cgpath:CGMutablePath! = CGMutablePath.init()
for i in 0..
Comments
Post a Comment