Освой Android играючи
/* Моя кошка замечательно разбирается в программировании. Стоит мне объяснить проблему ей - и все становится ясно. */
John Robbins, Debugging Applications, Microsoft Press, 2000
Компонент ImageFilterButton является расширенным аналогом ImageView, к которому применимы эффекты ColorMatrix. Находится в разделе Helpers и входит в состав ConstraintLayout v.2.0.
implementation 'androidx.constraintlayout:constraintlayout:2.0.2'
Особых различий с ImageFilterView у него нет, поэтому я просто заменил названия из примеров.
Можно установить эффекты через XML-атрибуты contrast, saturation, warmth.
<?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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<androidx.constraintlayout.utils.widget.ImageFilterButton
android:id="@+id/imageFiterButton"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginTop="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/sleepbedcat"
app:contrast="1.0"
app:saturation="2.0"
app:warmth="1.2" />
</androidx.constraintlayout.widget.ConstraintLayout>
Мы можем менять эффекты динамически через код. Пример смотрите в статье про ImageFilterView.