Commit graph

3531 commits

Author SHA1 Message Date
Mira Grudzinska
927fd537e5 lottie: fix & enhance parsing
The object type key does not need to be provided
first. Previously, content was skipped until the
"ty" type key was found. If the key was placed at
the end, the entire object was ignored.
Now, before parsing subsequent elements, finding
the "ty" key is enforced. Since in-situ parsing
does not support backtracking, the key is searched
with an internal function.

Introducing support for the "ty" key placed anywhere
highlighted the use of redundant logic for parsing
the list of shapes — this duplicate logic has been
removed.
2025-02-07 13:03:40 +01:00
Hermet Park
c1290a8205 doc: up-to-date CONTRIBUTION guide 2025-02-07 13:04:19 +09:00
Mira Grudzinska
d5125bd839 common: add missing condition while trimming
The idea of introducing epsilon during trimming was to
eliminate the occurrence of short segments whose length
would be zero when higher computational accuracy was used.
By mistake, during the refactor of 8ed4c2f302,
one of the conditions was lost. Fixed.

@Issue: https://github.com/thorvg/thorvg/issues/3053
2025-02-07 12:43:38 +09:00
Hermet Park
37c4ace685 infra: rectify the meson build command to meet the standard. 2025-02-07 12:35:24 +09:00
Mira Grudzinska
3a0e1eadae gl_engine: apply common trimming logic
The trim-related implementation has been removed
and replaced with the one available in common.
The trimPath get() fun changed to be internal.

@Issue: https://github.com/thorvg/thorvg/issues/2854
@Issue: https://github.com/thorvg/thorvg/issues/3053
2025-02-06 22:39:11 +09:00
Mira Grudzinska
cb8cadfbba wg_engine: apply common trimming logic
The trim-related implementation has been removed
and replaced with the one available in common.

@Issue: https://github.com/thorvg/thorvg/issues/2854
2025-02-06 22:39:11 +09:00
Mira Grudzinska
8ed4c2f302 sw_engine: move trimming logic to TrimPath
The trim handling from sw_engine has been removed.
Instead the common logic from the TrimPath structure
is used.
On the sw_engine side, the dashed outline is now
used for both: dashed and/or trimmed strokes.

@Issue: https://github.com/thorvg/thorvg/issues/2854
2025-02-06 22:39:11 +09:00
Mira Grudzinska
669d6dc580 common: introduce TrimPath struct
The first step towards unifying trimming across engines.

@Issue: https://github.com/thorvg/thorvg/issues/2854
2025-02-06 22:39:11 +09:00
Hermet Park
4f0f2e4c08 example: removed interaction sample
LottieTweening is replaced with it.
2025-02-06 19:09:27 +09:00
Hermet Park
be0949339c example: added lottie tweening sample 2025-02-06 19:09:27 +09:00
Hermet Park
78cfc33f4c lottie: support frame tweening feature
frame tweening allows user to interpolate two frames
over a speicified duration. This Tweening functionality
can be particularly powerful when combined with state-based
(a.k.a. Marker) animation playback in Lottie.

For example, apps support state machine based animations,
where the transition sequences between states are not linear
and can occur in highly irregular directions.

Experimental APIs:
- Result LottieAnimation::tween(float from, float to, float progress)
- Tvg_Result tvg_lottie_animation_tween(Tvg_Animation* animation, float from, float to, float progress)
2025-02-06 19:09:27 +09:00
Hermet Park
0dd0a3b45c common: neat code++
introduced common BBox structure
2025-02-06 15:40:32 +09:00
Sergii Liebodkin
857f1404e1 wg_engine: gaussian blur basic implementation
Introduce blur effect for webgpu renderer
Issue: https://github.com/thorvg/thorvg/issues/3054
2025-02-06 14:44:08 +09:00
Hermet Park
04530ab6c2 doc: updated svg sample image 2025-02-06 13:53:16 +09:00
Hermet Park
1d90608edc lottie: chores++ 2025-02-06 12:21:16 +09:00
Hermet Park
2a4dfcd10e lottie: revised the shape modifiers
- use a decoration style for path-modification chaining.
- use a reusable buffer for intermediate path generation.
2025-02-06 12:21:16 +09:00
Hermet Park
f4a2c922be lottie: minor optimization
use a reusable buffer for intermediate path generation.
2025-02-06 12:21:16 +09:00
Hermet Park
4edaf311c6 lottie: ++compact & neat code
introduced RenderPath to minimize the path parameters.
2025-02-05 19:55:12 +09:00
Hermet Park
35dac266dd lottie: neat code++ 2025-02-05 15:15:01 +09:00
Hermet Park
8add23dd3a lottie: allow expressions for the text properties 2025-02-05 14:26:44 +09:00
Hermet Park
3e337083e8 lottie: compact code & size++ 2025-02-04 23:07:56 +09:00
Hermet Park
8833cc8521 commmon: ++neat code
introduced ARRAY_REVERSE_FOREACH() macro.
2025-02-03 21:47:43 +09:00
Mira Grudzinska
580019b64b gl_engine: fix color burn/dodge edge cases
Aligned with sw_engine implementation.
2025-02-03 15:06:39 +09:00
Mira Grudzinska
e7e168a28b wg_engine: fix color burn/dodge edge cases
Aligned with sw_engine implementation.
2025-02-03 15:06:39 +09:00
Mira Grudzinska
41f10b9702 sw_engine: fix color burn/dodge edge cases
Dodge d / (1 - s):
- handle d = 0 first to avoid 0/0 when s = 1
- for d != 0 and s = 1, the formula results in d/0 (infinity),
  which maps to 1 in the 0-1 range (or 255 in the 0-255 range)

Burn 1 - (1 - d) / s:
- handle d = 1 first to avoid 0/0 when s = 0
- for d != 1 and s = 0, the formula results in  1 - 0/0 -> 1 - inf = -inf
  Negative infinity in the 0-1 range corresponds to the minimum possible
  value, which is 0 (255 if we operate in 0-255 range).
2025-02-03 15:06:39 +09:00
Mira Grudzinska
9c864f3e99 common: more accurate clipped viewport rounding
Replaced ceil and direct casts with nearbyint to improve
viewport size calculation. This ensures consistent
approach with the fastTrack case in sw_engine.

@Issue: https://github.com/thorvg/thorvg/issues/3148
2025-02-03 14:54:03 +09:00
Popolon
02be99185e include <cstring> in examples/Example.h 2025-02-03 11:23:34 +09:00
Hermet Park
746ca7f58b renderer: hotfix a nullptr memory copy 2025-01-30 23:18:28 +09:00
Hermet Park
6a7e6966c3 lottie: code refactoring++
improved readability and maintenance by separating
the path modifier from the default path operation.
2025-01-29 23:25:46 +09:00
Hermet Park
f8da536d1a lottie: code refactoring++
Unified the property expression and default version.
This also helps to reduce the binarys size (O3=4k, S=360kb)
2025-01-29 23:25:46 +09:00
Hermet Park
2b97cf7a0d lottie: code refactoring++
renamed internal variable for improved simplicity.
no logical changes.
2025-01-29 23:25:46 +09:00
Hermet Park
a67f90951c lottie: clean up code for maintenance
Point/Position is too ambuguous to classify,
Renamed them to LottieScalar and LottieVector,
and unify the duplicate logic among them.
2025-01-29 02:38:19 +09:00
Mira Grudzinska
c5ae9a5045 api: fix typo 2025-01-28 23:12:57 +09:00
Sergii Liebodkin
0ecd2c0fd4 engine: introduce scene effect dispose render method
to correctly remove RenderDate from effects it must be removed in the renderer
a new method has been added to the RenderMethod interface
2025-01-26 10:13:28 +09:00
Hermet Park
ebe4935dd0 lottie: revise the effect parsing logic
Unify the common parts of the parsing logic
by applying a strategy pattern,
allowing the behavior to vary based on the effect type.

This helps to reduce the size and improved the parsing safety.
2025-01-25 02:43:17 +09:00
Sergii Liebodkin
83eb89c5c9 wg_engine: fix segmentation fault on windows with SVG examples
Some SVG files fails during tesselation on windows.
Fixed
2025-01-24 20:48:08 +09:00
Hermet Park
b8f2e3815a sw_engine: ++reference info 2025-01-23 12:32:31 +09:00
Mira Grudzinska
56799beefd
svg_loader: loc-- (#3149)
* svg_loader: loc--

Removed unnecessary initialization of variables
to 0.0/false/nullptr in memory allocated by calloc.
2025-01-22 13:25:24 +01:00
Mira Grudzinska
758aa932d7 gl_engine: add support for stroke/fill ordering 2025-01-22 16:24:29 +09:00
Hermet Park
97f85d44cb example/interaction: chores++ 2025-01-22 13:22:24 +09:00
Hermet Park
fdd760a34f api: revised the animation segment specification
Changed the unit of the segment from a normalized value to frame numbers,
ensuring alignment with other frame control interfaces.

Note that This change may break backward compatibility.

issue: https://github.com/thorvg/thorvg/issues/3116
2025-01-22 13:03:48 +09:00
Abdelrahman Ashraf
53487421b5 chore(build): exclude webgpu_native for emscripten build
- Add platform check to exclude webgpu_native in meson.build
- Avoid requiring -Dbindings=wasm_beta for Emscripten builds
2025-01-21 22:55:15 +09:00
Hermet Park
3a3041a276
Update README.md 2025-01-21 13:25:57 +09:00
Hermet Park
6e0a8c9201
Update README.md 2025-01-21 13:17:24 +09:00
Hermet Park
7f6af7ebe6 svg: ++readability
!strcmp() -> STR_AS()
2025-01-21 12:41:31 +09:00
Mira Grudzinska
fbdc958623 svg: added filter and gaussian blur nodes support
@Issue: https://github.com/thorvg/thorvg/issues/1367
2025-01-20 17:24:06 +01:00
Hermet Park
b79d12a04d gl_engine: hotfix memory leak
issue: https://github.com/thorvg/thorvg/issues/3140
2025-01-20 21:27:06 +09:00
Mira Grudzinska
5752e75ff9 wg_engine: fix bug introduced in 07e73a9
Fixed loop condition.
2025-01-20 21:25:22 +09:00
Hermet Park
868a085262 lottie: expressions compactness++
expressions is an optional feature,
do not prepare expressions if the engine doesn't support it.
2025-01-20 19:24:46 +09:00
Hermet Park
44075aa0f0 sw_engine: Improved the blur performance by 12%
Applied the compromised approach for the gaussian blur
since the effect is a bit burdensome for cpu processing
as animatable effects.

- Optimized performance and quality with negligible observable differences.
- Disabled the border option until specific use cases are identified.
2025-01-20 17:46:53 +09:00