mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 13:43:43 +00:00
examples: ClipPath's modified
The opacity/alpha value doesn't need to be set for clips any more.
This commit is contained in:
parent
0de3872be3
commit
b701bfc91c
1 changed files with 5 additions and 5 deletions
|
@ -63,9 +63,9 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
|||
//Move Star1
|
||||
star1->translate(-10, -10);
|
||||
|
||||
// color/alpha/opacity are ignored for a clip object - no need to set them
|
||||
auto clipStar = tvg::Shape::gen();
|
||||
clipStar->appendCircle(200, 230, 110, 110);
|
||||
clipStar->fill(255, 255, 255, 255); // clip object must have alpha.
|
||||
clipStar->translate(10, 10);
|
||||
|
||||
star1->composite(move(clipStar), tvg::CompositeMethod::ClipPath);
|
||||
|
@ -80,9 +80,9 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
|||
//Move Star2
|
||||
star2->translate(10, 40);
|
||||
|
||||
// color/alpha/opacity are ignored for a clip object - no need to set them
|
||||
auto clip = tvg::Shape::gen();
|
||||
clip->appendCircle(200, 230, 130, 130);
|
||||
clip->fill(255, 255, 255, 255); // clip object must have alpha.
|
||||
clip->translate(10, 10);
|
||||
|
||||
scene->push(move(star1));
|
||||
|
@ -110,9 +110,9 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
|||
star3->stroke(10);
|
||||
star3->translate(400, 0);
|
||||
|
||||
// color/alpha/opacity are ignored for a clip object - no need to set them
|
||||
auto clipRect = tvg::Shape::gen();
|
||||
clipRect->appendRect(500, 120, 200, 200, 0, 0); //x, y, w, h, rx, ry
|
||||
clipRect->fill(255, 255, 255, 255); // clip object must have alpha.
|
||||
clipRect->translate(20, 20);
|
||||
|
||||
//Clipping scene to rect(shape)
|
||||
|
@ -127,10 +127,10 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
|||
picture->scale(3);
|
||||
picture->translate(50, 400);
|
||||
|
||||
// color/alpha/opacity are ignored for a clip object - no need to set them
|
||||
auto clipPath = tvg::Shape::gen();
|
||||
clipPath->appendCircle(200, 510, 50, 50); //x, y, w, h, rx, ry
|
||||
clipPath->appendCircle(200, 650, 50, 50); //x, y, w, h, rx, ry
|
||||
clipPath->fill(255, 255, 255, 255); // clip object must have alpha.
|
||||
clipPath->translate(20, 20);
|
||||
|
||||
//Clipping picture to path
|
||||
|
@ -143,9 +143,9 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
|||
shape1->appendRect(500, 420, 100, 100, 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, 0, 0);
|
||||
clipShape->fill(255, 0, 255, 150);
|
||||
|
||||
//Clipping shape1 to clipShape
|
||||
shape1->composite(move(clipShape), tvg::CompositeMethod::ClipPath);
|
||||
|
|
Loading…
Add table
Reference in a new issue