From 0cb903c711e9184eedd8a2af9879d3e2c95a9d9e Mon Sep 17 00:00:00 2001 From: Hermet Park Date: Thu, 24 Jul 2025 15:22:05 +0900 Subject: [PATCH] example: updated BoundingBox take cover the stroke + matrix use-case. --- examples/BoundingBox.cpp | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/examples/BoundingBox.cpp b/examples/BoundingBox.cpp index 105a214e..98aa94d3 100644 --- a/examples/BoundingBox.cpp +++ b/examples/BoundingBox.cpp @@ -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);