Loading...
Searching...
No Matches
SVG.h
1/*
2
3MIT License
4
5Copyright (c) 2023 FMI Open Development / Markus Peura, first.last@fmi.fi
6
7Permission is hereby granted, free of charge, to any person obtaining a copy
8of this software and associated documentation files (the "Software"), to deal
9in the Software without restriction, including without limitation the rights
10to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11copies of the Software, and to permit persons to whom the Software is
12furnished to do so, subject to the following conditions:
13
14The above copyright notice and this permission notice shall be included in all
15copies or substantial portions of the Software.
16
17THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23SOFTWARE.
24
25*/
26/*
27Part of Rack development has been done in the BALTRAD projects part-financed
28by the European Union (European Regional Development Fund and European
29Neighbourhood Partnership Instrument, Baltic Sea Region Programme 2007-2013)
30*/
31/*
32 * TreeSVG.h
33 *
34 * Created on: Nov, 2024
35 * Author: mpeura
36 */
37
38#ifndef DRAIN_SVG
39#define DRAIN_SVG
40
41#include <string>
42
43//#include "drain/Enum.h"
44#include "drain/util/XML.h"
45#include "drain/util/Frame.h"
46// #include "AlignSVG.h"
47
48
49namespace drain {
50
51namespace image {
52
53struct svg {
54
55 typedef float coord_t;
56
57 enum tag_t {
58 UNDEFINED=XML::UNDEFINED,
59 COMMENT=XML::COMMENT,
60 CTEXT=XML::CTEXT,
61 SCRIPT=XML::SCRIPT,
62 STYLE=XML::STYLE,
63 STYLE_SELECT=XML::STYLE_SELECT,
64 SCOPE_CURLY=XML::SCOPE_CURLY,
65 SVG=10,
66 CIRCLE, CLIP_PATH, DEFS, DESC, GROUP, IMAGE, LINE, LINEAR_GRADIENT, MASK, METADATA, PATH, POLYGON, RECT, TEXT, TITLE, TSPAN };
67 // check CTEXT, maybe implement in XML
68
69};
70
71/*
72class NodeSVG;
73
74// typedef drain::UnorderedMultiTree<NodeSVG,false, NodeXML<>::path_t> TreeSVG;
75typedef DRAIN_XML_TREE(NodeSVG) TreeSVG;
76
77typedef SelectXML<svg::tag_t> SelectSVG;
78*/
79
80} // image::
81
82
83
84
85
86
87
88namespace image {
89
90
91class BBoxSVG : public drain::Box<svg::coord_t> {
92
93public:
94
95 inline
96 BBoxSVG(svg::coord_t x=0, svg::coord_t y=0, svg::coord_t width=0, svg::coord_t height=0) : drain::Box<svg::coord_t>(x, y, width, height) {
97 }
98
99 inline
100 BBoxSVG(const BBoxSVG & bbox) : drain::Box<svg::coord_t>(bbox) {
101 }
102
103 BBoxSVG & operator=(const BBoxSVG &) = default;
104
105
106 // New
107
108
109
110 // Future option - also other units!
111 /*
112 bool x_PERCENTAGE = false;
113 bool y_PERCENTAGE = false;
114 bool width_PERCENTAGE = false;
115 bool height_PERCENTAGE = false;
116 */
117};
118
119
120
121
122
123} // image::
124
125// template <>
126// const Enum<image::svg::tag_t>::dict_t Enum<image::svg::tag_t>::dict;
127DRAIN_ENUM_DICT(image::svg::tag_t);
128
129DRAIN_ENUM_OSTREAM(image::svg::tag_t)
130
131
132} // drain::
133
134
135
136#endif // DRAIN_COORDS_SVG
137
Definition SVG.h:91
Definition Data.h:1473
Something that has coordinates (x,y) and dimensions (width, height).
Definition Frame.h:225
Definition SVG.h:53