Skip to content

Draft: start a render tree

Federico Mena Quintero requested to merge federico/librsvg:render-tree into master

Okay, not quite. But this is the beginning, hopefully.

  • Start a Stroke struct which is intended to have all the stroke parameters in user-space coordinates. I couldn't put the paint_source in there, since creating a UserSpacePaintSource first needs the bbox of the path/shape in question.

  • Remove the DrawingCtx.push_cairo_context/pop_cairo_context/with_cairo_context hacks; replace them with DrawingCtx.nested().

The first point goes along with the idea of normalizing everything to user-space coordinates early as possible. I'm starting to feel like BoundingBox needs to be split again; we only need the objectBoundingBox / cairo_path_extents() here, not the ink_rect.

(Alternative: start looking into Rust crates to compute path extents and such. The kurbo crate can do it.)

I'd like to end up with something like

struct Shape {
    path: Path,
    fill: Fill,
    stroke: Stroke,
    paint_order: ...,
    opacity / filters / mask: ...,
}

all in user-space coordinates, for the leaf nodes of the render tree.

Comments appreciated :)

Merge request reports