example: updated with a stroknig clipper

This commit is contained in:
Hermet Park 2024-12-19 14:32:40 +09:00 committed by Hermet Park
parent 324bff30d1
commit 0437d482bd

View file

@ -53,7 +53,7 @@ struct UserExample : tvgexam::Example
shape->fill(255, 255, 255);
canvas->push(shape);
//////////////////////////////////////////////
{
auto scene = tvg::Scene::gen();
auto star1 = tvg::Shape::gen();
@ -94,8 +94,9 @@ struct UserExample : tvgexam::Example
scene->clip(clip);
canvas->push(scene);
}
//////////////////////////////////////////////
{
auto star3 = tvg::Shape::gen();
compose(star3);
@ -121,8 +122,9 @@ struct UserExample : tvgexam::Example
star3->clip(clipRect);
canvas->push(star3);
}
//////////////////////////////////////////////
{
auto picture = tvg::Picture::gen();
if (!tvgexam::verify(picture->load(EXAMPLE_DIR"/svg/cartman.svg"))) return false;
@ -139,20 +141,23 @@ struct UserExample : tvgexam::Example
picture->clip(clipPath);
canvas->push(picture);
}
//////////////////////////////////////////////
{
auto shape1 = tvg::Shape::gen();
shape1->appendRect(500, 420, 100, 100, 20, 20);
shape1->appendRect(500, 420, 250, 250, 20, 20);
shape1->fill(255, 0, 255, 160);
// color/alpha/opacity are ignored for a clip object - no need to set them
auto clipShape = tvg::Shape::gen();
clipShape->appendRect(600, 420, 100, 100);
clipShape->appendCircle(600, 550, 150, 150);
clipShape->strokeWidth(20);
//Clipping shape1 to clipShape
shape1->clip(clipShape);
canvas->push(shape1);
}
return true;
}