Draw UIImage in context with perspective?

I have a UIImage that is a square. When drawing in context, I do:

enter image description here

UIGraphicsBeginImageContextWithOptions(imageView.image!.size, imageView.opaque, 0.0)

var drawCtxt = UIGraphicsGetCurrentContext()
var someImage = UIImage(...)

// draw the image
CGContextDrawImage(drawCtxt, imageRect, someImage!.CGImage)


I want to draw an image in perspective like this:

enter image description here

How can I draw the UIImage in context in perspective?


source to share

All Articles