Skip to main content

render_styled

Function render_styled 

Source
pub fn render_styled<'a>(
    arena: &'a Arena,
    root_id: u32,
    width: u16,
    transform_of: &'a TransformAccessor<'a>,
    color_level: ColorLevel,
) -> (String, u16)
Expand description

Render the arena tree rooted at root_id to a styled frame, returning both the frame string and its height in rows (mirrors ink's {output, height}, output.ts:315-316). This is the entry M3-E render_frame` calls.

transform_of is the per-node own-transform seam (see walk::TransformAccessor): given a dom id it returns the node’s own output transform (ink’s internal_transform), or None. <Text color> SGR is not a separate path — in ink it lives inside internal_transform (Text.tsx:94-130 → colorize), so a core caller wires colorize into the accessor and napi (M3-E) dispatches to a JS internal_transform; both flow through the same [own, ...inherited] chain (render-node-to-output.ts:136).

Reuses build_layout_engine (the M3-A seam) verbatim — the layout build is never duplicated. An empty/zero-sized frame returns (String::new(), 0), matching the prior render_to_string error/empty path.