[cairo] stream the svgsurface data to a file without multiple XML declaration

Pavan pavan.kumar at freesystems.biz
Wed Nov 16 04:37:05 PST 2011


Hi

 I want to stream the svg surface(and whatever data it has) on to the file ..and 
i used cairo_svg_surface_create_for_stream() for the same and could able to 
stream it 

....however I am getting Multiple XML declarations in the file....which is not 
required as part of XML .I am aware why this mutiple xml declarations are 
created thats becaz i am calling cairo_svg_surface_create_for_stream every time 
when i press the mouse and destroy the svgsurface at mouse release.

also i observed that write func from svgcreate func is emitted or called only 
when i call cairo_surface_destroy(svgsurface);..which i am doing in mouse 
release event.
1.Can't i do a incremental streaming by emitting write_func without calling 
cairo_surface_destroy().

something like :
svgsurface=(cairo_surface_t*)cairo_svg_surface_create_for_stream 
(write_func,streaming_file,w,h);
 and 
write_func (void *closure,const unsigned char *data, unsigned int length)
{
      fwrite (data, 1, length, (FILE *)closure);
      return CAIRO_STATUS_SUCCESS;
}

2.Can't I stream without calling cairo_svg_surface_create_for_stream() every 
time where there won't be Muliple XML declaration 

3.How do i stream the svgsurface data to a file without multiple 
XML declaration(like ...<?xml version="1.0" encoding="UTF-8"?>)

Please suggest where i am missing and any suggestions
Thanks
Pavan



More information about the cairo mailing list