Interface ITwoStepStyleRenderer
Optional interface that style renderers can implement to support two-step rendering with background preparation. The caching is managed externally by the drawable renderer orchestrator (background thread) and the map renderer (render thread). Renderers that implement this interface do NOT interact with the cache directly.
When a renderer implements this interface:
- CreateCache() is called once per layer to create the appropriate cache type.
- CreateDrawable(Viewport, ILayer, IFeature, IStyle, RenderService) is called on a background thread — the caller stores the returned drawable in the cache.
- On the render thread, the caller fetches the cached drawable and passes it to DrawDrawable(object, Viewport, IDrawable, ILayer).
Renderers that do NOT implement this interface work as before — everything runs
on the render thread via ISkiaStyleRenderer.Draw.
Namespace: Mapsui.Rendering
Assembly: Mapsui.dll
Syntax
public interface ITwoStepStyleRenderer : IStyleRenderer
Methods
| Edit this page View SourceCreateCache()
Creates an IDrawableCache appropriate for this renderer's caching strategy. Called once per layer. For example, tile renderers return a TileDrawableCache (LRU), while regular feature renderers return a DrawableCache (strict reconciliation).
Declaration
IDrawableCache CreateCache()
Returns
| Type | Description |
|---|---|
| IDrawableCache |
CreateDrawable(Viewport, ILayer, IFeature, IStyle, RenderService)
Creates a drawable object for the given feature on a background thread. The caller is responsible for storing the result in the layer's cache. Returns null if the feature cannot be rendered.
Declaration
IDrawable? CreateDrawable(Viewport viewport, ILayer layer, IFeature feature, IStyle style, RenderService renderService)
Parameters
| Type | Name | Description |
|---|---|---|
| Viewport | viewport | |
| ILayer | layer | |
| IFeature | feature | |
| IStyle | style | |
| RenderService | renderService |
Returns
| Type | Description |
|---|---|
| IDrawable |
DrawDrawable(object, Viewport, IDrawable, ILayer)
Draws a single pre-created drawable to the canvas on the render thread. This is the fast step — it should only blit/transform, not allocate expensive objects.
Declaration
void DrawDrawable(object canvas, Viewport viewport, IDrawable drawable, ILayer layer)
Parameters
| Type | Name | Description |
|---|---|---|
| object | canvas | |
| Viewport | viewport | |
| IDrawable | drawable | |
| ILayer | layer |