jeudi 7 juillet 2016

Trim transparency of an UIImage


I was wondering what would be the best way to trim the "canvas" of an UIImage (pretty much like any image editor allows out there)

Example

Now, the previous example is not a single UIImage. It's actually 2 UIViews. So clipping the superview against the blue box would do the trick, but I guess I am looking into the best possible way to do this. Given that there could be several blue boxes in the "canvas".

Is there a faster way than going through every pixel?

Thanks!


Aucun commentaire:

Enregistrer un commentaire