Commit graph

2666 commits

Author SHA1 Message Date
RuiwenTang
c8e0c48636 gl_engine: append stencil attachment in GLRenderTarget
Plans to use stencil to test support for path clipping and complex path rendering
When the tessellation algorithm cannot handle it.
2024-01-18 21:11:58 +09:00
Hermet Park
6fee4f44d4 sw_engine: tweak the image down-scaler.
Adjust the sampling count according to the scale ratio.

This significantly improves performance
while making it hard to recognize any loss in image quality.

Lottie example performance has improved by 15%.
2024-01-18 21:10:22 +09:00
Hermet Park
bcab78e7d6 examples: updated scale up/down 2024-01-18 21:10:22 +09:00
Sergii Liebodkin
edd8756b73 wg_engine: introduced scene opacity
[issues 1479: opacity](#1479)

Supported opacity value for scene

Usage example:

    //Create a Scene
    auto scene = tvg::Scene::gen();
    scene->opacity(100);

    //Prepare Circle
    auto shape1 = tvg::Shape::gen();
    shape1->appendCircle(400, 400, 250, 250);
    shape1->fill(255, 255, 0);
    shape1->opacity(100);
    scene->push(std::move(shape1));

    //Round rectangle
    auto shape2 = tvg::Shape::gen();
    shape2->appendRect(450, 100, 200, 200, 50, 50);
    shape2->fill(0, 255, 0);
    shape2->strokeWidth(10);
    shape2->strokeFill(255, 255, 255);
    scene->push(std::move(shape2));

    canvas->push(std::move(scene));
2024-01-18 18:00:08 +09:00
Hermet Park
6ba89df805 sw_engine: removed redundant logic.
Basically, sw_engine uses a desinated memory pool,
this reservation is not so effective.
2024-01-18 17:33:48 +09:00
Hermet Park
6944633f41 lottie: Improve feature coverage by correctly handling XOR shapes
XOR when the shape's direction property is set to a value of 2.
Currently, the direction property is expected to have
either 1 for clockwise or 3 for counterclockwise orientation.

Just found out the number 2 use-case...
2024-01-18 13:34:14 +09:00
Hermet Park
27b49dcf45 examples: revise the usage.
Remove the canvas buffer clear call
when the solid bg is introduced.
2024-01-18 13:34:14 +09:00
Hermet Park
71cc7c2e30 lottie: Fixed the issue with gradient filling.
Previously, multiple gradients within a single group
couldn't be accounted for during rendering.

This fix addresses the scenario by fragmenting the rendering context.
2024-01-18 13:34:14 +09:00
Hermet Park
0335742864 lottie: properly capture the stroking context
Each group must determine the stroking rendering contexts
and assess whether context switching has occurred.

Migrate the sequence from the root layer to all groups.
2024-01-18 13:34:14 +09:00
Hermet Park
a49532a818 common: STM32 portability enhancement
Some systems such as micro-processor might not support
the thread feature on the system.

Enhance the portability by compiling the thorvg with toggling the
threading depepdency through the build option.

For this, thorvg newly introduced the internal Key/ScopedLock abstraction
for transparent thread-locking dependnecy.

To turn off the thread feature, please use the next build option:

$meson setup build -Dthreads=false ...

Note that, the thread feature is enabled in default.
Turning off the thread feature could reduce the binary size by 7kb.

issue: https://github.com/thorvg/thorvg/issues/1900
2024-01-18 10:20:21 +09:00
Hermet Park
a3470e8be3
Update AUTHORS 2024-01-15 23:42:57 +09:00
Hermet Park
a7541321c9 doc: updated a figure 2024-01-15 20:49:19 +09:00
Sergii Liebodkin
45368c319e wg_engine: introduced composition ability
[issues 1479: Masking](#1479)

Supported composition methods:

    AlphaMask
    InvAlphaMask
    LumaMask
    InvLumaMask
    AddMask
    SubtractMask
    IntersectMask
    DifferenceMask

Usage example:

    //Solid Rectangle
    auto shape = tvg::Shape::gen();
    shape->appendRect(0, 0, 400, 400);
    shape->fill(0, 0, 255);

    //Mask
    auto mask = tvg::Shape::gen();
    mask->appendCircle(200, 200, 125, 125);
    mask->fill(255, 255, 255);        //AlphaMask RGB channels are unused.

    //Nested Mask
    auto nMask = tvg::Shape::gen();
    nMask->appendCircle(220, 220, 125, 125);
    nMask->fill(255, 255, 255);       //AlphaMask RGB channels are unused.

    mask->composite(std::move(nMask), tvg::CompositeMethod::AlphaMask);
    shape->composite(std::move(mask), tvg::CompositeMethod::AlphaMask);
    canvas->push(std::move(shape));

    //Star
    auto star = tvg::Shape::gen();
    star->fill(80, 80, 80);
    star->moveTo(599, 34);
    star->lineTo(653, 143);
    star->lineTo(774, 160);
    star->lineTo(687, 244);
    star->lineTo(707, 365);
    star->lineTo(599, 309);
    star->lineTo(497, 365);
    star->lineTo(512, 245);
    star->lineTo(426, 161);
    star->lineTo(546, 143);
    star->close();
    star->strokeWidth(30);
    star->strokeJoin(tvg::StrokeJoin::Miter);
    star->strokeFill(255, 255, 255);

    //Mask3
    auto mask3 = tvg::Shape::gen();
    mask3->appendCircle(600, 200, 125, 125);
    mask3->fill(255, 255, 255);       //AlphaMask RGB channels are unused.
    mask3->opacity(200);
    star->composite(std::move(mask3), tvg::CompositeMethod::AlphaMask);
    if (canvas->push(std::move(star)) != tvg::Result::Success) return;
2024-01-15 17:33:59 +09:00
Hermet Park
381152ff1a AUTHORS: updated 2024-01-15 14:08:53 +09:00
RuiwenTang
57cff56e44 gl_engine: fix radial gradient not render correctly
root cause: the gradient shader not taking into account FillSpread property
2024-01-15 10:58:03 +09:00
Hermet Park
1a0af71155
svg2png: clear the target buffer before the drawing. (#1910)
buffer clearing is mandatory for the thorvg now.

issue: https://github.com/thorvg/thorvg/issues/1909
2024-01-15 10:06:40 +09:00
Hermet Park
7389593235 renderer/shape: fixed a regression bug
the bug was introduced in 9bf8bb018d.

Migrated the circle commands to the rectangle, which is currently necessary.
Retained the previous circle commands for backward compatibility.
2024-01-13 12:25:02 +09:00
Hermet Park
a14a105acd
lottie: Corrected the Time Remapping Range (#1907)
enable exceeding the range of normalized values in time remapping.

the issue came from a misunderstanding of the lottie spec.

issue: https://github.com/thorvg/thorvg/issues/1809
2024-01-12 18:19:23 +09:00
Hermet Park
9109a62819 lottie: Newly added support for the text feature.
This enhancement enables embedded glyphs rendering.
The 'fonts' and 'chars' properties are now supported.
2024-01-12 10:57:46 +09:00
Hermet Park
9bf8bb018d renderer/shape: refine the circle draw commands.
Adjusted the path's start point to 90 degrees
to align the origin consistently with other path commands.

No compatibility issue, this only could affect the trimpath effects.
2024-01-12 10:57:46 +09:00
Hermet Park
2954353fac Update README.md 2024-01-11 17:43:29 +09:00
Hermet Park
7cb88158cf doc: added LVGL in the practice section 2024-01-11 17:40:17 +09:00
Hermet Park
0eafcfd1b0 loader: code refactoring
Ensure scene data is freed when it's dangled in the loader.
2024-01-11 10:12:04 +09:00
Gabor Kiss-Vamosi
9958d346cf fix another type mismatch 2024-01-10 10:14:14 +02:00
Gabor Kiss-Vamosi
e207276490 fix the prototype of mpoolInit 2024-01-10 10:14:14 +02:00
Hermet Park
e95025d6d8 ttf: Fixed an invalid unicode encoding.
Ensured the data count is correctly multiplied by the data size.
2024-01-09 00:57:43 +09:00
JunsuChoi
02ae718277 loader/svg: Skip check for quotes inside quotes
Single or double quotation marks that occur before
closing the quotation mark are ignored.
2024-01-08 22:26:02 +09:00
Jinny You
1c04cab904 wasm: Add canvas clear on update
Fixed bug that canvas draws wrong frame at alpha area
2024-01-04 17:14:42 +09:00
Jinny You
abef84e935 web: Support save2png 2024-01-04 17:14:42 +09:00
Jinny You
44a8f9ffe1 web: Improve stop animation behavior
`stop` worked like `pause`, when stopping animation, frame should be at 0
2024-01-04 17:14:42 +09:00
Jinny You
2e2d19b98c web: Fix animation loading bug
when `lottie-player` has no `src` at first rendering, programmatical load wasn't working
2024-01-04 17:14:42 +09:00
Jinny You
8e50ea4a18 web: Add extra feature & property
- Support `resize` method
- Add `resolution` prop
2024-01-04 17:14:42 +09:00
Hermet Park
bacbd575b9 infra: bumped up version v0.12, set it dev mode. 2024-01-04 16:26:02 +09:00
Hermet Park
7dd709b4b8 saver/tvg: removed an unstable condition.
this optimization breaks the scene composition, remove it.

Issue: https://github.com/thorvg/thorvg/issues/1750
2024-01-03 16:45:33 +09:00
Jinny You
3896d21c3a web/examples: Add save2tvg 2024-01-03 13:51:42 +09:00
Jinny You
20a6ca19e7 web: Support file types
- added new exportable type `tvg`
- support jpg/png/svg/tvg load
2024-01-03 13:51:42 +09:00
Jinny You
5f088a2357 wasm: Revise saver methods 2024-01-03 13:51:42 +09:00
Hermet Park
8375c53461 ttf: removed the beta tag.
incorporate TTF support into the CI build tests.
2024-01-03 12:57:07 +09:00
Hermet Park
139a1c5e85 ttf: fix the windows compilation errors. 2024-01-03 12:57:07 +09:00
Hermet Park
15baf20363 tvg picture: binary version up. 2024-01-02 20:39:30 +09:00
Hermet Park
24901e7d59 docs: updated doxygen for 0.12 release 2024-01-02 20:39:19 +09:00
Sergii Liebodkin
450d56face
xides compilation issue with loaders (#1885) 2024-01-02 18:15:36 +09:00
Hermet Park
a6f4b5f38c examples: ++safety.
Guarantee the resource free at the termination.
2023-12-31 11:41:02 +09:00
Hermet Park
468b132739 renderer: enhanced shared surface handling with mutex implementation
Introduced a dedicated mutex for each surface instance
to ensure safe sharing between the loader, renderer, and engine.

This enhancement allows for secure modification and access to bitmap data,
addressing potential concurrency issues.

Multiple Picture instances can now safely share a single loader instance,
optimizing performance.

This change builds upon the previous Loader Cache improvements:
ff6ea4b6c4
2023-12-31 11:37:12 +09:00
Hermet Park
fbcfb3f865 svg: ensure that all allocated memory.
observed a memory leak at a corner case.
2023-12-31 10:45:26 +09:00
Hermet Park
cf35ca3392 lottie: resolve a thread sanitizer report.
Issue: https://github.com/thorvg/thorvg/issues/1874
2023-12-29 20:06:21 +09:00
Hermet Park
217c53e823 renderer/loader: improve thread safety
activeLoaders can be accessed by loaders within the worker thread.

the issue came up with the Loader cache feature:
ff6ea4b6c4

Issue: https://github.com/thorvg/thorvg/issues/1874
2023-12-29 16:57:09 +09:00
Hermet Park
ea4662a927 sw_engine: resolve a thread sanitizer report.
Synchronize before accessing the shared bbox.

Issue: https://github.com/thorvg/thorvg/issues/1874
2023-12-29 16:57:09 +09:00
Hermet Park
83042aa0a2 renderer/taskscheduler: Resolve a thread sanitizer report.
Since each thread worker accesses the 'threads.count' variable,
delay the thread starting until initialization is completed.
2023-12-29 16:57:09 +09:00
Hermet Park
8d3449a90d renderer/loader: code refactoring.
Removed internal unique_ptr usage for a more compact size.
2023-12-29 16:19:37 +09:00