Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _USE_MATH_DEFINES
- #include "svg.h"
- #include <cmath>
- #include <iostream>
- using namespace std::literals;
- using namespace svg;
- using namespace std;
- // namespace
- void DocumentTest() {
- {
- Document doc;
- doc.Render(cout);
- cout << "endl";
- } {
- Document doc;
- doc.Add(Circle().SetCenter({20, 20}).SetRadius(10));
- doc.Render(cout);
- cout << "endl";
- } {
- Document doc;
- doc.Add(Circle().SetCenter({20, 20}).SetRadius(10));
- doc.Add(Text()
- .SetFontFamily("Verdana"s)
- .SetPosition({35, 20})
- .SetOffset({0, 6})
- .SetFontSize(12)
- .SetFontWeight("bold"s)
- .SetData("Hello C++"s));
- doc.Add(Polyline().AddPoint({20, 20}).AddPoint({10, 15}).AddPoint({0, 10}));
- doc.Render(cout);
- cout << "endl";
- } {
- Document doc;
- doc.AddPtr(make_unique<Circle>(move(
- Circle().SetCenter({20, 20}).SetRadius(10))));
- doc.AddPtr(make_unique<Text>(move(
- Text()
- .SetFontFamily("Verdana"s)
- .SetPosition({35, 20})
- .SetOffset({0, 6})
- .SetFontSize(12)
- .SetFontWeight("bold"s)
- .SetData("Hello C++"s))));
- doc.AddPtr(make_unique<Polyline>(move(
- Polyline().AddPoint({20, 20}).AddPoint({10, 15}).AddPoint({0, 10}))));
- doc.Render(cout);
- }
- }
- int main() {
- DocumentTest();
- }
- <?xml version="1.0" encoding="UTF-8" ?>
- <svg xmlns="http://www.w3.org/2000/svg" version="1.1">
- </svg>endl<?xml version="1.0" encoding="UTF-8" ?>
- <svg xmlns="http://www.w3.org/2000/svg" version="1.1">
- <circle cx="20" cy="20" r="10" />
- </svg>endl<?xml version="1.0" encoding="UTF-8" ?>
- <svg xmlns="http://www.w3.org/2000/svg" version="1.1">
- <circle cx="20" cy="20" r="10" />
- <text x="35" y="20" dx="0" dy="6" font-size="12" font-family="Verdana" font-weight="bold">Hello C++</text>
- <polyline points="20,20 10,15 0,10" />
- </svg>endl<?xml version="1.0" encoding="UTF-8" ?>
- <svg xmlns="http://www.w3.org/2000/svg" version="1.1">
- <circle cx="20" cy="20" r="10" />
- <text x="35" y="20" dx="0" dy="6" font-size="12" font-family="Verdana" font-weight="bold">Hello C++</text>
- <polyline points="20,20 10,15 0,10" />
- </svg>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement