From 0cf180a527acb81e6718b1153e7730ee28c3def0 Mon Sep 17 00:00:00 2001 From: Hermet Park Date: Wed, 17 Nov 2021 12:04:44 +0900 Subject: [PATCH] example stroke: added vertical line samples. --- src/examples/Stroke.cpp | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/examples/Stroke.cpp b/src/examples/Stroke.cpp index 4837ace..9cc11fd 100644 --- a/src/examples/Stroke.cpp +++ b/src/examples/Stroke.cpp @@ -89,13 +89,21 @@ void tvgDrawCmds(tvg::Canvas* canvas) //Test for Stroke Width for (int i = 0; i < 10; ++i) { - auto shape = tvg::Shape::gen(); - shape->moveTo(50, 550 + (25 * i)); - shape->lineTo(750, 550 + (25 * i)); - shape->stroke(255, 255, 255, 255); //color: r, g, b, a - shape->stroke(i + 1); //stroke width - shape->stroke(tvg::StrokeCap::Round); //default is Square - if (canvas->push(move(shape)) != tvg::Result::Success) return; + auto hline = tvg::Shape::gen(); + hline->moveTo(50, 550 + (25 * i)); + hline->lineTo(400, 550 + (25 * i)); + hline->stroke(255, 255, 255, 255); //color: r, g, b, a + hline->stroke(i + 1); //stroke width + hline->stroke(tvg::StrokeCap::Round); //default is Square + if (canvas->push(move(hline)) != tvg::Result::Success) return; + + auto vline = tvg::Shape::gen(); + vline->moveTo(450 + (33 * i), 550); + vline->lineTo(450 + (33 * i), 780); + vline->stroke(255, 255, 255, 255); //color: r, g, b, a + vline->stroke(i + 1); //stroke width + vline->stroke(tvg::StrokeCap::Round); //default is Square + if (canvas->push(move(vline)) != tvg::Result::Success) return; } } -- 2.7.4