Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use B&W Mask #37

Closed
dacastro4 opened this issue Jan 21, 2019 · 4 comments
Closed

Use B&W Mask #37

dacastro4 opened this issue Jan 21, 2019 · 4 comments

Comments

@dacastro4
Copy link

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>
@christophesmet
Copy link
Owner

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.

@dacastro4
Copy link
Author

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.

@christophesmet
Copy link
Owner

christophesmet commented Jan 21, 2019

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 ?

@dacastro4
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants