Commit graph

471 commits

Author SHA1 Message Date
Michal Maciola
7ec52e6c9e Picture capi binding 2020-11-30 13:16:20 +09:00
Michal Szczecinski
01aef488f0
capi: Added fill rule API.
Added capi binding for fill rule setter and getter.

@API changes:

enum Tvg_Fill_Rule {
  TVG_FILL_RULE_WINDING = 0,
  TVG_FILL_RULE_EVEN_ODD,
}

Tvg_Result     tvg_shape_set_fill_rule(Tvg_Paint* paint, Tvg_Fill_Rule rule)
Tvg_Fill_Rule  tvg_shape_get_fill_rule(Tvg_Paint* paint, Tvg_Fill_Rule* rule)
2020-11-30 13:08:24 +09:00
Hermet Park
b125a7ea2e examples: ignore loading raw image file.
in the last commit, it added a raw image file in the images folder.
It breaks Multicanvas, Svg which try to load all kinds of files in it.

We don't need to load all files by figuring out file extension name.
2020-11-23 18:56:23 +09:00
JunsuChoi
e00f948705
raw_loader Loader: Introduce Raw image loader
Add RawLoader class that loads and display raw images,
and adds a Rasterizer for image data.
Image data can be loaded via picture.
Loaded image supports Composition, Transformation and Alpha blending.

New API
Result load(uint32_t* data, uint32_t width, uint32_t height, bool isCopy) noexcept;
2020-11-23 18:12:36 +09:00
Michal Szczecinski
e259213b44 capi: Added free flag to clear API.
Cpp implementaiton of library has free flag which was not used in
capi bindings.

@API changes
from: tvg_canvas_clear(Tvg_Canvas *canvas);
to: tvg_canvas_clear(Tvg_Canvas *canvas, bool free);
2020-11-20 12:04:22 +09:00
Hermet Park
a71773f98d
common taskScheduler: code refactoring
removed unnecessary code.
2020-11-11 13:55:46 +09:00
Subhransu Mohanty
c2e1583e94 common taskScheduler: fix a synchronization data race.
std mutex shouldn't be used among threads. behavior is unexpected by implmentation.

This resolves it by introducing conditional value.
2020-11-10 16:45:52 +09:00
Michal Szczecinski
d1d54e8b8f
capi examples: Added scene API C bindings.
Scene CAPI allows to use scene functionaliy in C applications such as
set opacity to few shapes at one time or implement transparent layers.

@API Additions:
```c
Tvg_Paint* tvg_scene_new();
Tvg_Result tvg_scene_reserve(Tvg_Paint* scene, uint32_t size);
Tvg_Result tvg_scene_push(Tvg_Paint* scene, Tvg_Paint *paint);
```

Examples:
```c
Tvg_Paint *scene = tvg_scene_new();

Tvg_Paint *shape1 = tvg_shape_new();
tvg_shape_append_rect(shape1, 10, 10, 100, 100, 0, 0);
tvg_shape_set_fill_color(shape1, 255, 0, 0, 255);

Tvg_Paint *shape2 = tvg_shape_new();
tvg_shape_append_rect(shape2, 120, 10, 100, 100, 0, 0);
tvg_shape_set_fill_color(shape2, 255, 0, 0, 255);

tvg_scene_push(scene, shape1);
tvg_scene_push(scene, shape2);

tvg_paint_set_opacity(scene, 100);

tvg_canvas_push(canvas, scene);
```

Co-authored-by: Michal Szczecinski <m.szczecinsk@partner.samsung.com>
2020-11-10 12:13:48 +09:00
Hermet Park
3fabd604bf examples capi: removed printf()
there is no point to print information.
2020-11-09 14:43:15 +09:00
Hermet Park
9872cf066d
common taskScheduler: thread sync optmization
replaced future/promise with mutex since they use a lot of memory allocation number.

plus, binary size is reduced from 2094896 -> 1746864
2020-11-09 14:36:22 +09:00
Hermet Park
e445b7f579 Revert "examples: revise example code."
This broke gl_engine rendering, revert it.

This reverts commit 9bb1972ef9.
2020-11-06 15:37:17 +09:00
Hermet Park
bb4c6b299f common renderer: code refactoring.
renamed internal methods from flush() to sync()
since flush() is reserved for caching flush.
2020-11-06 15:26:47 +09:00
Hermet Park
9718c6aa5b gl_engine renderer: fix build break.
just found a missing change for the fillColor api.
2020-11-06 15:25:11 +09:00
Hermet Park
5751fd13cc sw_engine mempool: ++optimization
These memory pools requires very simple mechanism.

Remove stl vector but use direct memory for less binary size.(2127696 -> 2094094)

@Issues: 75
2020-11-06 13:54:53 +09:00
Hermet Park
c6013536ec common shape: memory optimization
All shapes will have path data,
avoid unnecesary dynamic memory allocation internally.

@Issues: 75
2020-11-06 11:47:51 +09:00
Hermet Park
8d03f131a3 updated AUTHORS 2020-11-06 11:33:09 +09:00
Vincent Torri
5a85b40f6c fix compilation on Windows 2020-11-06 11:28:54 +09:00
Vincent Torri
8243b3a1f5 fix compilation on Windows 2020-11-06 11:28:54 +09:00
Hermet Park
006e6e0920 sw_engine rle: performance optimization.
Tis is a subsequential trial of 1b8188ee67
for opimizing memory alloc count.

In this time, it concentrates on rle span.

@Issues: 75
2020-11-05 17:32:42 +09:00
Hermet Park
2b762f00e2
Update README.md 2020-11-05 14:44:43 +09:00
Hermet Park
39ea685edb
Update README.md 2020-11-05 14:43:32 +09:00
Hermet Park
ad9460444a
Update CONTRIBUTING.md 2020-11-05 13:57:21 +09:00
Hermet Park
5fbc446455
Update README.md 2020-11-04 21:01:22 +09:00
Hermet Park
9ba5f740d5 res: updated thorvg card images. 2020-11-04 20:59:19 +09:00
Hermet Park
1d3c56e487 sw_engine mempool: performance optimization.
This is a subsequential trial of 1b8188ee67
for opimizing memory alloc count.

In this time, it concentrates on stroke outline.

@Issues: 75
2020-11-04 20:42:01 +09:00
Hermet Park
410fa6c115 sw_engine mempool: changed caching policy.
for smart usage, clear memory only when engine is terminated.
2020-11-04 19:20:29 +09:00
Hermet Park
3ab1194773 common sw_engine: code refactoring
replaced names and fixed out of coding convention.
2020-11-04 19:18:59 +09:00
Hermet Park
9bb1972ef9 examples: revise example code.
Move the Clear call to the end of drawing those scenarios doesn't need to retain paints resources.

We should show the examples as the best usage.

@Issues: 75
2020-11-04 19:05:11 +09:00
Hermet Park
1b8188ee67
sw_engine shape: performance optimization.
we introduced shared memory pool for avoiding reallocate memory
while it process the stroke outlines, It experimentally increase
the outline data if we use the allocated memory for multiples shape strokes,
we don't need to alloc/free memory during the process.

This shared outline memory is allocated for threads count
so that we don't interrupt memory access during the tasks.

@Issues: 75
2020-11-04 16:28:47 +09:00
Hermet Park
fbe5b87106 res: polishing example pictures. 2020-11-04 11:47:17 +09:00
Hermet Park
b8128e0083
Update README.md 2020-11-04 11:33:27 +09:00
Hermet Park
6eba3591a5
Update README.md 2020-11-04 11:32:27 +09:00
Hermet Park
52426c56e6 res: adds working-flow picture.
this picture will be used in README.
2020-11-04 11:29:13 +09:00
Michal Szczecinski
882188c752 common capi: Added opacity C bindings.
Added opacity setter/getter to CAPI. They will be useful to simplify
code responsible for set visiblility of paint.

@API Additions:
Tvg_Result tvg_paint_set_opacity(Tvg_Paint* paint, uint8_t opacity)
Tvg_Result tvg_paint_get_opacity(Tvg_Paint* paint, uint8_t* opacity)
2020-11-04 10:37:55 +09:00
Hermet Park
ec2ec6e9c6
Update README.md 2020-11-03 16:23:29 +09:00
Hermet Park
acd17e449f
Update README.md 2020-11-03 14:48:40 +09:00
Hermet Park
9aa4d6b309 res: updated example screenshot resources 2020-11-03 14:46:16 +09:00
Hermet Park
8fdc24d88c
Update README.md 2020-11-03 14:45:44 +09:00
Hermet Park
8eeb8685ed
Update README.md 2020-11-03 14:42:33 +09:00
Hermet Park
eb6b5d10ce res: replaced primitive example screenshot. 2020-11-03 14:40:51 +09:00
Hermet Park
e02d3c30e9
Update README.md 2020-11-03 14:26:05 +09:00
Hermet Park
88cd205b16
Update README.md 2020-11-03 14:25:00 +09:00
Hermet Park
200016fea0 common LoaderMgr: code refactoring
keep clean & neat thorvg coding style.
2020-11-03 14:21:19 +09:00
Hermet Park
e9d1d13edd res: adds primitive example screenshot. 2020-11-03 14:20:42 +09:00
Hermet Park
0549bc5cb9
Update README.md 2020-11-03 14:07:58 +09:00
JunsuChoi
af85eb22ad svg_loader LoaderMgr: Delegates file validation check to LoaderMgr.
Delegates extension string check and header(open) check
for file to LoaderMgr.
This makes it easy to add a loader afterwards.
2020-11-03 12:15:12 +09:00
Hermet Park
627579522d sw_engine shape: code refactoring.
thorvg always prefer simpler code, less LOC.
2020-11-02 19:25:36 +09:00
Mira Grudzinska
a96037cd57 sw_engine shape: change of the rectangle fast tracking algorithm
The algorithm erroneously treated some shapes (like isosceles trapezoids
and specifically arranged zero width parallelograms) as rectangles,
which causes the whole bbox to be filled.
2020-11-02 19:23:44 +09:00
JunsuChoi
dc822174e8 svg_loader: Fixed a typo
lenght ->length
2020-11-02 14:16:13 +09:00
JunsuChoi
9859a48714 test Canvas: Set up unit test based on gtest.
In test directory, set up unit_test based on gtest
First, add a test for SwCanvas generate.
2020-11-02 14:15:50 +09:00