christophesmet/android_maskable_layout

Use B&W Mask

Closed this issue · 4 comments

Hey! I just need some help because I'm trying to use a mask that is a JPEG file that has white background and the mask part is black. It kinda works but how can I change the color of the mask? I tried applying backgroundTint but It didn't work.
This is what I have.

<com.christophesmet.android.views.maskableframelayout.MaskableFrameLayout
            android:id="@+id/car_bg_base_mask"
            app:porterduffxfermode="OVERLAY"
            app:mask="@drawable/m3_overlay"
            android:elevation="-1dp"
            android:backgroundTint="@color/blue"
            android:layout_height="match_parent"
            android:layout_width="match_parent">

            <ImageView
                android:id="@+id/car_bg_base"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:contentDescription="@string/car_background"/>

        </com.christophesmet.android.views.maskableframelayout.MaskableFrameLayout>

Why would you want to colour the mask?
Could you provide an image of the result you are trying to achieve?
I'm not sure what the end goal is.

To change the color of the image.
Sure:
Having this image:
image
and this mask:
mask
result: result

I can accomplish this on Affinity Designer by adding color to the mask but I have to do it programatically because the masks and the colors change.

I think in order for this to work you have to color your mask.
Give the color pixels an alpha of 255 and the transparent ones an alpha of 0.
Then it should be properly masked.
I really think you need to color your mask.
Is there a sample project where I can test this to ?

@christophesmet no, I don't have a sample project. I'm gonna try painting the mask before.