You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Theme resources problem with displayModel.setThemeCallback? #1619
To replace the displayModel.setFilter method, which is no longer available in the latest version of the library, I now use the displayModel.setThemeCallback method to get a grayed-out version of the map, for example. I noticed that not all parts of the map can be recolored with this method. This can be best seen when using the DEFAULT theme.
Problem can be reproduced by: map.getModel().displayModel.setThemeCallback( (RenderInstruction origin, int color) -> 0x80FF0000);
This should result in my understanding in a fully red area. But this is not the case. I attached to screenshots where the map with and without the themeCallback set can be seen.
I think ThemeCallback API cannot fully replace the functionality of deprectated and removed Filter API. At least my task of graying out the map, for which I previously used the Filter API in my Android apps, can no longer be implemented with this. It would be nice to have something like the Android's ColorFilter API available.
Activity
devemux86 commentedon Jan 12, 2025
Colors can be easily modified by apps in the callback, not the images.
Or use a theme without patterns in the areas, but fill them with color.
The best is to have different themes, like the Motorider light / dark theme by @MotoUKRider.
Sublimis commentedon Jan 12, 2025
@wharnisch We also came across this a while ago, so just to clarify, what is seen as non-red areas are actually SVG or PNG images coming from the assets folder: https://github.com/mapsforge/mapsforge/blob/master/mapsforge-themes/src/main/resources/assets/patterns/farmland.svg. Theme callback cannot color these items for some reason.
devemux86 commentedon Jan 12, 2025
We could extend the callback for the resources too, if this is possible.
But the processing / recoloring is work for the apps, not the library.
This is the purpose of the callback, to provide total freedom for the apps.
wharnisch commentedon Jan 13, 2025
I think ThemeCallback API cannot fully replace the functionality of deprectated and removed Filter API. At least my task of graying out the map, for which I previously used the Filter API in my Android apps, can no longer be implemented with this. It would be nice to have something like the Android's ColorFilter API available.
[-]Problem with displayModel.setThemeCallback?[/-][+]Theme resources problem with displayModel.setThemeCallback?[/+]devemux86 commentedon Jan 13, 2025
Fixed by #1622.
Color filter theme resources with the
ThemeCallback.getBitmap.An example can be found in the ColorFilterMapViewer sample.