mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 05:33:36 +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"
|
||||
|
||||
/************************************************************************/
|
||||
/* Drawing Commands */
|
||||
/************************************************************************/
|
||||
|
@ -7,12 +30,13 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
|||
{
|
||||
if (!canvas) return;
|
||||
|
||||
for (int i = 0; i < 40; ++i) {
|
||||
auto png = tvg::Picture::gen();
|
||||
if (png->load(EXAMPLE_DIR"/samsung.png") != tvg::Result::Success) return;
|
||||
png->translate(i* 5, i * 10);
|
||||
png->rotate(10 * i);
|
||||
if (canvas->push(move(png)) != tvg::Result::Success) return;
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
auto picture = tvg::Picture::gen();
|
||||
if (picture->load(EXAMPLE_DIR"/logo.png") != tvg::Result::Success) return;
|
||||
picture->translate(i* 150, i * 150);
|
||||
picture->rotate(30 * i);
|
||||
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',
|
||||
'GradientTransform.cpp',
|
||||
'LinearGradient.cpp',
|
||||
'LoadPng.cpp',
|
||||
'MultiCanvas.cpp',
|
||||
'MultiShapes.cpp',
|
||||
'Opacity.cpp',
|
||||
'PathCopy.cpp',
|
||||
'Path.cpp',
|
||||
'PixelImage.cpp',
|
||||
'PicturePng.cpp',
|
||||
'PictureRaw.cpp',
|
||||
'RadialGradient.cpp',
|
||||
'Scene.cpp',
|
||||
'SceneTransform.cpp',
|
||||
|
|
Loading…
Add table
Reference in a new issue