简体   繁体   English

自定义图像裁剪器android

[英]Custom image cropper android

I need to crop an image that I take from the gallery in some custom shapes (like heart, star, ..) but I have not found any android library that does this. 我需要以某种自定义形状(例如心形,星形,..)裁剪从画廊中获取的图像,但是我还没有找到执行此操作的任何Android库。

A very good library is this https://github.com/MostafaGazar/CustomShapeImageView where i can put a svg file of my shape, but I can't crop the image because that is a simple ImageView. https://github.com/MostafaGazar/CustomShapeImageView是一个很好的库,我可以在其中放置自己形状的svg文件,但是我无法裁剪图像,因为这是一个简单的ImageView。

There is any library that does this? 有没有这样做的图书馆? How could I solve this? 我该如何解决?

EDIT #1: 编辑#1:

I'm trying all the ways to do this.. but now I need to know if there is a way to convert svg file or bitmap file to android "Path" variable 我正在尝试所有方法来执行此操作..但是现在我需要知道是否有一种方法可以将svg文件或位图文件转换为android“ Path”变量

Use this one: 使用这个:

https://github.com/siyamed/android-shape-imageview https://github.com/siyamed/android-shape-imageview

add on dependencies 添加依赖

{ compile 'com.github.siyamed:android-shape-imageview:0.9.+@aar'
}

And to apply any shape: 并应用任何形状:

    <com.github.siyamed.shapeimageview.HexagonImageView
            android:id="@+id/my_imageview"
            android:layout_width="90dp"
            android:layout_height="90dp"

            android:background="@color/transparent"
 />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM