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

Cropping map fragment removes more than needed #45

Closed
GeorgeMincila opened this issue Jul 12, 2020 · 3 comments
Closed

Cropping map fragment removes more than needed #45

GeorgeMincila opened this issue Jul 12, 2020 · 3 comments

Comments

@GeorgeMincila
Copy link

Hi,

Found your project looking for something to crop my Google map to a rounded corners shape. Nothing worked so far. I tried yours and it seems to remove too much. Somehow all the map content is removed, while the minimal Google Map UI can notice is cropped off to the shape I used.

Left side using the maskable_layout, right side plain map fragment. https://drive.google.com/file/d/16aivbVtTkgFm7eOSF6BWaYlagUwTkFO_/view?usp=sharing

Any idea what is happening and why the entire map layer is disappearing?

Thanks.

@christophesmet
Copy link
Owner

Hey George,
I cant see the image but I assume the google maps view is completely black.

Chances are high that the porterduff mode you are using only supports software rendering, and since google maps is highly optimized I wouldn't be surprised if it was rendered with hardware acceleration.

Setting the layer to software will probably not be a solution. You can apply masking and other effects using shaders, but this library only supports software layers, not hardware.

Some modes should work like PorterDuff.Mode.SRC_IN in hardware layers.
I would suggest trying it with hardware supported modes, else you will have to use shaders.

@GeorgeMincila
Copy link
Author

Appreciate the quick reply. I tried the SRC_IN mode. I am getting the same result. Can click the image url again. I made sure it is public.

Will have to get informed about shaders. I don't know how to use them yet.

@christophesmet
Copy link
Owner

Romain guy had some great info about this subject.
His blog seems to be offline: https://web.archive.org/web/20140318001921/http://www.curious-creature.org/2012/12/11/android-recipe-1-image-with-rounded-corners/
Anyway, I'm gonna close this as it only supports software layers and I think the hardware rendering of google maps is the problem.
I suggest adding a background to the google maps container instead of making it 'float'. Then you can overlay rounded corners. Its not as clean tho.
If you found a way, I'd love to hear the solution.
Good luck!

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