[cairo] Will Cairo support SVG as a "Rendering System" any time in the not-so-nearby future?

Thomas Hunger info at teh-web.de
Tue Mar 23 14:23:32 PST 2004


> It wouldn't be too difficult to write an SVG backend for cairo.
I tried a few weeks ago and wonder how this could be done (I hacked it 
externally by using the current_... functions)? The surface_backend_t is not 
suitable since writing each trapezoid to svg via composite_trapezoids does 
not seem like a good idea.
Would creating a new gstate backend be an option? Actually replacing 
cairo_stroke, cairo_fill, cairo_show_glyphs and cairo_show_text should be 
enough, shouldn't it? (This could also be used for another ps_backend which 
does more than saving a pixmap.)
So maybe introducing a higher-level backend could work:

typedef struct {
  cairo_status_t (*cairo_stroke) (cairo_gstate_t *gstate);
  ...
} cairo_operation_backend _t;

But I have no idea where this should be stored, since keeping a reference to 
this high-level backend in each surface_backend seems overkill.  
cairo_set_target_svg could set the gstate->surface to NULL and instead change 
the cairo_operation_backend_t pointer in gstate to a svg backend. 

Tom





More information about the cairo mailing list