Search Results for

    Show / Hide Table of Contents

    Interface IMapRenderer

    Namespace: Mapsui.Rendering
    Assembly: Mapsui.dll
    Syntax
    public interface IMapRenderer

    Methods

    | Edit this page View Source

    CreateDrawableForFeature(Viewport, ILayer, IFeature, IStyle, RenderService)

    Creates a drawable for a feature/style combination. This factory method is used by CreateDrawable to allow the fetch pipeline to create drawables without needing access to renderer internals.

    Declaration
    IDrawable? CreateDrawableForFeature(Viewport viewport, ILayer layer, IFeature feature, IStyle style, RenderService renderService)
    Parameters
    Type Name Description
    Viewport viewport

    The current viewport.

    ILayer layer

    The layer containing the feature.

    IFeature feature

    The feature to create a drawable for.

    IStyle style

    The style to apply.

    RenderService renderService

    The render service (holds caches).

    Returns
    Type Description
    IDrawable

    A drawable, or null if this renderer doesn't support creating drawables for this style.

    | Edit this page View Source

    GetMapInfo(ScreenPosition, Viewport, IEnumerable<ILayer>, RenderService, int)

    Returns information about the map feature(s) at the given screen position. Used to implement tap/click hit-testing on the map.

    Declaration
    MapInfo GetMapInfo(ScreenPosition screenPosition, Viewport viewport, IEnumerable<ILayer> layers, RenderService renderService, int margin = 0)
    Parameters
    Type Name Description
    ScreenPosition screenPosition

    The screen position to query (in pixels).

    Viewport viewport

    The current viewport.

    IEnumerable<ILayer> layers

    The layers to query.

    RenderService renderService

    The render service, which holds shared caches and resources.

    int margin

    Extra hit area radius in pixels. Useful for small, hard-to-tap features.

    Returns
    Type Description
    MapInfo

    A MapInfo describing what was found at that position.

    | Edit this page View Source

    Render(object, Viewport, IEnumerable<ILayer>, IEnumerable<IWidget>, RenderService, Color?, MRect?)

    Renders the map to the given target surface.

    Declaration
    void Render(object target, Viewport viewport, IEnumerable<ILayer> layers, IEnumerable<IWidget> widgets, RenderService renderService, Color? background = null, MRect? dirtyRegion = null)
    Parameters
    Type Name Description
    object target

    The platform-specific render target (e.g. an SKCanvas).

    Viewport viewport

    The viewport describing the visible area and resolution.

    IEnumerable<ILayer> layers

    The layers to render, in draw order.

    IEnumerable<IWidget> widgets

    The widgets to draw on top of the map.

    RenderService renderService

    The render service, which holds shared caches and resources.

    Color? background

    Optional background color to fill before drawing layers. Pass null to skip.

    MRect dirtyRegion

    World-coordinate rectangle of the area that needs to be redrawn. Pass null to redraw the full viewport. When provided, only this region is repainted (canvas is clipped and feature queries are limited to this area).

    | Edit this page View Source

    RenderToBitmapStream(Viewport, IEnumerable<ILayer>, RenderService, Color?, float, IEnumerable<IWidget>?, RenderFormat, int)

    Renders the map to a PNG (or other format) bitmap and returns it as a stream. Useful for exporting the map or running rendering tests.

    Declaration
    MemoryStream RenderToBitmapStream(Viewport viewport, IEnumerable<ILayer> layers, RenderService renderService, Color? background = null, float pixelDensity = 1, IEnumerable<IWidget>? widgets = null, RenderFormat renderFormat = RenderFormat.Png, int quality = 100)
    Parameters
    Type Name Description
    Viewport viewport

    The viewport describing the visible area and resolution.

    IEnumerable<ILayer> layers

    The layers to render.

    RenderService renderService

    The render service, which holds shared caches and resources.

    Color? background

    Optional background color. Pass null to skip.

    float pixelDensity

    Screen pixel density (e.g. 2 for a high-DPI display). Defaults to 1.

    IEnumerable<IWidget> widgets

    Optional widgets to include in the output image.

    RenderFormat renderFormat

    Output image format. Defaults to Png.

    int quality

    Compression quality for lossy formats (0–100). Ignored for PNG.

    Returns
    Type Description
    MemoryStream

    A MemoryStream containing the encoded image.

    | Edit this page View Source

    TryGetStyleRenderer(Type, out IStyleRenderer?)

    Looks up the style renderer registered for the given style type.

    Declaration
    bool TryGetStyleRenderer(Type styleType, out IStyleRenderer? styleRenderer)
    Parameters
    Type Name Description
    Type styleType

    The runtime type of the style.

    IStyleRenderer styleRenderer

    Set to the registered renderer, or null if none is found.

    Returns
    Type Description
    bool

    true if a renderer was found; otherwise false.

    | Edit this page View Source

    TryGetWidgetRenderer(Type, out IWidgetRenderer?)

    Looks up the widget renderer registered for the given widget type.

    Declaration
    bool TryGetWidgetRenderer(Type widgetType, out IWidgetRenderer? widgetRenderer)
    Parameters
    Type Name Description
    Type widgetType

    The runtime type of the widget.

    IWidgetRenderer widgetRenderer

    Set to the registered renderer, or null if none is found.

    Returns
    Type Description
    bool

    true if a renderer was found; otherwise false.

    | Edit this page View Source

    UpdateDrawables(Viewport, ILayer, RenderService)

    Updates pre-created drawable objects for a layer. Called when layer data changes. Implementations that support the two-step rendering architecture should create drawables here.

    Declaration
    void UpdateDrawables(Viewport viewport, ILayer layer, RenderService renderService)
    Parameters
    Type Name Description
    Viewport viewport

    The current viewport.

    ILayer layer

    The layer whose data has changed.

    RenderService renderService

    The render service (holds caches).

    Extension Methods

    DisposableExtension.DisposeIfDisposable(object?)
    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX