Port rsvg-cairo-*.c to Rust
The rsvg-cairo-*.c
files implement the RsvgRender
interface as RsvgCairoRender
. They have these:
-
A lot of Cairo API calls. These should be easy to translate to cairo-rs. I don't know if there are missing parts in the binding; for those, we can call Cairo C functions by hand like in
link.rs
. For example,rsvg_cairo_render_path_builder
has several responsibilities and should probably be split apart: it maintains bounding boxes, sets up a Cairo context for rendering a path, asks the Rust machinery to pipe the path to Cairo. -
Internal state tracking for librsvg. The most important ones are probably
rsvg_cairo_push_render_stack
andrsvg_cairo_pop_render_stack
, which do several things: create temporarycairo_t
contexts, do clipping/masking, do filtering, maintain bounding boxes... It would be nice to split these into separate functions first. -
There are some pixel-crunching functions in
rsvg-cairo-draw.c
to convert a Cairo image surface to a GdkPixbuf and back.
If RsvgRender
gets turned into a trait, it would be nice to port rsvg-cairo-clip.c
to Rust as well - this is the other implementation of that interface.