Родитель
d5dded25e2
Сommit
d7f4739d5e
@ -0,0 +1,26 @@
|
||||
#include "svg.h"
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
void svg_begin(double width, double height) {
|
||||
cout << "<?xml version='1.0' encoding='UTF-8' ?>\n";
|
||||
cout << "<svg width='" << width << "' height='" << height << "' "
|
||||
<< "viewBox='0 0 " << width << " " << height << "' "
|
||||
<< "xmlns='http://www.w3.org/2000/svg'>\n";
|
||||
}
|
||||
|
||||
void svg_end() {
|
||||
cout << "</svg>\n";
|
||||
}
|
||||
|
||||
void svg_text(double left, double baseline, const std::string& text) {
|
||||
cout << "<text x='" << left << "' y='" << baseline << "'>" << text << "</text>\n";
|
||||
}
|
||||
|
||||
void svg_rect(double x, double y, double width, double height,
|
||||
const std::string& stroke, const std::string& fill) {
|
||||
cout << "<rect x='" << x << "' y='" << y << "' width='" << width
|
||||
<< "' height='" << height << "' stroke='" << stroke
|
||||
<< "' fill='" << fill << "' />\n";
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
#ifndef SVG_H_INCLUDED
|
||||
#define SVG_H_INCLUDED
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
void svg_begin(double width, double height);
|
||||
void svg_end();
|
||||
void svg_text(double left, double baseline, const std::string& text);
|
||||
void svg_rect(double x, double y, double width, double height, const std::string& stroke = "black", const std::string& fill = "black");
|
||||
|
||||
#endif // SVG_H_INCLUDED
|
Загрузка…
Ссылка в новой задаче