/* The engine's C interface; `crates/webengine/src/lib.rs` is the definition. */ #ifndef WEBENGINE_H #define WEBENGINE_H #include #include #ifdef __cplusplus extern "C" { #endif /* One element's border box in viewport coordinates, CSS px. `element` is the element's position among the document's elements in document order, first. */ typedef struct WebengineBox { uint32_t element; double x; double y; double width; double height; } WebengineBox; /* Lays out a NUL-terminated UTF-8 HTML document against a width x height CSS px viewport. Returns *count boxes, a parent before its children, to be released with webengine_boxes_free; or NULL with *count 0 when html is NULL or not UTF-8, or when layout fails. */ WebengineBox *webengine_layout(const char *html, double width, double height, size_t *count); /* Releases what webengine_layout returned. NULL is ignored. */ void webengine_boxes_free(WebengineBox *boxes, size_t count); #ifdef __cplusplus } #endif #endif