mirror of
https://github.com/thorvg/thorvg.git
synced 2025-07-26 08:09:14 +00:00
example: updated BoundingBox
take cover the stroke + matrix use-case.
This commit is contained in:
parent
3d8f492180
commit
0cb903c711
1 changed files with 16 additions and 6 deletions
|
@ -100,10 +100,15 @@ struct UserExample : tvgexam::Example
|
|||
|
||||
{
|
||||
auto shape = tvg::Shape::gen();
|
||||
shape->appendRect(450, -100, 150, 100, 40, 50);
|
||||
shape->appendCircle(450, 50, 100, 50);
|
||||
shape->appendRect(225, -50, 75, 50, 20, 25);
|
||||
shape->appendCircle(225, 25, 50, 25);
|
||||
shape->strokeWidth(10);
|
||||
shape->strokeFill(255, 255, 255);
|
||||
shape->fill(50, 50, 155);
|
||||
shape->rotate(20.0f);
|
||||
|
||||
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);
|
||||
bbox(canvas, shape);
|
||||
}
|
||||
|
@ -249,11 +254,16 @@ struct UserExample : tvgexam::Example
|
|||
|
||||
auto shape = tvg::Shape::gen();
|
||||
shape->moveTo(0, 0);
|
||||
shape->lineTo(300, 200);
|
||||
shape->lineTo(0, 200);
|
||||
shape->lineTo(150, 100);
|
||||
shape->lineTo(0, 100);
|
||||
shape->fill(255, 0, 255);
|
||||
shape->strokeWidth(30);
|
||||
shape->strokeFill(0, 255, 255);
|
||||
shape->close();
|
||||
shape->rotate(20);
|
||||
|
||||
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);
|
||||
|
||||
canvas->push(scene);
|
||||
|
|
Loading…
Add table
Reference in a new issue