mirror of
https://github.com/thorvg/thorvg.git
synced 2025-07-24 23:28:57 +00:00
example: updated with a stroknig clipper
This commit is contained in:
parent
324bff30d1
commit
0437d482bd
1 changed files with 80 additions and 75 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue