我想添加免提功能.
现在,借助以下代码,我可以打开图片并在要裁剪的图像部分周围绘制路径:
Till now I can open the picture and draw a path around the part of the image that I want to crop thanks to this code:
stackoverflow/a/18459072/2361533
但是在另一个活动中打开裁剪后的图像之前,我想使裁剪路径的外部变暗,以向用户展示裁剪后的图像.万一他不喜欢这个结果,他可以重置图像.
But before opening the cropped image in another activity, I want to darken the outside part of the crop path, to show the user how the cropped image will be. In case he does not like the result, he could reset the image.
就像下面的图片一样: Android:免费裁剪图片
It would be something like the image here: Android: Free Croping of Image
我该怎么做?
推荐答案使用以下两种方法作为开始:
Use the following two methods as a start:
setXfermode(new PorterDuffXfermode(Mode.DARKEN)); canvas.clipPath(path, Region.Op.DIFFERENCE);第一个应用于Paint对象,并使某个区域变暗. 第二个剪切"画布中的路径并取反(使用Region.Op.DIFFERENCE).
The first one is applied to a Paint object and darkens a certain region. The second "clips" the path in your canvas and takes the inverse (using Region.Op.DIFFERENCE).
更多推荐
使android中徒手裁剪的图像的部分变暗
发布评论