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§
- Mouser
Caps - What an engine can do, filled in by
MouserEngineV2::caps. - Mouser
Engine V1 - The engine’s function table.
- Mouser
Engine V2 - The v2 function table. It starts with a complete v1 table (
base.abiis 2,base.sizeissize_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). - Mouser
Frame - A whole frame. Pointers are valid only during
draw. - Mouser
Glyph - Glyph coverage bitmap (8-bit alpha,
stridebytes per row) with its top-left corner at (x,y), tinted withcolor.keyis stable for the same character and font generation, so engines may cache uploads. - Mouser
Image - Image placement: the source rectangle (
src_*) of an RGBA8 image (img_wximg_h, straight alpha) drawn scaled towxhwith its top-left at (x,y).keyis unique per uploaded image. - Mouser
Op - One operation:
indexinto the rects, glyphs or images array. - Mouser
Pixels - The pixel buffer for
SURFACE_PIXELS:0x00RRGGBBper pixel,stridepixels per row. Mouser may changedata/width/heightbetween calls (it callsresizefirst); read them in everydraw. - Mouser
Rect - Solid rectangle; colours are 0xRRGGBB.
- Mouser
Surface - The window to present to. For Wayland
displayis thewl_display*andwindowthewl_surface*; for Xlibwindowholds the XID; for Xcb the connection and window id; AppKit theNSView*; Win32 theHWND(display = HINSTANCE).
Constants§
- CAP_
DIRECT_ SURFACE - CAP_
PIXELS - CAP_
VSYNC_ CONTROL - Capability flags in
MouserCaps::flags. - DRAW_
AGAIN - DRAW_OK
drawresults.- 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
abiof aMouserEngineV1table). - 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:
windowpoints to aMouserPixels;drawfills it and Mouser presents it. Used when the engine runs in Mouser’s engine host process. - SURFACE_
WAYLAND - SURFACE_
WIN32 - SURFACE_
XCB - SURFACE_
XLIB