examples: move tests to src/examples
tests is now officially placed in src/examples, default is turned off, only necessaries turn it on. ex) meson . build -Dexamples=true + this examples are required efl 'elementary' package.
|
@ -6,6 +6,8 @@ project('thorvg',
|
||||||
|
|
||||||
config_h = configuration_data()
|
config_h = configuration_data()
|
||||||
|
|
||||||
|
add_project_arguments('-DEXAMPLE_DIR="@0@/src/examples/svgs"'.format(meson.current_source_dir()), language : 'cpp')
|
||||||
|
|
||||||
if get_option('engines').contains('sw') == true
|
if get_option('engines').contains('sw') == true
|
||||||
config_h.set10('THORVG_SW_RASTER_SUPPORT', true)
|
config_h.set10('THORVG_SW_RASTER_SUPPORT', true)
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -26,4 +26,9 @@ option('tools',
|
||||||
type: 'array',
|
type: 'array',
|
||||||
choices: ['', 'svg2png'],
|
choices: ['', 'svg2png'],
|
||||||
value: [''],
|
value: [''],
|
||||||
description: 'Enable building ThorVG Tools')
|
description: 'Enable building thorvg tools')
|
||||||
|
|
||||||
|
option('examples',
|
||||||
|
type: 'boolean',
|
||||||
|
value: false,
|
||||||
|
description: 'Enable building examples')
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
if get_option('tools').contains('svg2png') == true
|
if get_option('tools').contains('svg2png') == true
|
||||||
|
message('Enable Tools: svg2png')
|
||||||
subdir('svg2png')
|
subdir('svg2png')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
int
|
|
||||||
main(int argc, char *argv[])
|
|
||||||
{
|
|
||||||
cout << "test thorvg!" << endl;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1 +1,36 @@
|
||||||
executable('thorvg_sample', 'main.cpp')
|
examples_dep = dependency('elementary', required : true)
|
||||||
|
|
||||||
|
source_file = [
|
||||||
|
'testArc.cpp',
|
||||||
|
'testAsync.cpp',
|
||||||
|
'testBlending.cpp',
|
||||||
|
'testBoundary.cpp',
|
||||||
|
'testCapi.cpp',
|
||||||
|
'testCustomTransform.cpp',
|
||||||
|
'testDirectUpdate.cpp',
|
||||||
|
'testDuplicate.cpp',
|
||||||
|
'testGradientTransform.cpp',
|
||||||
|
'testLinearGradient.cpp',
|
||||||
|
'testMultiCanvas.cpp',
|
||||||
|
'testMultiShapes.cpp',
|
||||||
|
'testPathCopy.cpp',
|
||||||
|
'testPath.cpp',
|
||||||
|
'testRadialGradient.cpp',
|
||||||
|
'testScene.cpp',
|
||||||
|
'testSceneTransform.cpp',
|
||||||
|
'testShape.cpp',
|
||||||
|
'testStroke.cpp',
|
||||||
|
'testStrokeLine.cpp',
|
||||||
|
'testSvg2.cpp',
|
||||||
|
'testSvg.cpp',
|
||||||
|
'testTransform.cpp',
|
||||||
|
'testUpdate.cpp',
|
||||||
|
]
|
||||||
|
|
||||||
|
foreach current_file : source_file
|
||||||
|
name = current_file.split('.')[0]
|
||||||
|
executable(name, current_file,
|
||||||
|
include_directories : headers,
|
||||||
|
link_with : thorvg_lib,
|
||||||
|
dependencies : examples_dep)
|
||||||
|
endforeach
|
||||||
|
|
Before Width: | Height: | Size: 532 B After Width: | Height: | Size: 532 B |
Before Width: | Height: | Size: 807 B After Width: | Height: | Size: 807 B |
Before Width: | Height: | Size: 1 KiB After Width: | Height: | Size: 1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 794 B After Width: | Height: | Size: 794 B |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 919 B After Width: | Height: | Size: 919 B |
Before Width: | Height: | Size: 1 KiB After Width: | Height: | Size: 1 KiB |
Before Width: | Height: | Size: 330 B After Width: | Height: | Size: 330 B |
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 514 B After Width: | Height: | Size: 514 B |
Before Width: | Height: | Size: 501 B After Width: | Height: | Size: 501 B |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 84 KiB After Width: | Height: | Size: 84 KiB |
Before Width: | Height: | Size: 633 B After Width: | Height: | Size: 633 B |
Before Width: | Height: | Size: 282 B After Width: | Height: | Size: 282 B |
|
@ -126,13 +126,13 @@ void testCapi()
|
||||||
|
|
||||||
tvg_shape_get_path_commands(shape, &cmds, &cmdCnt);
|
tvg_shape_get_path_commands(shape, &cmds, &cmdCnt);
|
||||||
printf("---- First Shape Commands(%u) ----\n", cmdCnt);
|
printf("---- First Shape Commands(%u) ----\n", cmdCnt);
|
||||||
for(int i=0; i < cmdCnt; ++i) {
|
for(uint32_t i = 0; i < cmdCnt; ++i) {
|
||||||
printf("%d\n", cmds[i]);
|
printf("%d\n", cmds[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
tvg_shape_get_path_coords(shape, &pts, &ptsCnt);
|
tvg_shape_get_path_coords(shape, &pts, &ptsCnt);
|
||||||
printf("---- First Shape Points(%u) ----\n", ptsCnt);
|
printf("---- First Shape Points(%u) ----\n", ptsCnt);
|
||||||
for(int i=0; i < ptsCnt; ++i) {
|
for(uint32_t i = 0; i < ptsCnt; ++i) {
|
||||||
printf("(%.2lf, %.2lf)\n", pts[i].x, pts[i].y);
|
printf("(%.2lf, %.2lf)\n", pts[i].x, pts[i].y);
|
||||||
}
|
}
|
||||||
|
|
|
@ -216,9 +216,9 @@ int main(int argc, char **argv)
|
||||||
evas_object_smart_callback_add(win, "delete,request", win_del, 0);
|
evas_object_smart_callback_add(win, "delete,request", win_del, 0);
|
||||||
|
|
||||||
if (tvgEngine == tvg::CanvasEngine::Sw) {
|
if (tvgEngine == tvg::CanvasEngine::Sw) {
|
||||||
eina_file_dir_list("./svgs", EINA_TRUE, tvgSwTest, win);
|
eina_file_dir_list(EXAMPLE_DIR, EINA_TRUE, tvgSwTest, win);
|
||||||
} else {
|
} else {
|
||||||
eina_file_dir_list("./svgs", EINA_TRUE, tvgGlTest, win);
|
eina_file_dir_list(EXAMPLE_DIR, EINA_TRUE, tvgGlTest, win);
|
||||||
}
|
}
|
||||||
|
|
||||||
evas_object_geometry_set(win, 0, 0, WIDTH, HEIGHT);
|
evas_object_geometry_set(win, 0, 0, WIDTH, HEIGHT);
|
||||||
|
@ -234,4 +234,4 @@ int main(int argc, char **argv)
|
||||||
cout << "engine is not supported" << endl;
|
cout << "engine is not supported" << endl;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
|
@ -14,12 +14,10 @@ static std::vector<unique_ptr<tvg::Picture>> pictures;
|
||||||
|
|
||||||
void svgDirCallback(const char* name, const char* path, void* data)
|
void svgDirCallback(const char* name, const char* path, void* data)
|
||||||
{
|
{
|
||||||
tvg::Canvas* canvas = static_cast<tvg::Canvas*>(data);
|
|
||||||
|
|
||||||
auto picture = tvg::Picture::gen();
|
auto picture = tvg::Picture::gen();
|
||||||
|
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
sprintf(buf,"%s/%s", path, name);
|
sprintf(buf, "/%s/%s", path, name);
|
||||||
|
|
||||||
if (picture->load(buf) != tvg::Result::Success) return;
|
if (picture->load(buf) != tvg::Result::Success) return;
|
||||||
|
|
||||||
|
@ -61,7 +59,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
||||||
|
|
||||||
if (canvas->push(move(shape)) != tvg::Result::Success) return;
|
if (canvas->push(move(shape)) != tvg::Result::Success) return;
|
||||||
|
|
||||||
eina_file_dir_list("./svgs", EINA_TRUE, svgDirCallback, canvas);
|
eina_file_dir_list(EXAMPLE_DIR, EINA_TRUE, svgDirCallback, canvas);
|
||||||
|
|
||||||
/* This showcase shows you asynchrounous loading of svg.
|
/* This showcase shows you asynchrounous loading of svg.
|
||||||
For this, pushing pictures at a certian sync time.
|
For this, pushing pictures at a certian sync time.
|
|
@ -29,8 +29,6 @@ thorvg_lib = library(
|
||||||
gnu_symbol_visibility : 'hidden',
|
gnu_symbol_visibility : 'hidden',
|
||||||
)
|
)
|
||||||
|
|
||||||
subdir('bin')
|
|
||||||
|
|
||||||
thorvg_dep = declare_dependency(
|
thorvg_dep = declare_dependency(
|
||||||
include_directories: headers,
|
include_directories: headers,
|
||||||
link_with : thorvg_lib
|
link_with : thorvg_lib
|
||||||
|
@ -45,3 +43,10 @@ pkg_mod.generate(
|
||||||
filebase : 'thorvg',
|
filebase : 'thorvg',
|
||||||
description : 'A Thor library for rendering vector graphics'
|
description : 'A Thor library for rendering vector graphics'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
subdir('bin')
|
||||||
|
|
||||||
|
if get_option('examples') == true
|
||||||
|
message('Enable Examples')
|
||||||
|
subdir('examples')
|
||||||
|
endif
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
all:
|
|
||||||
gcc -o testShape testShape.cpp -g -lstdc++ `pkg-config --cflags --libs elementary thorvg`
|
|
||||||
gcc -o testMultiShapes testMultiShapes.cpp -g -lstdc++ `pkg-config --cflags --libs elementary thorvg`
|
|
||||||
gcc -o testBoundary testBoundary.cpp -g -lstdc++ `pkg-config --cflags --libs elementary thorvg`
|
|
||||||
gcc -o testPath testPath.cpp -g -lstdc++ `pkg-config --cflags --libs elementary thorvg`
|
|
||||||
gcc -o testPathCopy testPathCopy.cpp -g -lstdc++ `pkg-config --cflags --libs elementary thorvg`
|
|
||||||
gcc -o testBlending testBlending.cpp -g -lstdc++ `pkg-config --cflags --libs elementary thorvg`
|
|
||||||
gcc -o testUpdate testUpdate.cpp -g -lstdc++ `pkg-config --cflags --libs elementary thorvg`
|
|
||||||
gcc -o testDirectUpdate testDirectUpdate.cpp -g -lstdc++ `pkg-config --cflags --libs elementary thorvg`
|
|
||||||
gcc -o testScene testScene.cpp -g -lstdc++ `pkg-config --cflags --libs elementary thorvg`
|
|
||||||
gcc -o testTransform testTransform.cpp -g -lstdc++ `pkg-config --cflags --libs elementary thorvg`
|
|
||||||
gcc -o testCustomTransform testCustomTransform.cpp -g -lstdc++ `pkg-config --cflags --libs elementary thorvg`
|
|
||||||
gcc -o testSceneTransform testSceneTransform.cpp -g -lstdc++ `pkg-config --cflags --libs elementary thorvg`
|
|
||||||
gcc -o testStroke testStroke.cpp -g -lstdc++ `pkg-config --cflags --libs elementary thorvg`
|
|
||||||
gcc -o testStrokeLine testStrokeLine.cpp -g -lstdc++ `pkg-config --cflags --libs elementary thorvg`
|
|
||||||
gcc -o testLinearGradient testLinearGradient.cpp -g -lstdc++ `pkg-config --cflags --libs elementary thorvg`
|
|
||||||
gcc -o testRadialGradient testRadialGradient.cpp -g -lstdc++ `pkg-config --cflags --libs elementary thorvg`
|
|
||||||
gcc -o testGradientTransform testGradientTransform.cpp -g -lstdc++ `pkg-config --cflags --libs elementary thorvg`
|
|
||||||
gcc -o testSvg testSvg.cpp -g -lstdc++ `pkg-config --cflags --libs elementary thorvg`
|
|
||||||
gcc -o testSvg2 testSvg2.cpp -g -lstdc++ `pkg-config --cflags --libs elementary thorvg`
|
|
||||||
gcc -o testAsync testAsync.cpp -g -lstdc++ `pkg-config --cflags --libs elementary thorvg`
|
|
||||||
gcc -o testArc testArc.cpp -g -lstdc++ `pkg-config --cflags --libs elementary thorvg`
|
|
||||||
gcc -o testMultiCanvas testMultiCanvas.cpp -g -lstdc++ `pkg-config --cflags --libs elementary thorvg`
|
|
||||||
gcc -o testDuplicate testDuplicate.cpp -g -lstdc++ `pkg-config --cflags --libs elementary thorvg`
|
|
||||||
gcc -o testCapi testCapi.c -g `pkg-config --cflags --libs elementary thorvg`
|
|