mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 13:43:43 +00:00
examples: revise picture sample code.
This commit is contained in:
parent
ac3e848cfe
commit
6cc7dfdc56
5 changed files with 32 additions and 8 deletions
|
@ -1,4 +1,27 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2020-2021 Samsung Electronics Co., Ltd. All rights reserved.
|
||||||
|
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
/* Drawing Commands */
|
/* Drawing Commands */
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
@ -7,12 +30,13 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
{
|
{
|
||||||
if (!canvas) return;
|
if (!canvas) return;
|
||||||
|
|
||||||
for (int i = 0; i < 40; ++i) {
|
for (int i = 0; i < 5; ++i) {
|
||||||
auto png = tvg::Picture::gen();
|
auto picture = tvg::Picture::gen();
|
||||||
if (png->load(EXAMPLE_DIR"/samsung.png") != tvg::Result::Success) return;
|
if (picture->load(EXAMPLE_DIR"/logo.png") != tvg::Result::Success) return;
|
||||||
png->translate(i* 5, i * 10);
|
picture->translate(i* 150, i * 150);
|
||||||
png->rotate(10 * i);
|
picture->rotate(30 * i);
|
||||||
if (canvas->push(move(png)) != tvg::Result::Success) return;
|
picture->scale(0.25);
|
||||||
|
if (canvas->push(move(picture)) != tvg::Result::Success) return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
BIN
src/examples/images/logo.png
Normal file
BIN
src/examples/images/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
Binary file not shown.
Before Width: | Height: | Size: 38 KiB |
|
@ -13,13 +13,13 @@ source_file = [
|
||||||
'GradientStroke.cpp',
|
'GradientStroke.cpp',
|
||||||
'GradientTransform.cpp',
|
'GradientTransform.cpp',
|
||||||
'LinearGradient.cpp',
|
'LinearGradient.cpp',
|
||||||
'LoadPng.cpp',
|
|
||||||
'MultiCanvas.cpp',
|
'MultiCanvas.cpp',
|
||||||
'MultiShapes.cpp',
|
'MultiShapes.cpp',
|
||||||
'Opacity.cpp',
|
'Opacity.cpp',
|
||||||
'PathCopy.cpp',
|
'PathCopy.cpp',
|
||||||
'Path.cpp',
|
'Path.cpp',
|
||||||
'PixelImage.cpp',
|
'PicturePng.cpp',
|
||||||
|
'PictureRaw.cpp',
|
||||||
'RadialGradient.cpp',
|
'RadialGradient.cpp',
|
||||||
'Scene.cpp',
|
'Scene.cpp',
|
||||||
'SceneTransform.cpp',
|
'SceneTransform.cpp',
|
||||||
|
|
Loading…
Add table
Reference in a new issue