examples: ClipPath's modified 10/289810/1
authorMira Grudzinska <veleveta@gmail.com>
Sun, 15 Jan 2023 15:39:25 +0000 (16:39 +0100)
committerMichal Szczecinski <mihashco89@gmail.com>
Tue, 14 Mar 2023 09:47:48 +0000 (10:47 +0100)
The opacity/alpha value doesn't need to be set
for clips any more.

Change-Id: Ia2ea6f99f1d9c666348e3ef1cfb57629972296c9

src/examples/ClipPath.cpp

index 067e7130b0249efb0005625fce0f6b00939bb930..ca8435652905860193a54ca2eff50d9036ddb810 100644 (file)
@@ -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);