build: Добавлены файлы для вывода кода SVG

main
Ишутина Елизавета 2 лет назад
Родитель a15d6100df
Сommit 01e31467cd

@ -3,6 +3,7 @@
#include <cmath>
#include "histogram.h"
#include "text.h"
#include "svg.h"
const size_t WINDOW_WIDTH = 80;
const size_t MAX_VALUE = WINDOW_WIDTH - 3 - 1;
using namespace std;
@ -30,7 +31,7 @@ main(){
double min = 0, max = 0;
Input in = input_data();
auto bins = make_histogram(in.numbers, in.bin_count);
for (auto now: bins) {cout << now << endl;}
show_histogram_text(bins);
//for (auto now: bins) {cout << now << endl;}
show_histogram_svg(bins);
return 0;
}

@ -0,0 +1,24 @@
#include <iostream>
#include <vector>
#include "svg.h"
using namespace std;
void
svg_begin(double width, double height) {
cout << "<?xml version='1.0' encoding='UTF-8'?>\n";
cout << "<svg ";
cout << "width='" << width << "' ";
cout << "height='" << height << "' ";
cout << "viewBox='0 0 " << width << " " << height << "' ";
cout << "xmlns='http://www.w3.org/2000/svg'>\n";
}
void
svg_end() {
cout << "</svg>\n";
}
void
show_histogram_svg(const vector <size_t> &bins) {
svg_begin(400, 300);
svg_end();
}

13
svg.h

@ -0,0 +1,13 @@
#ifndef SVG_H_INCLUDED
#define SVG_H_INCLUDED
#include <vector>
using namespace std;
void
svg_begin(double width, double height);
void
svg_end();
void
show_histogram_svg(const vector <size_t> &bins);
#endif // SVG_H_INCLUDED
Загрузка…
Отмена
Сохранить