mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-15 04:24:28 +00:00
examples pictures: updated for case cover.
+ test opacity
This commit is contained in:
parent
c9377708a9
commit
5690f1ab0d
2 changed files with 6 additions and 0 deletions
|
@ -31,6 +31,8 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
{
|
{
|
||||||
if (!canvas) return;
|
if (!canvas) return;
|
||||||
|
|
||||||
|
auto opacity = 51;
|
||||||
|
|
||||||
//Load jpg file from path
|
//Load jpg file from path
|
||||||
for (int i = 0; i < 5; ++i) {
|
for (int i = 0; i < 5; ++i) {
|
||||||
auto picture = tvg::Picture::gen();
|
auto picture = tvg::Picture::gen();
|
||||||
|
@ -41,6 +43,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
picture->translate(i* 150, i * 150);
|
picture->translate(i* 150, i * 150);
|
||||||
picture->rotate(30 * i);
|
picture->rotate(30 * i);
|
||||||
picture->size(200, 200);
|
picture->size(200, 200);
|
||||||
|
picture->opacity(opacity + opacity * i);
|
||||||
if (canvas->push(move(picture)) != tvg::Result::Success) return;
|
if (canvas->push(move(picture)) != tvg::Result::Success) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,8 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
if (!canvas) return;
|
if (!canvas) return;
|
||||||
|
|
||||||
//Load png file from path
|
//Load png file from path
|
||||||
|
auto opacity = 51;
|
||||||
|
|
||||||
for (int i = 0; i < 5; ++i) {
|
for (int i = 0; i < 5; ++i) {
|
||||||
auto picture = tvg::Picture::gen();
|
auto picture = tvg::Picture::gen();
|
||||||
if (picture->load(EXAMPLE_DIR"/test.png") != tvg::Result::Success) {
|
if (picture->load(EXAMPLE_DIR"/test.png") != tvg::Result::Success) {
|
||||||
|
@ -41,6 +43,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
picture->translate(i* 150, i * 150);
|
picture->translate(i* 150, i * 150);
|
||||||
picture->rotate(30 * i);
|
picture->rotate(30 * i);
|
||||||
picture->size(200, 200);
|
picture->size(200, 200);
|
||||||
|
picture->opacity(opacity + opacity * i);
|
||||||
if (canvas->push(move(picture)) != tvg::Result::Success) return;
|
if (canvas->push(move(picture)) != tvg::Result::Success) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue