Skip to main content

render_image

Function render_image 

Source
pub fn render_image(
    element: &LayoutElement,
    params: &ImageParams,
    ctx: &DataContext,
    render_ctx: &RenderContext<'_>,
    painter: &mut dyn Painter,
) -> Result<(), RenderError>
Expand description

Render an image element.

§Sprite data lookup

The source template is resolved via DataContext::resolve, producing a lookup key. This key is used to find a matching tileset in render_ctx.tilesets. When found, the tileset’s tiles are drawn row by row at the element rect position, applying flip_x, flip_y, and palette as specified in the params.

§Placeholder (no sprite data)

If the resolved key does not match any tileset, a striped placeholder rectangle is drawn. The stripes alternate between LightGray and DarkGray in a checkerboard pattern, visually indicating “image not found”.