Commit graph

2631 commits

Author SHA1 Message Date
JunsuChoi
4db67dea82 examples/picture/svg: Add PictureSvg example
This is the simplest example using tvg::Picture's SVG loader.
2024-04-05 18:01:24 +09:00
Sergii Liebodkin
8f3b822f18 wg_engine: clenup shader sources
Remove unused composition/blending shader sources
2024-04-05 17:48:22 +09:00
Hermet Park
db8ccefbcc renderer: ++todo 2024-04-05 17:48:17 +09:00
Hermet Park
fd2fe6cc28 infra: removed old tvg packs
TVG picture binaries were maintained for compatibility checks.
These are generally not used by ThorVG developers.

Migrated those binaries to another repository to streamline
the ThorVG main repository.
2024-04-05 17:48:10 +09:00
Hermet Park
2859b8fef5 infra: remove unused resources.
thorvg will revisit this later.
2024-04-05 17:48:04 +09:00
Hermet Park
1adf5c6491 examples: updated DirectUpdate sample
Properly guide a sample usage to guarantee the sync call.
2024-04-05 17:47:57 +09:00
Hermet Park
6fa5a2a690 lottie/parser: shutdown a compiler warning.
corrected a data type.
2024-04-05 17:47:13 +09:00
Hermet Park
ce8c5c0038 lottie: fixed a parsing error in assets
An unused key in assets parsing corrupted the sequence.
This change now ensures they are tightly ignored.
2024-04-05 17:47:06 +09:00
Hermet Park
7c46b09bae lottie: fix a simple mistake. 2024-04-05 17:47:00 +09:00
Hermet Park
6df111bc23 renderer: code refactoring.
removed unnused return value.
2024-04-05 17:46:54 +09:00
Hermet Park
9f4a8de253 renderer: destroy engines safely.
Introduced a reference count to destroy it safely.
2024-04-05 17:46:48 +09:00
Hermet Park
a8fc3a6e50 renderer: revise the internal logic.
dispose of the resources at the end of the paint deletion.
This will help retain the resources of the retained paints
and reuse them after reconstructing the next scene.
2024-04-05 17:46:32 +09:00
Hermet Park
636890e20b renderer: code refactoring.
replaced references with pointers to ensure consistency.
no logical changes.
2024-04-05 17:42:42 +09:00
Hermet Park
025104b64d lottie: minor optimization.
remove an unnecessary scene in the lottie render tree.
2024-04-05 17:42:20 +09:00
Hermet Park
816afc6a27 lottie: compatibility++
retry image loading with the given candidates,
even if the suggested format is mismatched.
2024-04-05 17:42:12 +09:00
Sergii Liebodkin
9e0cc0298c wg_engine: introduced blending
[issues 1479: blending](#1479)

Supported blend settings:

    Normal
    Add
    Screen
    Multiply
    Overlay
    Difference
    Exclusion
    SrcOver
    Darken
    Lighten
    ColorDodge
    ColorBurn
    HardLight
    SoftLight
2024-04-05 17:41:44 +09:00
Hermet Park
2aa2ac7e5c lottie: corrected text height alignment issues.
enhanced support for a wider range of text use cases.
2024-04-05 17:41:37 +09:00
Hermet Park
bed2749c18 lottie: Fixed a font/glyph parsing error.
Previously, the Lottie parser expected a specific parsing order:
font followed by glyph, for optimal data processing.

However, since this order is not guaranteed,
we have revised the parsing logic to accommodate any order.
2024-04-05 17:41:32 +09:00
Hermet Park
d0cc5a1465 sw_engine: Address a corner case in trim path handling
This update fixes an issue where duplicated overlapping curves/lines,
when introduced as a single line.
That case overlapping command operation is take account for
the trim path's path-building process.

We now skip such cases to ensure the trim path functions correctly.

issue: https://github.com/thorvg/thorvg/issues/1939
2024-04-05 17:39:24 +09:00
JunsuChoi
9371c046e6 loader/svg: Fix zero check of arc's rx and ry
Please refer to the specifications.
https://www.w3.org/TR/SVG/paths.html#ArcOutOfRangeParameters

If either rx or ry is 0, then this arc is treated as a straight line
segment(a "lineto") joining the endpoints.
2024-04-05 17:39:19 +09:00
JunsuChoi
ddfe877591 loader/svg: Apply specification of out-of-range elliptical arc parameters
The three specifications below apply.

Specification: https://www.w3.org/TR/SVG/paths.html#ArcOutOfRangeParameters

-
If the endpoint (x, y) of the segment is identical to the current point
(e.g., the endpoint of the previous segment),
then this is equivalent to omitting the elliptical arc segment entirely.

-
If either rx or ry is 0, then this arc is treated
as a straight line segment(a "lineto") joining the endpoints.

-
If either rx or ry have negative signs, these are dropped;
the absolute value is used instead.
2024-04-05 17:39:12 +09:00
Hermet Park
c01757fe17 lottie: rectified scene building Logic
resolved a corner case where assets were being attached
multiple times during scene building. This issue was causing
a significant performence drop in image animation
in certain scenarios.
2024-04-05 17:38:57 +09:00
Hermet Park
fbf1e97c27 lottie: fixed an issue with missing stroke drawing
Resolved a problem where the context was missing in scenarios
involving an overlapped stroke drawing.

issue: https://github.com/thorvg/thorvg/issues/1933
2024-04-05 17:38:45 +09:00
Hermet Park
526dbbde1d renderer/shape: rectified the round rectangle start position.
adjusted the starting position of the rounded rectangle to 90 degrees
to ensure compatibility with the Lottie trim path effect.

This modification follows the earlier circle correction applied to the rectangle.

issue: https://github.com/thorvg/thorvg/issues/1933
2024-04-05 17:38:02 +09:00
Hermet Park
5bdb585534 sw_engine: Rectified dash line drawing issue.
Omit the dash line when its length falls below a minimal threshold.
This threshold is set to less than 0.0001 times the pixel size.
2024-04-05 17:37:55 +09:00
Sergii Liebodkin
84d3ef7184 wg_engine: introduced compute pipeline entities
introduces posibility to create compute pipelines
does not affect functionality
2024-04-05 17:37:49 +09:00
Hermet Park
0d337deddb examples/gif: revise the sample.
60fps takes a bit long time for our daily testing.
Removed it for the speed.
2024-04-05 17:37:44 +09:00
Hermet Park
9972fa9831 svg_loader: code refactoring
removed duplicate matrix multiply function.
2024-04-05 17:37:39 +09:00
Mew Pur Pur
d23e0fd22c svg_loader: Add missing implementation of skewX and skewY in transform-list 2024-04-05 17:37:33 +09:00
Hermet Park
fb5586447f Update README.md
updated sample code
2024-04-05 17:35:30 +09:00
Hermet Park
bd4cda3c73 sw_engine: fix a regression bug
invalidate cached compositors when target size is changed.
compositors must be re-initialized with a new size.

regression bug by ca3c1fc1b9
2024-04-05 17:35:18 +09:00
Hermet Park
96f5f82050 sw_engine: retain the compositor cache memory
The compositor memory is likely to be reused in the next frame.
To enhance performance, it is advisable to retain this memory by default.

We may consider introducing a cache policy interface in the Initializer.
This would allow users to manage the Canvas memory more effectively.

Anyhow, this improves the Lottie example performance by 10%
2024-04-05 17:35:11 +09:00
RuiwenTang
fc7ba88585 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-04-05 17:34:59 +09:00
Hermet Park
c9ee5d274d 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-04-05 17:30:28 +09:00
Hermet Park
e2914c3cd6 examples: updated scale up/down 2024-04-05 17:29:58 +09:00
Sergii Liebodkin
96e0794a67 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-04-05 17:28:34 +09:00
Hermet Park
780f30bfcc sw_engine: removed redundant logic.
Basically, sw_engine uses a desinated memory pool,
this reservation is not so effective.
2024-04-05 17:28:27 +09:00
Hermet Park
27d85f5861 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-04-05 17:28:08 +09:00
Hermet Park
ed55c04a26 examples: revise the usage.
Remove the canvas buffer clear call
when the solid bg is introduced.
2024-04-05 17:28:08 +09:00
Hermet Park
3c98cb5828 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-04-05 17:28:08 +09:00
Hermet Park
5b89479963 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-04-05 17:28:08 +09:00
Hermet Park
441542b272 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-04-05 17:28:08 +09:00
Hermet Park
2bee374bb5 Update AUTHORS 2024-04-05 17:28:08 +09:00
Hermet Park
04b3aa123d doc: updated a figure 2024-04-05 17:28:08 +09:00
Sergii Liebodkin
af6969e15e 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-04-05 17:28:08 +09:00
Hermet Park
ca0a1b909a AUTHORS: updated 2024-04-05 17:28:08 +09:00
RuiwenTang
78b2435596 gl_engine: fix radial gradient not render correctly
root cause: the gradient shader not taking into account FillSpread property
2024-04-05 17:28:08 +09:00
Hermet Park
be65d9d2e5 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-04-05 17:28:08 +09:00
Hermet Park
8b26f8b7ea 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-04-05 17:28:08 +09:00
Hermet Park
388631be68 lottie: Newly added support for the text feature.
This enhancement enables embedded glyphs rendering.
The 'fonts' and 'chars' properties are now supported.
2024-04-05 17:28:05 +09:00