Родитель
af84aa5e46
Сommit
6137e81f17
@ -0,0 +1,33 @@
|
||||
#include <iostream>
|
||||
#include "svg.h"
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
void svg_begin(double width, double height) {
|
||||
std::cout << "<?xml version='1.0' encoding='UTF-8'?>\n";
|
||||
std::cout << "<svg ";
|
||||
std::cout << "width='" << width << "' ";
|
||||
std::cout << "height='" << height << "' ";
|
||||
std::cout << "viewBox='0 0 " << width << " " << height << "' ";
|
||||
std::cout << "xmlns='http://www.w3.org/2000/svg'>\n";
|
||||
}
|
||||
|
||||
void svg_end() {
|
||||
std::cout << "</svg>\n";
|
||||
}
|
||||
|
||||
void svg_text(double left, double baseline, std::string text){
|
||||
std::cout << "<text x='" << left << "' y='" << baseline << "'>" << text << "</text>";
|
||||
}
|
||||
|
||||
void show_histogram_svg(const std::vector<size_t>& bins){
|
||||
svg_begin(400, 300);
|
||||
svg_text(20, 20, std::to_string(bins[0]));
|
||||
svg_end();
|
||||
}
|
||||
|
||||
/*
|
||||
void svg_rect(double x, double y, double width, double height){
|
||||
std::cout << "<rect x='" << x << "' y='" width='" << width << "' height='" << height << "' />"
|
||||
}
|
||||
*/
|
@ -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 show_histogram_svg(const std::vector<size_t>& bins);
|
||||
void svg_text(double left, double baseline, std::string text);
|
||||
//void svg_rect(double x, double y, double width, double height)
|
||||
|
||||
#endif // SVG_H_INCLUDED
|
Загрузка…
Ссылка в новой задаче