16#ifndef MiL_SVG_ELEMENTS_COMPONENTS_H
17#define MiL_SVG_ELEMENTS_COMPONENTS_H 1
36 string filename(
_M_name +
".svg");
37 std::ofstream f(filename);
38 if (!f.is_open() || !f.good())
39 throw std::runtime_error(
"svg_element::write fail");
43 catch(std::exception& e)
54 const string start = R
"_delimiter_(<?xml version="1.0" encoding="utf-8"?>
55<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
57 id="svg2" xml:space="preserve"
58 xmlns="http://www.w3.org/2000/svg"
59 xmlns:xlink="http://www.w3.org/1999/xlink"
60 xmlns:html="http://www.w3.org/1999/xhtml"
63 const string unit(
"__unit");
64 const string width(
"__width");
65 const string height(
"__height");
67 string strip = R
"_delimiter_(x="0__unit" y="0__unit"
68width="__width__unit" height="__height__unit"
69viewBox="0 0 __width __height" enable-background="new 0 0 __width __height">
89 const string id(
"__id");
90 string start = R
"_delimiter_(<svg id="__id" )_delimiter_";
93 const string unit(
"__unit");
94 const string width(
"__width");
95 const string height(
"__height");
96 const string dwidth(
"__dwidth");
97 const string dheight(
"__dheight");
98 const string px(
"__x");
99 const string py(
"__y");
100 string strip = R
"_delimiter_(viewBox="0 0 __width __height" x="__x__unit" y="__y__unit" width="__dwidth__unit" height="__dheight__unit" )_delimiter_";
106 const auto [ dw, dh ] = destarea;
107 const auto [ x, y ] = p;
116 string m(
"svg_element::start_element error buffer is not empty: " );
120 throw std::runtime_error(
m);
129 const bool colornonep = nostr == fillstr;
142 const string f = R
"_delimiter_(<defs>
143 <filter id="gblur10" x="0" y="0">
144 <feGaussianBlur in="SourceGraphic" stdDeviation="10" />
145 <feOffset dx="0" dy="0" />
147 <filter id="gblur20" x="0" y="0">
148 <feGaussianBlur in="SourceGraphic" stdDeviation="20" />
149 <feOffset dx="0" dy="0" />
151 <filter id="gblur10y" x="0" y="0">
152 <feGaussianBlur in="SourceGraphic" stdDeviation="0, 10" />
153 <feOffset dx="0" dy="0" />
155 <filter id="gblur20y" x="0" y="0">
156 <feGaussianBlur in="SourceGraphic" stdDeviation="0, 20" />
157 <feOffset dx="0" dy="0" />
stream_type _M_sstream
Virtual, only one buffer.
void add_style(const style &sty)
void add_title(const string &t)
void start_element()
SVG element beginning boilerplate for outermost (containing) svg_element. Variable: unit,...
bool empty()
Empty when the output buffer is.
void start(const string &desc="")
void add_element(const element_base &e)
unit
Measurement abstraction for absolute (not relative) measurements.
@ px
Pixel where 1 pixel x 96 PPI = .26 mm.
const string to_string(const unit e)
void string_replace(std::string &target, const std::string &match, const std::string &replace)
std::tuple< space_type, space_type > point_2t
Point (x,y) in 2D space.
Datum consolidating style preferences.