|
MapLibre Native C API
Public C ABI for the MapLibre Native wrapper.
|
Go to the source code of this file.
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, bool *out_rendered) |
| 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) |
| mln_status | mln_render_session_set_feature_state (mln_render_session *session, const mln_feature_state_selector *selector, const mln_json_value *state) |
| mln_status | mln_render_session_get_feature_state (mln_render_session *session, const mln_feature_state_selector *selector, mln_json_snapshot **out_state) |
| mln_status | mln_render_session_remove_feature_state (mln_render_session *session, const mln_feature_state_selector *selector) |
| mln_status | mln_json_snapshot_get (const mln_json_snapshot *snapshot, const mln_json_value **out_value) |
| void | mln_json_snapshot_destroy (mln_json_snapshot *snapshot) |
Public C API declarations for render sessions.
| void mln_json_snapshot_destroy | ( | mln_json_snapshot * | snapshot | ) |
Destroys a JSON snapshot handle. Null is accepted as a no-op.
| mln_status mln_json_snapshot_get | ( | const mln_json_snapshot * | snapshot, |
| const mln_json_value ** | out_value ) |
Borrows the root JSON value from a snapshot handle.
The returned pointer and all nested pointers remain valid until the snapshot is destroyed.
Returns:
| 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_get_feature_state | ( | mln_render_session * | session, |
| const mln_feature_state_selector * | selector, | ||
| mln_json_snapshot ** | out_state ) |
Copies per-feature state from a render source in this render session.
The session renderer must already exist. selector->source_id and selector->feature_id are borrowed for the duration of the call. On success, *out_state receives an owned snapshot handle. Use mln_json_snapshot_get() to borrow its root JSON object value, and destroy it with mln_json_snapshot_destroy(). Missing native source or feature state is reported as an empty object snapshot.
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_remove_feature_state | ( | mln_render_session * | session, |
| const mln_feature_state_selector * | selector ) |
Removes per-feature state from a render source in this render session.
The session renderer must already exist. selector->source_id is required. selector->feature_id and selector->state_key are optional. Passing both removes one state key from one feature. Passing only feature_id removes all state for that feature. Passing neither removes all feature state for the source/source-layer. The accepted command requests a map repaint.
Returns:
| mln_status mln_render_session_render_update | ( | mln_render_session * | session, |
| bool * | out_rendered ) |
Processes the latest map render update for an attached render session.
Surface sessions render and present through their native surface. Texture sessions render into their texture target.
On success, *out_rendered reports whether the latest available map render update was rendered. The map retains its latest update, so repeated calls re-render it and report true again; hosts use this to redraw on demand after resize or surface expose, and gate frame-driven loops on MLN_RUNTIME_EVENT_MAP_RENDER_UPDATE_AVAILABLE instead of the return value. *out_rendered is false when no frame was rendered: the map has not published a render update yet, or the renderer skipped producing a frame for the latest update (for example the Metal texture backend before content is ready). Both are normal during startup; keep pumping the runtime and call again when an update is reported.
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; follow a host whose target changed by destroying the session with mln_render_session_destroy() (or releasing the map slot with mln_render_session_detach()), recreating the texture, and attaching a new session. A map holds at most one attached session, so detach or destroy the old session before attaching the replacement.
Resizing discards the session renderer, which is rebuilt on the next mln_render_session_render_update(). Renderer-held state, including feature state set through mln_render_session_set_feature_state(), does not survive. Map state such as camera, style, and sources lives on the map and survives both resize and reattach.
Passing a scale_factor that differs from the map's mln_map_options scale_factor logs a warning; see mln_map_options.
Returns:
| mln_status mln_render_session_set_feature_state | ( | mln_render_session * | session, |
| const mln_feature_state_selector * | selector, | ||
| const mln_json_value * | state ) |
Sets per-feature state on a render source for this render session.
The session renderer must already exist; call mln_render_session_render_update() once after loading style data before using feature state. selector->source_id and selector->feature_id are borrowed for the duration of the call. state must be a JSON object descriptor and is copied before return. The accepted command requests a map repaint.
Returns: