Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Accessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ struct UserExample : tvgexam::Example
shape->strokeWidth(5);
}

canvas->push(picture);
canvas->add(picture);

return true;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Animation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ struct UserExample : tvgexam::Example
shape->appendRect(0, 0, w, h);
shape->fill(50, 50, 50);

canvas->push(shape);
canvas->add(shape);

if (!tvgexam::verify(picture->load(EXAMPLE_DIR"/lottie/sample.json"))) return false;

Expand All @@ -56,7 +56,7 @@ struct UserExample : tvgexam::Example
picture->scale(scale);
picture->translate(float(w) * 0.5f, float(h) * 0.5f);

canvas->push(picture);
canvas->add(picture);

return true;
}
Expand Down
26 changes: 13 additions & 13 deletions src/Blending.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,34 +36,34 @@ struct UserExample : tvgexam::Example
text->text(name);
text->fill(255, 255, 255);
text->translate(x + 20, y);
canvas->push(text);
canvas->add(text);

//solid
{
auto bottom = tvg::Shape::gen();
bottom->appendRect(20.0f + x, 25.0f + y, 100.0f, 100.0f, 10.0f, 10.0f);
bottom->fill(255, 255, 0);
canvas->push(bottom);
canvas->add(bottom);

auto top = tvg::Shape::gen();
top->appendRect(45.0f + x, 50.0f + y, 100.0f, 100.0f, 10.0f, 10.0f);
top->fill(0, 255, 255);
top->blend(method);
canvas->push(top);
canvas->add(top);
}

//solid (half transparent)
{
auto bottom = tvg::Shape::gen();
bottom->appendRect(170.0f + x, 25.0f + y, 100.0f, 100.0f, 10.0f, 10.0f);
bottom->fill(255, 255, 0, 127);
canvas->push(bottom);
canvas->add(bottom);

auto top = tvg::Shape::gen();
top->appendRect(195.0f + x, 50.0f + y, 100.0f, 100.0f, 10.0f, 10.0f);
top->fill(0, 255, 255, 127);
top->blend(method);
canvas->push(top);
canvas->add(top);
}

//gradient blending
Expand All @@ -79,7 +79,7 @@ struct UserExample : tvgexam::Example
auto bottom = tvg::Shape::gen();
bottom->appendRect(325.0f + x, 25.0f + y, 100.0f, 100.0f, 10.0f, 10.0f);
bottom->fill(fill);
canvas->push(bottom);
canvas->add(bottom);

auto fill2 = tvg::LinearGradient::gen();
fill2->linear(350.0f + x, 50.0f + y, 450.0f + x, 150.0f + y);
Expand All @@ -89,7 +89,7 @@ struct UserExample : tvgexam::Example
top->appendRect(350.0f + x, 50.0f + y, 100.0f, 100.0f, 10.0f, 10.0f);
top->fill(fill2);
top->blend(method);
canvas->push(top);
canvas->add(top);
}

//image
Expand All @@ -98,13 +98,13 @@ struct UserExample : tvgexam::Example
bottom->load(data, 200, 300, tvg::ColorSpace::ARGB8888, true);
bottom->translate(475 + x, 25.0f + y);
bottom->scale(0.35f);
canvas->push(bottom);
canvas->add(bottom);

auto top = bottom->duplicate();
top->translate(500.0f + x, 50.0f + y);
top->rotate(-10.0f);
top->blend(method);
canvas->push(top);
canvas->add(top);
}

//scene
Expand All @@ -113,12 +113,12 @@ struct UserExample : tvgexam::Example
bottom->load(EXAMPLE_DIR"/svg/tiger.svg");
bottom->translate(600.0f + x, 25.0f + y);
bottom->scale(0.11f);
canvas->push(bottom);
canvas->add(bottom);

auto top = bottom->duplicate();
top->translate(625.0f + x, 50.0f + y);
top->blend(method);
canvas->push(top);
canvas->add(top);
}

//scene (half transparent)
Expand All @@ -128,12 +128,12 @@ struct UserExample : tvgexam::Example
bottom->translate(750.0f + x, 25.0f + y);
bottom->scale(0.11f);
bottom->opacity(127);
canvas->push(bottom);
canvas->add(bottom);

auto top = bottom->duplicate();
top->translate(775.0f + x, 50.0f + y);
top->blend(method);
canvas->push(top);
canvas->add(top);
}
}

Expand Down
50 changes: 25 additions & 25 deletions src/BoundingBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ struct UserExample : tvgexam::Example
bound->strokeWidth(2.0f);
bound->strokeFill(255, 0, 0, 255);

canvas->push(bound);
canvas->add(bound);
}

//obb
Expand All @@ -66,7 +66,7 @@ struct UserExample : tvgexam::Example
bound->strokeDash(dash, 2);
bound->strokeFill(255, 255, 255, 255);

canvas->push(bound);
canvas->add(bound);
}
}

Expand All @@ -76,7 +76,7 @@ struct UserExample : tvgexam::Example
auto shape = tvg::Shape::gen();
shape->appendCircle(50, 100, 40, 100);
shape->fill(0, 30, 255);
canvas->push(shape);
canvas->add(shape);
bbox(canvas, shape);
}

Expand All @@ -89,7 +89,7 @@ struct UserExample : tvgexam::Example
text->fill(255, 255, 0);
text->translate(100, 20);
text->rotate(16.0f);
canvas->push(text);
canvas->add(text);
bbox(canvas, text);
}

Expand All @@ -98,7 +98,7 @@ struct UserExample : tvgexam::Example
shape->appendRect(200, 30, 100, 20);
shape->fill(200, 150, 55);
shape->rotate(30);
canvas->push(shape);
canvas->add(shape);
bbox(canvas, shape);
}

Expand All @@ -113,7 +113,7 @@ struct UserExample : tvgexam::Example
tvg::Matrix m = {1.732f, -1.0f, 30.0f, 1.0f, 1.732f, -70.0f, 0.0f, 0.0f, 1.0f};
shape->transform(m);

canvas->push(shape);
canvas->add(shape);
bbox(canvas, shape);
}

Expand All @@ -122,7 +122,7 @@ struct UserExample : tvgexam::Example
svg->load(EXAMPLE_DIR"/svg/tiger.svg");
svg->scale(0.3f);
svg->translate(620, 50);
canvas->push(svg);
canvas->add(svg);
bbox(canvas, svg);
}

Expand All @@ -132,7 +132,7 @@ struct UserExample : tvgexam::Example
svg->scale(0.2f);
svg->translate(140, 215);
svg->rotate(45);
canvas->push(svg);
canvas->add(svg);
bbox(canvas, svg);

}
Expand All @@ -144,9 +144,9 @@ struct UserExample : tvgexam::Example

auto img = tvg::Picture::gen();
img->load(EXAMPLE_DIR"/image/test.png");
scene->push(img);
scene->add(img);

canvas->push(scene);
canvas->add(scene);
bbox(canvas, scene);
}

Expand All @@ -158,9 +158,9 @@ struct UserExample : tvgexam::Example

auto img = tvg::Picture::gen();
img->load(EXAMPLE_DIR"/image/test.jpg");
scene->push(img);
scene->add(img);

canvas->push(scene);
canvas->add(scene);
bbox(canvas, scene);
}

Expand All @@ -170,7 +170,7 @@ struct UserExample : tvgexam::Example
line->lineTo(770, 350);
line->strokeWidth(20);
line->strokeFill(55, 55, 0);
canvas->push(line);
canvas->add(line);
bbox(canvas, line);
}

Expand All @@ -181,7 +181,7 @@ struct UserExample : tvgexam::Example
curve->translate(50, 770);
curve->strokeWidth(2.0f);
curve->strokeFill(255, 255, 255);
canvas->push(curve);
canvas->add(curve);
bbox(canvas, curve);
}

Expand All @@ -193,7 +193,7 @@ struct UserExample : tvgexam::Example
curve->rotate(20.0f);
curve->strokeWidth(2.0f);
curve->strokeFill(255, 0, 255);
canvas->push(curve);
canvas->add(curve);
bbox(canvas, curve);
}

Expand All @@ -209,9 +209,9 @@ struct UserExample : tvgexam::Example
shape->fill(255, 0, 0);
shape->close();
shape->rotate(20);
scene->push(shape);
scene->add(shape);

canvas->push(scene);
canvas->add(scene);
bbox(canvas, scene);
}

Expand All @@ -231,9 +231,9 @@ struct UserExample : tvgexam::Example
shape->strokeFill(255, 255, 255);
shape->strokeJoin(tvg::StrokeJoin::Bevel);

scene->push(shape);
scene->add(shape);

canvas->push(scene);
canvas->add(scene);
bbox(canvas, scene);
}

Expand All @@ -253,9 +253,9 @@ struct UserExample : tvgexam::Example
shape->strokeWidth(20);
shape->strokeFill(0, 0, 255);

scene->push(shape);
scene->add(shape);

canvas->push(scene);
canvas->add(scene);
bbox(canvas, scene);
}

Expand All @@ -278,9 +278,9 @@ struct UserExample : tvgexam::Example
tvg::Matrix m = {1.8794f, -0.6840f, 0.0f, 0.6840f, 1.8794f, 0.0f, 0.0f, 0.0f, 1.0f};
shape->transform(m);

scene->push(shape);
scene->add(shape);

canvas->push(scene);
canvas->add(scene);
bbox(canvas, scene);
}

Expand All @@ -296,9 +296,9 @@ struct UserExample : tvgexam::Example
text->fill(255, 255, 0);
text->translate(0, 0);
text->rotate(16.0f);
scene->push(text);
scene->add(text);

canvas->push(scene);
canvas->add(scene);
bbox(canvas, scene);
}

Expand Down
Loading