From 9a486dec4be4bd327949f06245c661eee87383d0 Mon Sep 17 00:00:00 2001 From: ShinkarenkoVA <shinkarenkova@mpei.ru> Date: Mon, 22 Apr 2024 05:07:15 +0300 Subject: [PATCH] =?UTF-8?q?build:=20=D1=84=D0=BE=D1=80=D0=BC=D0=B0=D1=82?= =?UTF-8?q?=20svg?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- svg.cpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 svg.cpp diff --git a/svg.cpp b/svg.cpp new file mode 100644 index 0000000..a7753a0 --- /dev/null +++ b/svg.cpp @@ -0,0 +1,33 @@ +#include <iostream> +#include <conio.h> +#include <vector> +#include <stdlib.h> +#include "svg.h" +#include "text.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_text(20, 20, to_string(bins[0])); + svg_end(); +} + +void svg_text(double left, double baseline, string text){ + cout << "text x='" << left << "' y='" << baseline << "'>text</text>"; + }