|
MapLibre Native C API
Public C ABI for the MapLibre Native wrapper.
|
Go to the source code of this file.
Typedefs | |
| typedef enum mln_render_result | mln_render_result |
Enumerations | |
| enum | mln_render_result : uint32_t { MLN_RENDER_RESULT_RENDERED = 0 , MLN_RENDER_RESULT_NO_UPDATE , MLN_RENDER_RESULT_SIZE_PENDING , MLN_RENDER_RESULT_TARGET_NOT_READY } |
Functions | |
| mln_status | mln_render_session_resize (mln_render_session session, uint32_t width, uint32_t height, double scale_factor) |
| mln_status | mln_render_session_render_update (mln_render_session session, mln_render_result *out_result, bool *out_needs_repaint) |
| mln_status | mln_render_session_detach (mln_render_session session) |
| mln_status | mln_render_session_destroy (mln_render_session session) |
| mln_status | mln_render_session_reduce_memory_use (mln_render_session session) |
| mln_status | mln_render_session_clear_data (mln_render_session session) |
| mln_status | mln_render_session_dump_debug_logs (mln_render_session session) |
Public C API declarations for render sessions.
| typedef enum mln_render_result mln_render_result |
Outcome of a successful mln_render_session_render_update() call.
| enum mln_render_result : uint32_t |
Outcome of a successful mln_render_session_render_update() call.
| mln_status mln_render_session_clear_data | ( | mln_render_session | session | ) |
Clears renderer data for the session.
Returns:
| mln_status mln_render_session_destroy | ( | mln_render_session | session | ) |
Destroys a render session handle.
If the session is still attached, this function detaches it first.
Returns:
| mln_status mln_render_session_detach | ( | mln_render_session | session | ) |
Detaches backend-bound render resources from the map while keeping the session handle live for destruction.
After detach, resize, render, readback, acquire, and renderer maintenance operations return MLN_STATUS_INVALID_STATE.
Returns:
| mln_status mln_render_session_dump_debug_logs | ( | mln_render_session | session | ) |
Dumps renderer debug logs for the session through MapLibre Native logging.
Returns:
| mln_status mln_render_session_reduce_memory_use | ( | mln_render_session | session | ) |
Asks the session renderer to release cached resources where possible.
Returns:
| mln_status mln_render_session_render_update | ( | mln_render_session | session, |
| mln_render_result * | out_result, | ||
| bool * | out_needs_repaint ) |
Renders the map's latest render update into the session's render target.
A surface session presents the frame. A texture session writes it into the target texture.
*out_result reports which of these outcomes the call reached, and each one names the wake that a host waits for before it calls again:
In MLN_MAP_MODE_STATIC, pump a resize through the map before requesting the still image. The session applies its extent on the map's owner thread, and a still image requested before that lands reports MLN_RENDER_RESULT_SIZE_PENDING.
*out_needs_repaint reports whether the map asked for another frame while it rendered this one, as during an ongoing camera transition. It is set only when *out_result is MLN_RENDER_RESULT_RENDERED, and reads false for every other outcome. This is the same signal that MLN_RUNTIME_EVENT_MAP_RENDER_FRAME_FINISHED carries in its needs_repaint field, delivered here without the event round trip, so a host can re-arm its frame loop before it drains events.
Returns:
| mln_status mln_render_session_resize | ( | mln_render_session | session, |
| uint32_t | width, | ||
| uint32_t | height, | ||
| double | scale_factor ) |
Resizes an attached render session.
Width and height are logical map dimensions. The scale_factor value maps them to physical backend pixels. Resizing sets the map size, so the map viewport and the render target extent stay the same value.
Surface and session-owned texture sessions resize in place. Caller-owned borrowed texture targets return MLN_STATUS_UNSUPPORTED because the texture is sized by its owner; hand a replacement over with the mln_*_borrowed_texture_set_target() function for the backend. See texture.h.
The session renderer survives a resize, carrying the tile pyramid, glyph and image atlases, and symbol placement across to the new size. A scale_factor that differs from the session's current value retires the renderer instead, because its shaders are compiled for a fixed pixel ratio, and renderer-held tile and atlas state starts empty on the next mln_render_session_render_update(). Map state such as camera, style, sources, and feature state survives either way. The session pushes map feature state into a replacement renderer on the next render update.
Passing a scale_factor that differs from the map's mln_map_options scale_factor logs a warning; see mln_map_options.
Returns: