Skip to main content

Crate mouser_engine_abi

Crate mouser_engine_abi 

Source
Expand description

The stable C ABI between Mouser and custom GPU rendering engines (v2, with v1 still loaded).

An engine is a shared library exporting extern "C" fn mouser_engine_v2() -> *const MouserEngineV2 (and, for older Mouser builds, mouser_engine_v1() -> *const MouserEngineV1). Mouser builds a MouserFrame per frame (everything already composed: cells, cursor, selection, UI, images) and the engine rasterises and presents it to the window described by MouserSurface. The C header is mouser_engine.h. See docs/engines.md.

Structs§

MouserCaps
What an engine can do, filled in by MouserEngineV2::caps.
MouserEngineV1
The engine’s function table.
MouserEngineV2
The v2 function table. It starts with a complete v1 table (base.abi is 2, base.size is size_of::<MouserEngineV2>()), so the frame types and the four core calls are unchanged; the additions are optional (null when the engine doesn’t implement them).
MouserFrame
A whole frame. Pointers are valid only during draw.
MouserGlyph
Glyph coverage bitmap (8-bit alpha, stride bytes per row) with its top-left corner at (x, y), tinted with color. key is stable for the same character and font generation, so engines may cache uploads.
MouserImage
Image placement: the source rectangle (src_*) of an RGBA8 image (img_w x img_h, straight alpha) drawn scaled to w x h with its top-left at (x, y). key is unique per uploaded image.
MouserOp
One operation: index into the rects, glyphs or images array.
MouserPixels
The pixel buffer for SURFACE_PIXELS: 0x00RRGGBB per pixel, stride pixels per row. Mouser may change data/width/height between calls (it calls resize first); read them in every draw.
MouserRect
Solid rectangle; colours are 0xRRGGBB.
MouserSurface
The window to present to. For Wayland display is the wl_display* and window the wl_surface*; for Xlib window holds the XID; for Xcb the connection and window id; AppKit the NSView*; Win32 the HWND (display = HINSTANCE).

Constants§

CAP_DIRECT_SURFACE
CAP_PIXELS
CAP_VSYNC_CONTROL
Capability flags in MouserCaps::flags.
DRAW_AGAIN
DRAW_OK
draw results.
ENTRY_SYMBOL
Name of the v1 entry symbol (NUL-terminated).
ENTRY_SYMBOL_V2
Name of the v2 entry symbol (NUL-terminated); tried first.
FORMAT_XRGB8888
Pixel formats in MouserCaps::formats (a bit set).
MOUSER_ENGINE_ABI
The v1 ABI version (the abi of a MouserEngineV1 table).
MOUSER_ENGINE_ABI_MIN
The oldest ABI this crate’s host still loads.
MOUSER_ENGINE_ABI_V2
The newest ABI version; a v2 table’s base.abi.
OP_GLYPH
OP_IMAGE
OP_RECT
SURFACE_APPKIT
SURFACE_PIXELS
Offscreen: window points to a MouserPixels; draw fills it and Mouser presents it. Used when the engine runs in Mouser’s engine host process.
SURFACE_WAYLAND
SURFACE_WIN32
SURFACE_XCB
SURFACE_XLIB

Functions§

negotiate
The newest ABI both sides speak (Mouser speaks MOUSER_ENGINE_ABI_MIN..=MOUSER_ENGINE_ABI_V2).
write_err⚠
Copy msg into a C error buffer (truncated, NUL-terminated).