Table of Contents

Class MbglFrontend

Namespace
MapLibreNative.Maui

Wraps mbgl_frontend_t*.

Ownership note: once passed to MbglMap, the map takes ownership of the underlying native pointer and will destroy it via mbgl_map_destroy. Dispose() becomes a no-op after MapLibreNative.Maui.MbglFrontend.TransferOwnership() is called. Do not call Dispose() after Dispose().

public sealed class MbglFrontend : IDisposable
Inheritance
MbglFrontend

Constructors

MbglFrontend(IntPtr, IntPtr, int, int, float, Action)

public MbglFrontend(IntPtr surfaceHandle, IntPtr glContext, int widthPx, int heightPx, float pixelRatio, Action onRender)

Parameters

surfaceHandle IntPtr

Platform-specific surface: HDC (Windows), ANativeWindow* (Android), CAMetalLayer* (Apple)

glContext IntPtr

WGL context (Windows) or null (Android/Apple)

widthPx int

Initial width in physical pixels

heightPx int

Initial height in physical pixels

pixelRatio float

Device pixel ratio

onRender Action

Called by the native layer when a new frame is ready; call Render() inside it.

Methods

Dispose()

public void Dispose()

GetNativeView()

Returns the platform-native view created by the frontend, or IntPtr.Zero. On Apple platforms this is the MTKView*; cast to UIView and add as subview.

public IntPtr GetNativeView()

Returns

IntPtr

Render()

Execute the pending render pass. Call from the render thread when onRender fires.

public void Render()

SetSize(int, int)

public void SetSize(int widthPx, int heightPx)

Parameters

widthPx int
heightPx int