-
-
Notifications
You must be signed in to change notification settings - Fork 315
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
Improve RasterStyle #2627
Comments
Hi Paul!
|
Hi Nick! Sorry for my late reply. What I had in mind is not too ambitious. In your sample you created a custom renderer which can render the tile in certain styles. My idea was to add those (or some of those) options to the existing RasterStyle so that our users can use it without having to use skia. I did not intent to add more ways to make Mapsui more pluggable. I hope a custom ISkiaStyleRenderer is enough for all scenarios.
I don't fully understand this. In Mapsui we use skia and skia has options for GPU support in some of their views and some of their platforms. We don't do anything else but turn it on if available. I don't see how we could make use of Maui hardware acceleration.
I have a similar thing in the case of SVGs. We currently create a SKPicture which contains the colors as well. If we want a custom color we need to create an altered copy of the SKPicture. The upside is that this is fast. The downside is that you could need many colors and the cache will grow. In the case of SVGs this is a big problem because you could have continuous color values leading to a cache item very every feature (and there could be 10.000 features). The alternative is to use SKPaths and SKPaints. For tiles it is less likely to be different for every tile. So there a SKPicture per tile might not be a problem. The downside will be that you can not easily change this without clearing the cache. So a slider which changes the darkness of a tile will not transition smoother. Still I think an SKImage and SKPaint might be the best option for us. Then again, this is a complicate problem for which I don't expect a perfect solution. We are currently working on changes to the cache so this is not something to change things to in the current code base. |
Hey Paul, just wanted to share that implementation of "The Tile is rasterized with custom effects just once and cached", going to publish app today: devenv_ecyOsyAATW.mp4Subclassed the loader: https://github.com/taublast/DrawnUi.Maui/blob/main/src/Addons/DrawnUi.Maui.MapsUi/src/CustomizeDownloadedTiles.cs |
ah, this is at a really low level. You subclassed the HttpTileSource which is part of BruTile. The Encode() returns a png. You could store it to disk as a regular image png. You could also write it to an MbTiles file and open it in QGIS, no Mapsui needed. |
The problem
At some point we decided that a renderer is always tied to a style, so a feature with no style will not be rendered. To apply this consistently we also introduced a RasterStyle, which was a bit weird at that point because we did not use the information in the style renderer.
There are however quite a few things that we could add as is demonstrated here by @taublast.
The proposed solution
Investigate the options added by Nick and add them to the RasterStyle (I have not looked into the code myself so don't have thoughts about the details). Personally I am also interested in an outline which I use for debugging tile layers and can be useful for highlighting a specific raster overlay.
The text was updated successfully, but these errors were encountered: