非矩形图像裁剪iOS? [英] Non-rectangular image cropping iOS?

查看:53
本文介绍了非矩形图像裁剪iOS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在iOS上是否可以将图像裁剪为非矩形?我需要的是一个人能够用手指在图像内画一个圆(或任何封闭的形状),然后选择裁剪".这将使形状内部的内容保留下来,而外部被移除".不是黑色,而是透明的保存.如果我然后在一个视图中在彼此的顶部有两个UIImageView的顶部,然后将通常是在顶部裁剪图像,我需要背面的图像在形状外部可见.

Is there a way to crop images in a non-rectangular shape on iOS? What I need is for a person to be able to draw a circle (or what ever closing shape) with their finger inside an image and select "Crop". This will make the content inside the shape stay, and the outside be "removed". Not black, but a transparent save. If I then have two UIImageView's ontop of eachother in one view, and place the customly cropped image on the top, I need the image in back to be visible outside the shape.

推荐答案

是的,您将使用 CGImageMask .

这篇关于非矩形图像裁剪iOS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆