Class MlnFrontend
- Namespace
- MapLibreNative.Maui
Wraps mln_frontend_t*.
Ownership note: once passed to MlnMap, the map takes
ownership of the underlying native pointer and will destroy it via
mln_map_destroy. Dispose() becomes a no-op after
MapLibreNative.Maui.MlnFrontend.TransferOwnership() is called. Do not call
Dispose() after Dispose().
public sealed class MlnFrontend : IDisposable
- Inheritance
-
MlnFrontend
Constructors
MlnFrontend(IntPtr, IntPtr, int, int, float, Action)
public MlnFrontend(IntPtr surfaceHandle, IntPtr glContext, int widthPx, int heightPx, float pixelRatio, Action onRender)
Parameters
surfaceHandleIntPtrPlatform-specific surface: HDC (Windows), ANativeWindow* (Android), CAMetalLayer* (Apple)
glContextIntPtrWGL context (Windows) or null (Android/Apple)
widthPxintInitial width in physical pixels
heightPxintInitial height in physical pixels
pixelRatiofloatDevice pixel ratio
onRenderActionCalled by the native layer when a new frame is ready; call Render() inside it.
Properties
RenderBackend
The renderer this native build uses (queried once from the native library). Lets the shared managed layer pick the right surface handshake — the GL and Vulkan packages ship identical C# but different native libraries under the same name.
public static MlnRenderBackend RenderBackend { get; }
Property Value
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
ReadPixels(IntPtr, nuint)
Copies the most recently rendered frame as tightly-packed premultiplied RGBA
(byteLength must be ≥ widthheight4) into buffer.
Only the offscreen (Vulkan Windows) frontend supports this; returns false otherwise.
public bool ReadPixels(IntPtr buffer, nuint byteLength)
Parameters
bufferIntPtrbyteLengthnuint
Returns
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)