Commit graph

3736 commits

Author SHA1 Message Date
Sergii Liebodkin
c77b6ec8db wg_engine: sync up to update the engine work to webgpu_native v22
Only minor changes required
Keeped compatibility with emsdk

issue: https://github.com/thorvg/thorvg/issues/2909
2025-04-23 21:20:47 +09:00
Hermet Park
bcfbc55af2
Update README.md 2025-04-23 18:36:44 +09:00
Mira Grudzinska
65c4e27437 svg_loader: fix clipping in use/symbol nodes
Clipping for the <use> node when a <symbol> was used,
was being overridden when 'overflowVisible' was 'true'
(the default value), which caused the 'clip-path' applied
to the <use> node to have no visible effect.
The clipping for the <use> node (without <symbol> node) was
transformed in an incorrect order, resulting in a visually
incorrect results.

@Issue: https://github.com/thorvg/thorvg/issues/3392
2025-04-23 15:59:51 +09:00
Hermet Park
53e5e783b7 api: revise engine initialization and termination
Simplified parameters and ensured proper backend engine
initialization by using reference checking through canvas
instances.

C++ API Modification:
- Result Initializer::init(uint32_t threads, CanvasEngine engine)
 -> Result Initializer::init(uint32_t threads)
- Result Initializer::term(CanvasEngine engine)
 -> Result Initializer::term()

C API Modification:
- Tvg_Result tvg_engine_init(Tvg_Engine engine_method, unsigned threads)
 -> Tvg_Result tvg_engine_init(unsigned threads);
- Tvg_Result tvg_engine_term(Tvg_Engine engine_method)
 ->  Tvg_Result tvg_engine_term()

issue: https://github.com/thorvg/thorvg/issues/3116
2025-04-23 15:46:49 +09:00
Hermet Park
4cf68b75e5 renderer: code clean++ 2025-04-22 00:13:40 +09:00
Hermet Park
4c3beb1cb1 sw_engine: --size reduction
basically, sw engine aims for 32bits, it reduces
the bundle size by 1kb.

Need to carefully see any side effect in practice.
2025-04-21 17:52:28 +09:00
Hermet Park
d9aa5141be
doc: added supported svg spec details. 2025-04-20 12:22:09 +09:00
Hermet Park
1a332acd37 renderer: revise the pImpl design with a better efficiency
The following is a redesign that extends the class internally.

The main goal is to preserve the characteristics of the pImpl idiom
for data encapsulation, while simultaneously reducing the memory
allocation overhead typically associated with pImpl.

The stragegy is here:
Rather than alloc the impl memory inside of the thorvg engine,
impl extends the API classes in order to consolidate the memory.

size has been decreased by -4kb with optimization=s

issue: https://github.com/thorvg/thorvg/issues/3214
2025-04-20 00:07:50 +09:00
Hermet Park
7feb43201b svg: fixed invalid memory access
Added "Filter" and "GaussianBlur" to the list of node type strings
to ensure the array fully covers the SvgNodeType enum values.
2025-04-18 13:27:06 +09:00
Hermet Park
af7fb159d1 wg_engine: ++safety 2025-04-18 13:26:08 +09:00
Hermet Park
e692a59ff9 lottie/expressions: --memory leak 2025-04-18 13:18:17 +09:00
Hermet Park
5ce6fca802 api: fixed a build linking issue on lottie
- something wrong with typeinfo missing in destructor
(don't know reason) and this resolves the problem.

- added override specifier for destructors
2025-04-17 15:38:15 +09:00
Sergii Liebodkin
858205a132 webgpu: replace readonly strorages to texture2d (v24 migration)
https://github.com/thorvg/thorvg/issues/2909
2025-04-17 11:25:04 +09:00
Mira Grudzinska
a2f9b6da21 wg_engine: fix drop shadow blended color
The shadow color must be premultiplied. To avoid
repeating this operation in the fragment shader,
the passed shadow color is already premultiplied.
2025-04-17 11:18:47 +09:00
Mira Grudzinska
3b634064c9 gl_engine: fix drop shadow blended color
The shadow color produced incorrect results after
blending with the texture color. This was caused
by not taking the alpha value into account in the
specified shadow color (with OpenGL blending disabled).
2025-04-17 11:18:47 +09:00
Hermet Park
fa0a1b7e60 lottie: fixed a invalid memory access
looping doesn't make sense if the animation
doesn't have frames. use the current frame number.
2025-04-17 00:05:14 +09:00
Mira Grudzinska
3fbc36629f renderer: add missing RenderUpdateFlag
Flag was missing in the appendRect().
2025-04-16 18:38:51 +09:00
Hermet Park
176573ff25 renderer: fixed a clippging update isssue
ThorVG did not consider updates to the clipping path
when a paint object was modified after being added to the scene.

This fix ensures that any updates to clipping are correctly
reflected during rendering.

issue: https://github.com/thorvg/thorvg/issues/3403
2025-04-16 18:37:56 +09:00
lpogic
feda6bcbc2 Added null check in Paint::Impl:clip
issue: https://github.com/thorvg/thorvg/issues/3404
2025-04-16 11:23:14 +09:00
Hermet Park
0c259b41f4 examples: updated svg resources 2025-04-15 11:59:02 +09:00
Sergii Liebodkin
6c3fee84ec gl_engine: introduce dropshadow effect for opengl renderer
issue: https://github.com/thorvg/thorvg/issues/3054
2025-04-15 11:43:32 +09:00
Hermet Park
5c27fefef8 lottie/expressions: minor updates
- added toComp() initial ver.
- added mn property for effects

issue: https://github.com/thorvg/thorvg/issues/2233
2025-04-14 16:07:35 +09:00
Hermet Park
d0f33a1bc5 lottie/expressions: hotfix
issue: https://github.com/thorvg/thorvg/issues/3400
2025-04-12 15:22:51 +09:00
Mira Grudzinska
934a6e5418 ttf: prevent crash while converting utf8 to unicode
If wrong utf8 sequence if given as an input, decoding
return nullptr and it has to be handled correctly.
2025-04-11 19:18:04 +09:00
Mira Grudzinska
54b33fcd28 lottie: safety++
Prevents a crash when the font family in the text document
does not match any font in the provided font list.
2025-04-11 19:17:50 +09:00
Hermet Park
8c4f3e7eec loaders: explicit variable scope to improve portability
issue: https://github.com/godotengine/godot/pull/105093
2025-04-11 12:56:10 +09:00
Hermet Park
06103ed355 doc: added lottie creator in practice. 2025-04-11 12:41:25 +09:00
Hermet Park
4bc73c8a09 lottie: --compiler warnings on msvc 2025-04-10 22:09:33 +09:00
Hermet Park
ea54154906 lottie/expressions: tiny optimization
reuse the user callback data by the reference count.
2025-04-10 15:10:33 +09:00
Hermet Park
e308d3416a lottie: code refactoring
align the internal naming for lottie "ix" properites and its variables
2025-04-10 15:10:33 +09:00
Hermet Park
882cb316c4 lottie: allow custom effects to use nm/mn both identifiers 2025-04-10 15:10:33 +09:00
Hermet Park
a4ed00b08e examples: ++bounding box 2025-04-10 12:32:06 +09:00
Benjamin
b38b6b659d common: fix incorrect aabb of scenes 2025-04-10 12:31:28 +09:00
Mira Grudzinska
f8c5f3a69c
lottie: follow path stabilization++
* lottie: fixes in follow path

Each time the 'updateText' was called, the mask
path (if the follow path existed) was appended
to the previous one, causing it to grow infinitely.
A 'clear' call on the existing path was missing.

The positions on the follow path for distances larger
than 2 x mask path length were not correctly calculated.

* lottie: fix crash on follow path

It could happen that the searched text position
(distance from the start pointt) on the follow path
was exactly equal to the path length. In such a case,
the cmds pointer pointed to the last element, and in
the next iteration, this caused a crash.
2025-04-10 12:13:52 +09:00
Sergii Liebodkin
eb67549295 gl_engine: Introduce tritone effect for opengl renderer
issue: https://github.com/thorvg/thorvg/issues/3054
2025-04-10 11:36:47 +09:00
Sergii Liebodkin
95f1b84a56 gl_engine: Introduce tint effect for opengl renderer
issue: https://github.com/thorvg/thorvg/issues/3054
2025-04-10 11:36:47 +09:00
Sergii Liebodkin
85e215a294 gl_engine: Introduce fill effect for opengl renderer
issue: https://github.com/thorvg/thorvg/issues/3054
2025-04-10 11:36:47 +09:00
Hermet Park
bf3bd908ff examples: updated lottie samples 2025-04-09 12:19:39 +09:00
Mira Grudzinska
b304448ef7 lottie: revert "lottie: more precise culling for inverse mattes"
This reverts commit 7ef3352efa.

For mattes of type 'InvAlpha' or 'InvLuma', the matted layer
can still be visible regardless of the matte's opacity (unlike
'Alpha' and 'Luma' masks, which cut out the entire layer when
opacity = 0). The previously introduced optimization incorrectly
assumed that with opacity = 255, the image would not be visible.

@Issue: https://github.com/thorvg/thorvg/issues/3375
@Issue: https://github.com/thorvg/thorvg/issues/3380
@Issue: https://github.com/thorvg/thorvg/issues/3381
@Issue: https://github.com/thorvg/thorvg/issues/3382
2025-04-09 11:21:36 +09:00
Sergii Liebodkin
595769257e gl_engine: Introduce gaussian blur effect
issue: https://github.com/thorvg/thorvg/issues/3054
2025-04-09 11:16:55 +09:00
Hermet Park
d3afebfdec lottie: add custom layer effect with expressions support
effect(name) / effect(index)

effects finds the effect by its name in the Effect Controls panel.
The name can be the default name or a user-defined name.
If multiple effects have the same name,
the effect closest to the top of the Effect Controls panel is used.

example:
- effect("Fast Blur")("Blurriness")

issue: https://github.com/thorvg/thorvg/issues/3115
2025-04-08 15:35:36 +09:00
Jinny You
fbe10255d7 lottie/text: added range selector flags
Duplicated text document properties (fill color, stroke color, and stroke width) to the text range.

If these properties are not defined in the range selector, ThorVG incorrectly overrides them with default values.

The correct behavior is to preserve the original values. The added flags address this issue.

Co-Authored-By: Hermet Park<hermet@lottiefiles.com>
2025-04-07 17:34:52 +09:00
Jinny You
2b3cdb0d97 lottie: simplify text layout calculation 2025-04-05 02:35:11 +09:00
Mira Grudzinska
9bc3d5e3b7 lottie: fix stroke cap/join values
ThorVG cap/join enums and lottie specs were not aligned.
Problem was observed for StrokeCap::Square and StrokeJoin::Bevel.

Note: this change breaks backward comatibility.
2025-04-03 00:29:31 +09:00
Hermet Park
34d731fa94 lottie: minor code change of template mismatch
subsequent change by a9cd630dfd
2025-04-02 15:44:21 +09:00
Benson Muite
ed658cb8bd tools: Use binary names that are not generic
Prevent installation conflicts.
2025-04-02 15:42:47 +09:00
Hermet Park
321305ff0b loaders: ++static loader thread safty
make it sync before deleting the loaders.
2025-04-02 14:40:54 +09:00
Benson Muite
e64e0c62ba Update CONTRIBUTORS
Add Benson Muite as a contributor
2025-04-02 13:56:27 +09:00
Hermet Park
a9cd630dfd lottie: code refactoring
- aligned the property types with the class types.
- removed tempaltes, since property types are deterministic.
2025-04-02 00:40:03 +09:00
Hermet Park
dadd7a93dd Update README.md
added references
2025-03-31 23:33:42 +09:00