api: enhance Shape::stroke() method usage.

Designate a default value for alpha which is mostly optional.
This commit is contained in:
Hermet Park 2023-06-06 14:03:25 +09:00 committed by Hermet Park
parent 1ae92daa9d
commit 6cbc1de570
19 changed files with 54 additions and 54 deletions

View file

@ -928,7 +928,7 @@ public:
* *
* @return Result::Success when succeed, Result::FailedAllocation otherwise. * @return Result::Success when succeed, Result::FailedAllocation otherwise.
*/ */
Result stroke(uint8_t r, uint8_t g, uint8_t b, uint8_t a) noexcept; Result stroke(uint8_t r, uint8_t g, uint8_t b, uint8_t a = 255) noexcept;
/** /**
* @brief Sets the gradient fill of the stroke for all of the figures from the path. * @brief Sets the gradient fill of the stroke for all of the figures from the path.
@ -1089,7 +1089,7 @@ public:
* *
* @return Result::Success when succeed, Result::InsufficientCondition otherwise. * @return Result::Success when succeed, Result::InsufficientCondition otherwise.
*/ */
Result strokeColor(uint8_t* r, uint8_t* g, uint8_t* b, uint8_t* a) const noexcept; Result strokeColor(uint8_t* r, uint8_t* g, uint8_t* b, uint8_t* a = nullptr) const noexcept;
/** /**
* @brief Gets the pointer to the gradient fill of the stroke. * @brief Gets the pointer to the gradient fill of the stroke.

View file

@ -55,7 +55,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
pMaskShape = maskShape.get(); pMaskShape = maskShape.get();
maskShape->appendCircle(180, 180, 75, 75); maskShape->appendCircle(180, 180, 75, 75);
maskShape->fill(125, 125, 125); maskShape->fill(125, 125, 125);
maskShape->stroke(25, 25, 25, 255); maskShape->stroke(25, 25, 25);
maskShape->stroke(tvg::StrokeJoin::Round); maskShape->stroke(tvg::StrokeJoin::Round);
maskShape->stroke(10); maskShape->stroke(10);
canvas->push(std::move(maskShape)); canvas->push(std::move(maskShape));

View file

@ -33,38 +33,38 @@ void tvgDrawCmds(tvg::Canvas* canvas)
//Arc Line //Arc Line
auto shape1 = tvg::Shape::gen(); auto shape1 = tvg::Shape::gen();
shape1->appendArc(150, 150, 80, 10, 180, false); shape1->appendArc(150, 150, 80, 10, 180, false);
shape1->stroke(255, 255, 255, 255); shape1->stroke(255, 255, 255);
shape1->stroke(2); shape1->stroke(2);
if (canvas->push(std::move(shape1)) != tvg::Result::Success) return; if (canvas->push(std::move(shape1)) != tvg::Result::Success) return;
auto shape2 = tvg::Shape::gen(); auto shape2 = tvg::Shape::gen();
shape2->appendArc(400, 150, 80, 0, 300, false); shape2->appendArc(400, 150, 80, 0, 300, false);
shape2->stroke(255, 255, 255, 255); shape2->stroke(255, 255, 255);
shape2->stroke(2); shape2->stroke(2);
if (canvas->push(std::move(shape2)) != tvg::Result::Success) return; if (canvas->push(std::move(shape2)) != tvg::Result::Success) return;
auto shape3 = tvg::Shape::gen(); auto shape3 = tvg::Shape::gen();
shape3->appendArc(600, 150, 80, 300, 60, false); shape3->appendArc(600, 150, 80, 300, 60, false);
shape3->stroke(255, 255, 255, 255); shape3->stroke(255, 255, 255);
shape3->stroke(2); shape3->stroke(2);
if (canvas->push(std::move(shape3)) != tvg::Result::Success) return; if (canvas->push(std::move(shape3)) != tvg::Result::Success) return;
//Pie Line //Pie Line
auto shape4 = tvg::Shape::gen(); auto shape4 = tvg::Shape::gen();
shape4->appendArc(150, 400, 80, 10, 180, true); shape4->appendArc(150, 400, 80, 10, 180, true);
shape4->stroke(255, 255, 255, 255); shape4->stroke(255, 255, 255);
shape4->stroke(2); shape4->stroke(2);
if (canvas->push(std::move(shape4)) != tvg::Result::Success) return; if (canvas->push(std::move(shape4)) != tvg::Result::Success) return;
auto shape5 = tvg::Shape::gen(); auto shape5 = tvg::Shape::gen();
shape5->appendArc(400, 400, 80, 0, 300, true); shape5->appendArc(400, 400, 80, 0, 300, true);
shape5->stroke(255, 255, 255, 255); shape5->stroke(255, 255, 255);
shape5->stroke(2); shape5->stroke(2);
if (canvas->push(std::move(shape5)) != tvg::Result::Success) return; if (canvas->push(std::move(shape5)) != tvg::Result::Success) return;
auto shape6 = tvg::Shape::gen(); auto shape6 = tvg::Shape::gen();
shape6->appendArc(600, 400, 80, 300, 60, true); shape6->appendArc(600, 400, 80, 300, 60, true);
shape6->stroke(255, 255, 255, 255); shape6->stroke(255, 255, 255);
shape6->stroke(2); shape6->stroke(2);
if (canvas->push(std::move(shape6)) != tvg::Result::Success) return; if (canvas->push(std::move(shape6)) != tvg::Result::Success) return;
@ -72,21 +72,21 @@ void tvgDrawCmds(tvg::Canvas* canvas)
auto shape7 = tvg::Shape::gen(); auto shape7 = tvg::Shape::gen();
shape7->appendArc(150, 650, 80, 10, 180, true); shape7->appendArc(150, 650, 80, 10, 180, true);
shape7->fill(255, 255, 255); shape7->fill(255, 255, 255);
shape7->stroke(255, 0, 0, 255); shape7->stroke(255, 0, 0);
shape7->stroke(2); shape7->stroke(2);
if (canvas->push(std::move(shape7)) != tvg::Result::Success) return; if (canvas->push(std::move(shape7)) != tvg::Result::Success) return;
auto shape8 = tvg::Shape::gen(); auto shape8 = tvg::Shape::gen();
shape8->appendArc(400, 650, 80, 0, 300, true); shape8->appendArc(400, 650, 80, 0, 300, true);
shape8->fill(255, 255, 255); shape8->fill(255, 255, 255);
shape8->stroke(255, 0, 0, 255); shape8->stroke(255, 0, 0);
shape8->stroke(2); shape8->stroke(2);
if (canvas->push(std::move(shape8)) != tvg::Result::Success) return; if (canvas->push(std::move(shape8)) != tvg::Result::Success) return;
auto shape9 = tvg::Shape::gen(); auto shape9 = tvg::Shape::gen();
shape9->appendArc(600, 650, 80, 300, 60, true); shape9->appendArc(600, 650, 80, 300, 60, true);
shape9->fill(255, 255, 255); shape9->fill(255, 255, 255);
shape9->stroke(255, 0, 0, 255); shape9->stroke(255, 0, 0);
shape9->stroke(2); shape9->stroke(2);
if (canvas->push(std::move(shape9)) != tvg::Result::Success) return; if (canvas->push(std::move(shape9)) != tvg::Result::Success) return;
} }

View file

@ -57,7 +57,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
auto star1 = tvg::Shape::gen(); auto star1 = tvg::Shape::gen();
tvgDrawStar(star1.get()); tvgDrawStar(star1.get());
star1->fill(255, 255, 0); star1->fill(255, 255, 0);
star1->stroke(255 ,0, 0, 255); star1->stroke(255 ,0, 0);
star1->stroke(10); star1->stroke(10);
//Move Star1 //Move Star1
@ -73,7 +73,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
auto star2 = tvg::Shape::gen(); auto star2 = tvg::Shape::gen();
tvgDrawStar(star2.get()); tvgDrawStar(star2.get());
star2->fill(0, 255, 255); star2->fill(0, 255, 255);
star2->stroke(0 ,255, 0, 255); star2->stroke(0 ,255, 0);
star2->stroke(10); star2->stroke(10);
star2->opacity(100); star2->opacity(100);
@ -106,7 +106,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
fill->colorStops(colorStops, 2); fill->colorStops(colorStops, 2);
star3->fill(std::move(fill)); star3->fill(std::move(fill));
star3->stroke(255 ,0, 0, 255); star3->stroke(255 ,0, 0);
star3->stroke(10); star3->stroke(10);
star3->translate(400, 0); star3->translate(400, 0);

View file

@ -48,7 +48,7 @@ void tvgUpdateCmds(tvg::Canvas* canvas, float progress)
shape->close(); shape->close();
shape->fill(0, 0, 255); shape->fill(0, 0, 255);
shape->stroke(3); shape->stroke(3);
shape->stroke(255, 255, 255, 255); shape->stroke(255, 255, 255);
//Transform Matrix //Transform Matrix
tvg::Matrix m = {1, 0, 0, 0, 1, 0, 0, 0, 1}; tvg::Matrix m = {1, 0, 0, 0, 1, 0, 0, 0, 1};

View file

@ -51,7 +51,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
//fill property will be retained //fill property will be retained
shape->fill(127, 255, 255); shape->fill(127, 255, 255);
shape->stroke(0, 0, 255, 255); shape->stroke(0, 0, 255);
shape->stroke(1); shape->stroke(1);
if (canvas->push(std::move(shape)) != tvg::Result::Success) return; if (canvas->push(std::move(shape)) != tvg::Result::Success) return;
@ -68,7 +68,7 @@ void tvgUpdateCmds(tvg::Canvas* canvas, float progress)
if (pShape->reset() == tvg::Result::Success) { if (pShape->reset() == tvg::Result::Success) {
pShape->appendRect(-100 + (800 * progress), -100 + (800 * progress), 200, 200, (100 * progress), (100 * progress)); pShape->appendRect(-100 + (800 * progress), -100 + (800 * progress), 200, 200, (100 * progress), (100 * progress));
pShape->fill(127, 255, 255); pShape->fill(127, 255, 255);
pShape->stroke(0, 0, 255, 255); pShape->stroke(0, 0, 255);
pShape->stroke(30 * progress); pShape->stroke(30 * progress);
//Update shape for drawing (this may work asynchronously) //Update shape for drawing (this may work asynchronously)

View file

@ -39,7 +39,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
shape1->appendRect(220, 10, 100, 100, 0, 0); shape1->appendRect(220, 10, 100, 100, 0, 0);
shape1->stroke(3); shape1->stroke(3);
shape1->stroke(0, 255, 0, 255); shape1->stroke(0, 255, 0);
float dashPattern[2] = {4, 4}; float dashPattern[2] = {4, 4};
shape1->stroke(dashPattern, 2); shape1->stroke(dashPattern, 2);

View file

@ -60,7 +60,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
shape1->lineTo(100, 150); shape1->lineTo(100, 150);
shape1->close(); shape1->close();
shape1->stroke(0, 255, 0, 255); shape1->stroke(0, 255, 0);
shape1->stroke(20); shape1->stroke(20);
shape1->stroke(tvg::StrokeJoin::Miter); shape1->stroke(tvg::StrokeJoin::Miter);
shape1->stroke(tvg::StrokeCap::Butt); shape1->stroke(tvg::StrokeCap::Butt);

View file

@ -80,7 +80,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
star->lineTo(546, 143); star->lineTo(546, 143);
star->close(); star->close();
star->stroke(10); star->stroke(10);
star->stroke(255, 255, 255, 255); star->stroke(255, 255, 255);
//Mask3 //Mask3
auto mask3 = tvg::Shape::gen(); auto mask3 = tvg::Shape::gen();

View file

@ -80,7 +80,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
star->lineTo(546, 143); star->lineTo(546, 143);
star->close(); star->close();
star->stroke(10); star->stroke(10);
star->stroke(255, 255, 255, 255); star->stroke(255, 255, 255);
//Mask3 //Mask3
auto mask3 = tvg::Shape::gen(); auto mask3 = tvg::Shape::gen();

View file

@ -80,7 +80,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
star->lineTo(546, 143); star->lineTo(546, 143);
star->close(); star->close();
star->stroke(10); star->stroke(10);
star->stroke(255, 255, 255, 255); star->stroke(255, 255, 255);
//Mask3 //Mask3
auto mask3 = tvg::Shape::gen(); auto mask3 = tvg::Shape::gen();

View file

@ -81,7 +81,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
star->close(); star->close();
star->stroke(30); star->stroke(30);
star->stroke(tvg::StrokeJoin::Miter); star->stroke(tvg::StrokeJoin::Miter);
star->stroke(255, 255, 255, 255); star->stroke(255, 255, 255);
//Mask3 //Mask3
auto mask3 = tvg::Shape::gen(); auto mask3 = tvg::Shape::gen();

View file

@ -46,7 +46,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
shape2->appendRect(450, 100, 200, 200, 50, 50); shape2->appendRect(450, 100, 200, 200, 50, 50);
shape2->fill(0, 255, 0); shape2->fill(0, 255, 0);
shape2->stroke(10); shape2->stroke(10);
shape2->stroke(255, 255, 255, 255); shape2->stroke(255, 255, 255);
scene->push(std::move(shape2)); scene->push(std::move(shape2));
@ -76,7 +76,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
shape3->close(); shape3->close();
shape3->fill(0, 0, 255); shape3->fill(0, 0, 255);
shape3->stroke(10); shape3->stroke(10);
shape3->stroke(255, 255, 255, 255); shape3->stroke(255, 255, 255);
shape3->opacity(127); shape3->opacity(127);
scene2->push(std::move(shape3)); scene2->push(std::move(shape3));
@ -98,7 +98,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
shape4->close(); shape4->close();
shape4->fill(255, 0, 0); shape4->fill(255, 0, 0);
shape4->stroke(10); shape4->stroke(10);
shape4->stroke(0, 0, 255, 255); shape4->stroke(0, 0, 255);
shape4->opacity(200); shape4->opacity(200);
shape4->scale(3); shape4->scale(3);
scene2->push(std::move(shape4)); scene2->push(std::move(shape4));

View file

@ -68,7 +68,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
//Source //Source
auto shape = tvg::Shape::gen(); auto shape = tvg::Shape::gen();
shape->appendRect(100, 100, 400, 400, 50, 50); shape->appendRect(100, 100, 400, 400, 50, 50);
shape->stroke(0, 0, 255, 255); shape->stroke(0, 0, 255);
shape->stroke(10); shape->stroke(10);
shape->fill(255, 255, 255); shape->fill(255, 255, 255);
shape->composite(std::move(clipper), tvg::CompositeMethod::ClipPath); shape->composite(std::move(clipper), tvg::CompositeMethod::ClipPath);

View file

@ -41,7 +41,7 @@ void tvgUpdateCmds(tvg::Canvas* canvas, float progress)
shape1->appendRect(-235, -250, 400, 400, 50, 50); //x, y, w, h, rx, ry shape1->appendRect(-235, -250, 400, 400, 50, 50); //x, y, w, h, rx, ry
shape1->fill(0, 255, 0); //r, g, b shape1->fill(0, 255, 0); //r, g, b
shape1->stroke(5); //width shape1->stroke(5); //width
shape1->stroke(255, 255, 255, 255); //r, g, b, a shape1->stroke(255, 255, 255); //r, g, b
scene->push(std::move(shape1)); scene->push(std::move(shape1));
//Prepare Circle (Scene1) //Prepare Circle (Scene1)
@ -81,7 +81,7 @@ void tvgUpdateCmds(tvg::Canvas* canvas, float progress)
shape4->close(); shape4->close();
shape4->fill(0, 0, 255, 127); shape4->fill(0, 0, 255, 127);
shape4->stroke(3); //width shape4->stroke(3); //width
shape4->stroke(0, 0, 255, 255); //r, g, b, a shape4->stroke(0, 0, 255); //r, g, b
scene2->push(std::move(shape4)); scene2->push(std::move(shape4));
//Circle (Scene2) //Circle (Scene2)

View file

@ -64,14 +64,14 @@ void tvgDrawCmds(tvg::Canvas* canvas)
shape4->appendCircle(400, 400, 100, 100); shape4->appendCircle(400, 400, 100, 100);
shape4->fill(255, 0, 0); shape4->fill(255, 0, 0);
shape4->stroke(5); shape4->stroke(5);
shape4->stroke(255, 255, 255, 255); shape4->stroke(255, 255, 255);
scene->push(std::move(shape4)); scene->push(std::move(shape4));
auto shape5 = tvg::Shape::gen(); auto shape5 = tvg::Shape::gen();
shape5->appendCircle(550, 550, 150, 150); shape5->appendCircle(550, 550, 150, 150);
shape5->fill(255, 0, 255); shape5->fill(255, 0, 255);
shape5->stroke(5); shape5->stroke(5);
shape5->stroke(255, 255, 255, 255); shape5->stroke(255, 255, 255);
scene->push(std::move(shape5)); scene->push(std::move(shape5));
if (canvas->push(std::move(scene)) != tvg::Result::Success) return; if (canvas->push(std::move(scene)) != tvg::Result::Success) return;

View file

@ -34,7 +34,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
auto shape1 = tvg::Shape::gen(); auto shape1 = tvg::Shape::gen();
shape1->appendRect(50, 50, 200, 200, 0, 0); shape1->appendRect(50, 50, 200, 200, 0, 0);
shape1->fill(50, 50, 50); shape1->fill(50, 50, 50);
shape1->stroke(255, 255, 255, 255); //color: r, g, b, a shape1->stroke(255, 255, 255); //color: r, g, b
shape1->stroke(tvg::StrokeJoin::Bevel); //default is Bevel shape1->stroke(tvg::StrokeJoin::Bevel); //default is Bevel
shape1->stroke(10); //width: 10px shape1->stroke(10); //width: 10px
@ -44,7 +44,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
auto shape2 = tvg::Shape::gen(); auto shape2 = tvg::Shape::gen();
shape2->appendRect(300, 50, 200, 200, 0, 0); shape2->appendRect(300, 50, 200, 200, 0, 0);
shape2->fill(50, 50, 50); shape2->fill(50, 50, 50);
shape2->stroke(255, 255, 255, 255); shape2->stroke(255, 255, 255);
shape2->stroke(tvg::StrokeJoin::Round); shape2->stroke(tvg::StrokeJoin::Round);
shape2->stroke(10); shape2->stroke(10);
@ -54,7 +54,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
auto shape3 = tvg::Shape::gen(); auto shape3 = tvg::Shape::gen();
shape3->appendRect(550, 50, 200, 200, 0, 0); shape3->appendRect(550, 50, 200, 200, 0, 0);
shape3->fill(50, 50, 50); shape3->fill(50, 50, 50);
shape3->stroke(255, 255, 255, 255); shape3->stroke(255, 255, 255);
shape3->stroke(tvg::StrokeJoin::Miter); shape3->stroke(tvg::StrokeJoin::Miter);
shape3->stroke(10); shape3->stroke(10);
@ -64,7 +64,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
auto shape4 = tvg::Shape::gen(); auto shape4 = tvg::Shape::gen();
shape4->appendCircle(150, 400, 100, 100); shape4->appendCircle(150, 400, 100, 100);
shape4->fill(50, 50, 50); shape4->fill(50, 50, 50);
shape4->stroke(255, 255, 255, 255); shape4->stroke(255, 255, 255);
shape4->stroke(1); shape4->stroke(1);
if (canvas->push(std::move(shape4)) != tvg::Result::Success) return; if (canvas->push(std::move(shape4)) != tvg::Result::Success) return;
@ -73,7 +73,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
auto shape5 = tvg::Shape::gen(); auto shape5 = tvg::Shape::gen();
shape5->appendCircle(400, 400, 100, 100); shape5->appendCircle(400, 400, 100, 100);
shape5->fill(50, 50, 50); shape5->fill(50, 50, 50);
shape5->stroke(255, 255, 255, 255); shape5->stroke(255, 255, 255);
shape5->stroke(2); shape5->stroke(2);
if (canvas->push(std::move(shape5)) != tvg::Result::Success) return; if (canvas->push(std::move(shape5)) != tvg::Result::Success) return;
@ -82,7 +82,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
auto shape6 = tvg::Shape::gen(); auto shape6 = tvg::Shape::gen();
shape6->appendCircle(650, 400, 100, 100); shape6->appendCircle(650, 400, 100, 100);
shape6->fill(50, 50, 50); shape6->fill(50, 50, 50);
shape6->stroke(255, 255, 255, 255); shape6->stroke(255, 255, 255);
shape6->stroke(4); shape6->stroke(4);
if (canvas->push(std::move(shape6)) != tvg::Result::Success) return; if (canvas->push(std::move(shape6)) != tvg::Result::Success) return;
@ -92,7 +92,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
auto hline = tvg::Shape::gen(); auto hline = tvg::Shape::gen();
hline->moveTo(50, 550 + (25 * i)); hline->moveTo(50, 550 + (25 * i));
hline->lineTo(300, 550 + (25 * i)); hline->lineTo(300, 550 + (25 * i));
hline->stroke(255, 255, 255, 255); //color: r, g, b, a hline->stroke(255, 255, 255); //color: r, g, b
hline->stroke(i + 1); //stroke width hline->stroke(i + 1); //stroke width
hline->stroke(tvg::StrokeCap::Round); //default is Square hline->stroke(tvg::StrokeCap::Round); //default is Square
if (canvas->push(std::move(hline)) != tvg::Result::Success) return; if (canvas->push(std::move(hline)) != tvg::Result::Success) return;
@ -100,7 +100,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
auto vline = tvg::Shape::gen(); auto vline = tvg::Shape::gen();
vline->moveTo(500 + (25 * i), 550); vline->moveTo(500 + (25 * i), 550);
vline->lineTo(500 + (25 * i), 780); vline->lineTo(500 + (25 * i), 780);
vline->stroke(255, 255, 255, 255); //color: r, g, b, a vline->stroke(255, 255, 255); //color: r, g, b
vline->stroke(i + 1); //stroke width vline->stroke(i + 1); //stroke width
vline->stroke(tvg::StrokeCap::Round); //default is Square vline->stroke(tvg::StrokeCap::Round); //default is Square
if (canvas->push(std::move(vline)) != tvg::Result::Success) return; if (canvas->push(std::move(vline)) != tvg::Result::Success) return;
@ -110,7 +110,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
auto line1 = tvg::Shape::gen(); auto line1 = tvg::Shape::gen();
line1->moveTo(360, 580); line1->moveTo(360, 580);
line1->lineTo(450, 580); line1->lineTo(450, 580);
line1->stroke(255, 255, 255, 255); //color: r, g, b, a line1->stroke(255, 255, 255); //color: r, g, b
line1->stroke(15); line1->stroke(15);
line1->stroke(tvg::StrokeCap::Round); line1->stroke(tvg::StrokeCap::Round);

View file

@ -37,7 +37,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
shape1->lineTo(220, 200); shape1->lineTo(220, 200);
shape1->lineTo( 70, 170); shape1->lineTo( 70, 170);
shape1->lineTo( 70, 30); shape1->lineTo( 70, 30);
shape1->stroke(255, 0, 0, 255); shape1->stroke(255, 0, 0);
shape1->stroke(10); shape1->stroke(10);
shape1->stroke(tvg::StrokeJoin::Round); shape1->stroke(tvg::StrokeJoin::Round);
shape1->stroke(tvg::StrokeCap::Round); shape1->stroke(tvg::StrokeCap::Round);
@ -49,7 +49,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
shape2->lineTo(470, 200); shape2->lineTo(470, 200);
shape2->lineTo(320, 170); shape2->lineTo(320, 170);
shape2->lineTo(320, 30); shape2->lineTo(320, 30);
shape2->stroke(255, 255, 0, 255); shape2->stroke(255, 255, 0);
shape2->stroke(10); shape2->stroke(10);
shape2->stroke(tvg::StrokeJoin::Bevel); shape2->stroke(tvg::StrokeJoin::Bevel);
shape2->stroke(tvg::StrokeCap::Square); shape2->stroke(tvg::StrokeCap::Square);
@ -61,7 +61,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
shape3->lineTo(720, 200); shape3->lineTo(720, 200);
shape3->lineTo(570, 170); shape3->lineTo(570, 170);
shape3->lineTo(570, 30); shape3->lineTo(570, 30);
shape3->stroke(0, 255, 0, 255); shape3->stroke(0, 255, 0);
shape3->stroke(10); shape3->stroke(10);
shape3->stroke(tvg::StrokeJoin::Miter); shape3->stroke(tvg::StrokeJoin::Miter);
shape3->stroke(tvg::StrokeCap::Butt); shape3->stroke(tvg::StrokeCap::Butt);
@ -74,7 +74,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
shape4->lineTo(220, 380); shape4->lineTo(220, 380);
shape4->lineTo( 70, 330); shape4->lineTo( 70, 330);
shape4->lineTo( 70, 210); shape4->lineTo( 70, 210);
shape4->stroke(255, 0, 0, 255); shape4->stroke(255, 0, 0);
shape4->stroke(5); shape4->stroke(5);
shape4->stroke(tvg::StrokeJoin::Round); shape4->stroke(tvg::StrokeJoin::Round);
shape4->stroke(tvg::StrokeCap::Round); shape4->stroke(tvg::StrokeCap::Round);
@ -89,7 +89,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
shape5->lineTo(470, 380); shape5->lineTo(470, 380);
shape5->lineTo(320, 330); shape5->lineTo(320, 330);
shape5->lineTo(320, 210); shape5->lineTo(320, 210);
shape5->stroke(255, 255, 0, 255); shape5->stroke(255, 255, 0);
shape5->stroke(5); shape5->stroke(5);
shape5->stroke(tvg::StrokeJoin::Bevel); shape5->stroke(tvg::StrokeJoin::Bevel);
shape5->stroke(tvg::StrokeCap::Square); shape5->stroke(tvg::StrokeCap::Square);
@ -104,7 +104,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
shape6->lineTo(720, 380); shape6->lineTo(720, 380);
shape6->lineTo(570, 330); shape6->lineTo(570, 330);
shape6->lineTo(570, 210); shape6->lineTo(570, 210);
shape6->stroke(0, 255, 0, 255); shape6->stroke(0, 255, 0);
shape6->stroke(5); shape6->stroke(5);
shape6->stroke(tvg::StrokeJoin::Miter); shape6->stroke(tvg::StrokeJoin::Miter);
shape6->stroke(tvg::StrokeCap::Butt); shape6->stroke(tvg::StrokeCap::Butt);
@ -116,7 +116,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
//For a comparison with shapes 10-12 //For a comparison with shapes 10-12
auto shape7 = tvg::Shape::gen(); auto shape7 = tvg::Shape::gen();
shape7->appendArc(70, 400, 160, 10, 70, true); shape7->appendArc(70, 400, 160, 10, 70, true);
shape7->stroke(255, 0, 0, 255); shape7->stroke(255, 0, 0);
shape7->stroke(7); shape7->stroke(7);
shape7->stroke(tvg::StrokeJoin::Round); shape7->stroke(tvg::StrokeJoin::Round);
shape7->stroke(tvg::StrokeCap::Round); shape7->stroke(tvg::StrokeCap::Round);
@ -124,7 +124,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
auto shape8 = tvg::Shape::gen(); auto shape8 = tvg::Shape::gen();
shape8->appendArc(320, 400, 160, 10, 70, false); shape8->appendArc(320, 400, 160, 10, 70, false);
shape8->stroke(255, 255, 0, 255); shape8->stroke(255, 255, 0);
shape8->stroke(7); shape8->stroke(7);
shape8->stroke(tvg::StrokeJoin::Bevel); shape8->stroke(tvg::StrokeJoin::Bevel);
shape8->stroke(tvg::StrokeCap::Square); shape8->stroke(tvg::StrokeCap::Square);
@ -132,7 +132,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
auto shape9 = tvg::Shape::gen(); auto shape9 = tvg::Shape::gen();
shape9->appendArc(570, 400, 160, 10, 70, true); shape9->appendArc(570, 400, 160, 10, 70, true);
shape9->stroke(0, 255, 0, 255); shape9->stroke(0, 255, 0);
shape9->stroke(7); shape9->stroke(7);
shape9->stroke(tvg::StrokeJoin::Miter); shape9->stroke(tvg::StrokeJoin::Miter);
shape9->stroke(tvg::StrokeCap::Butt); shape9->stroke(tvg::StrokeCap::Butt);
@ -143,7 +143,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
shape10->appendArc(70, 600, 160, 10, 30, true); shape10->appendArc(70, 600, 160, 10, 30, true);
shape10->appendCircle(70, 700, 20, 60); shape10->appendCircle(70, 700, 20, 60);
shape10->appendRect(130, 710, 100, 40, 0, 0); shape10->appendRect(130, 710, 100, 40, 0, 0);
shape10->stroke(255, 0, 0, 255); shape10->stroke(255, 0, 0);
shape10->stroke(5); shape10->stroke(5);
shape10->stroke(tvg::StrokeJoin::Round); shape10->stroke(tvg::StrokeJoin::Round);
shape10->stroke(tvg::StrokeCap::Round); shape10->stroke(tvg::StrokeCap::Round);
@ -154,7 +154,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
shape11->appendArc(320, 600, 160, 10, 30, false); shape11->appendArc(320, 600, 160, 10, 30, false);
shape11->appendCircle(320, 700, 20, 60); shape11->appendCircle(320, 700, 20, 60);
shape11->appendRect(380, 710, 100, 40, 0, 0); shape11->appendRect(380, 710, 100, 40, 0, 0);
shape11->stroke(255, 255, 0, 255); shape11->stroke(255, 255, 0);
shape11->stroke(5); shape11->stroke(5);
shape11->stroke(tvg::StrokeJoin::Bevel); shape11->stroke(tvg::StrokeJoin::Bevel);
shape11->stroke(tvg::StrokeCap::Square); shape11->stroke(tvg::StrokeCap::Square);
@ -165,7 +165,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
shape12->appendArc(570, 600, 160, 10, 30, true); shape12->appendArc(570, 600, 160, 10, 30, true);
shape12->appendCircle(570, 700, 20, 60); shape12->appendCircle(570, 700, 20, 60);
shape12->appendRect(630, 710, 100, 40, 0, 0); shape12->appendRect(630, 710, 100, 40, 0, 0);
shape12->stroke(0, 255, 0, 255); shape12->stroke(0, 255, 0);
shape12->stroke(5); shape12->stroke(5);
shape12->stroke(tvg::StrokeJoin::Miter); shape12->stroke(tvg::StrokeJoin::Miter);
shape12->stroke(tvg::StrokeCap::Butt); shape12->stroke(tvg::StrokeCap::Butt);

View file

@ -741,7 +741,7 @@ static unique_ptr<Scene> _sceneBuildHelper(const SvgNode* node, const Box& vBox,
uint8_t r, g, b; uint8_t r, g, b;
shape->fillColor(&r, &g, &b); shape->fillColor(&r, &g, &b);
if (shape->fill() || r < 255 || g < 255 || b < 255 || shape->strokeFill() || if (shape->fill() || r < 255 || g < 255 || b < 255 || shape->strokeFill() ||
(shape->strokeColor(&r, &g, &b, nullptr) == Result::Success && (r < 255 || g < 255 || b < 255))) { (shape->strokeColor(&r, &g, &b) == Result::Success && (r < 255 || g < 255 || b < 255))) {
*isMaskWhite = false; *isMaskWhite = false;
} }
} }