【问题标题】:Android: clip image to shapeAndroid:将图像剪辑到形状
【发布时间】:2011-07-20 10:15:03
【问题描述】:

(对不起我的英语不好) 我有两张照片。一张照片色彩鲜艳,很大。在另一张图片上,透明背景上显示了一个任意形状的黑色图形(如十字或星形或经典拼图的一块)。 我想将第二张图片放在第一张图片上,并用第一张图片的一部分替换黑色。然后我需要将第二个图像保存在一个新文件中。

谢谢。 最大。

【问题讨论】:

标签: android image graphics shape clip


【解决方案1】:

您可以通过使用库和单行代码来获得它。 请试试这个,希望你能得到更好的解决方案。

dependencies {
compile 'com.mafstech.libs:mafs-image-shape:1.0.4'   
}

而这一行是你的主要代码

Shaper.shape(context, R.drawable.your_original_image_which_will_be_displayed, R.drawable.shaped_image__your_original_image_will_get_this_images_shape, imageView, height, weight);   

【讨论】:

    【解决方案2】:

    您需要使用 xfer 模式,除非您准备好创建路径然后剪辑画布。

    在这里查看我的答案:how to draw pic to Closed curve area

    点击链接查看示例...

    【讨论】:

      猜你喜欢
      • 2016-02-22
      • 1970-01-01
      • 2021-03-14
      • 1970-01-01
      • 2021-09-20
      • 1970-01-01
      • 2018-09-30
      • 2019-09-30
      • 2017-02-14
      相关资源
      最近更新 更多