code: цвет добавлен
Этот коммит содержится в:
@@ -1,5 +1,5 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<svg width='400' height='300' viewBox='0 0 400 300' xmlns='http://www.w3.org/2000/svg'>
|
||||
<text x='20' y='35'>2</text>
|
||||
<rect x='50' width='20' height='30' rx ='0' />
|
||||
<rect x='50' y='0' width='20' height='30' stroke = 'purple' fill='red' />
|
||||
</svg>
|
||||
|
||||
|
До Ширина: | Высота: | Размер: 210 B После Ширина: | Высота: | Размер: 237 B |
@@ -29,15 +29,27 @@ svg_text(double left, double baseline, string text) {
|
||||
cout << "<text x='" << left << "' y='" << baseline << "'>" << text << "</text>" << endl;
|
||||
}
|
||||
|
||||
void svg_rect(double x, double y, double width, double height) {
|
||||
cout << "<rect x='" << x << "' width='" << width << "' height='" << height << "' rx ='" << y << "' />" << endl;
|
||||
void svg_rect(double x, double y, double width, double height, string stroke, string fill) {
|
||||
cout << "<rect x='" << x << "' y='" << y << "' width='" << width << "' height='" << height << "' stroke = '" << stroke << "' fill='" << fill << "' />" << endl;
|
||||
}
|
||||
|
||||
void
|
||||
show_histogram_svg(const vector<size_t> bins) {
|
||||
|
||||
const auto IMAGE_WIDTH = 400;
|
||||
const auto IMAGE_HEIGHT = 300;
|
||||
const auto TEXT_LEFT = 20;
|
||||
const auto TEXT_BASELINE = 20;
|
||||
const auto TEXT_WIDTH = 50;
|
||||
const auto BIN_HEIGHT = 30;
|
||||
const auto BLOCK_WIDTH = 10;
|
||||
|
||||
|
||||
|
||||
|
||||
svg_begin(400, 300);
|
||||
svg_text(20, 35, to_string(bins[0]));
|
||||
svg_rect(50, 0, bins[0] * 10, 30);
|
||||
svg_rect(50, 0, bins[0] * 10, 30, "purple", "red");
|
||||
svg_end();
|
||||
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user