ImageFilterView和 ImageFilterButton
兩個屬性
app:roundPercent="0.98" //取值0-1
app:round="30dp" //優(yōu)先級大于 roundPercent
但 ImageFilterButton的效果大打折扣,它有范圍限制,你把 round設(shè)置成無限大,也它不會成個圓形,但 ImageFilterViewt則不一樣可能看著像個圓形
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activity.ConstraintLayoutAct">
<androidx.constraintlayout.utils.widget.ImageFilterView
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="30dp"
android:background="#aa0000"
app:roundPercent="0.98"
app:round="30dp"
android:layout_width="80dp"
android:layout_height= "80dp"/>
</androidx.constraintlayout.widget.ConstraintLayout>
效果

image.png
交叉淡化效果

image.png

image.png
調(diào)整亮度

image.png

image.png

image.png
調(diào)節(jié)色溫:
冷

image.png
正常:原圖:

image.png
熱:

image.png
飽和度

image.png
原圖:

image.png
飽和度加大

image.png
對比度:

image.png
原圖:

image.png
對比度加大

image.png
注意:
app:blendSrc="@drawable/shape_blend_src_drawable" 這個屬性是無用的,可以在xml中寫出 但無用,在源碼中可以求證 并沒有設(shè)置此drawable的方法,所以不要浪費時間在上面了。
這個也可以參考一下:
https://blog.csdn.net/u013700502/article/details/142737720