IGBB / quack

A FASTQ quality assessment tool
GNU General Public License v3.0
14 stars 5 forks source link

SVG library #8

Closed maa146 closed 5 years ago

maa146 commented 5 years ago

Current api:

svg_start_tag("svg", 5,
            svg_attr(width,   "%d", width),
            svg_attr(height,  "%d", height),
            svg_attr(viewBox, "%d %d %d %d", 20, 0, width, height),
            svg_attr(xmlns,       "%s", "http://www.w3.org/2000/svg"),
            svg_attr(xmlns:xlink, "%s", "http://www.w3.org/1999/xlink")
);

svg_simple_tag("line", 5,
            svg_attr(x1,   "%d", 20),
            svg_attr(x2,  "%d", 100),
            svg_attr(y1,   "%d", 20),
            svg_attr(y2,  "%d", 100),
            svg_attr(stroke, "%s", "black")
);

svg_end_tag("svg");

output:

<svg width="800" height="1024" viewBox="20 0 800 1024" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<line x1="20" x2="100" y1="20" y2="100"/>
</svg>