What I am trying to do is take a square imageview and make it a 5 point imageview in the shape of a 3 point triangle at the top and the bottom to points in a base.
public func shapeImage(with bezierPath: UIBezierPath, size: CGSize, fillColor: UIColor? = UIColor.clear,
strokeColor: UIColor? = nil, strokeWidth: CGFloat = 0.0) -> UIImage! {
UIGraphicsBeginImageContext(size)
let context = UIGraphicsGetCurrentContext()
var image = UIImage(data: try! Data(contentsOf: URL(string:"https://a248.e.akamai.net/secure.meetupstatic.com/photos/member/5/3/5/e/highres_260901342.jpeg")!))!
if let context = context {
context.saveGState()
context.addPath(bezierPath.cgPath)
if let strokeColor = strokeColor {
strokeColor.setStroke()
context.setLineWidth(strokeWidth)
} else {
UIColor.clear.setStroke()
}
fillColor?.setFill()
context.drawPath(using: .fillStroke)
image = UIGraphicsGetImageFromCurrentImageContext()!
context.restoreGState()
UIGraphicsEndImageContext()
}
return image
}
I want to take the top and make it bigger and keep the bottom half the same size. I do not want to mask or cut of some portion of the original image. I want to physical make the image bigger by stretching and not masking. I have not seen anything on this site that explains how to do this or if its possible.