From 66988c8e83094758e55282c51f45a01933bcc0c9 Mon Sep 17 00:00:00 2001 From: Francesco Abbate Date: Tue, 6 Dec 2011 22:26:34 +0100 Subject: Add support to write plot objects in SVG format --- agg-plot/canvas_svg.cpp | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 agg-plot/canvas_svg.cpp (limited to 'agg-plot/canvas_svg.cpp') diff --git a/agg-plot/canvas_svg.cpp b/agg-plot/canvas_svg.cpp new file mode 100644 index 00000000..d8f05cb9 --- /dev/null +++ b/agg-plot/canvas_svg.cpp @@ -0,0 +1,42 @@ +#include "canvas_svg.h" + +const double canvas_svg::default_stroke_width = 1.0; + +static void canvas_draw_svg(svg_vs* vs, FILE* f, int id, agg::rgba8 c) +{ + str s = vs->write_svg(id, c); + canvas_svg::writeln(f, s, " "); +} + +static void canvas_draw_outline_svg(svg_vs* vs, FILE* f, int id, agg::rgba8 c) +{ + str path; + svg_property_list* ls = vs->svg_path(path); + str s = svg_stroke_path(path, canvas_svg::default_stroke_width, id, c, ls); + list::free(ls); + canvas_svg::writeln(f, s, " "); +} + +template +void canvas_svg::draw(svg_vs& vs, agg::rgba8 c) +{ + canvas_draw_svg(&vs, m_output, m_current_id++, c); +} + +template +void canvas_svg::draw_outline(svg_vs& vs, agg::rgba8 c) +{ + canvas_draw_outline_svg(&vs, m_output, m_current_id++, c); +} + +template +void canvas_svg::draw(drawable& vs, agg::rgba8 c) +{ + canvas_draw_svg(&vs, m_output, m_current_id++, c); +} + +template +void canvas_svg::draw_outline(drawable& vs, agg::rgba8 c) +{ + canvas_draw_outline_svg(&vs, m_output, m_current_id++, c); +} -- cgit v1.2.3

AltStyle によって変換されたページ (->オリジナル) /