Commit graph

77 commits

Author SHA1 Message Date
Hermet Park
558a9991de lottie: improve the compatiblity
merge the scene with more accurate condition to allow
the evenodd pathes among the lottie render tree.
2025-04-03 22:17:03 +02:00
Hermet Park
6708fae17b common: ++loader thread safety
fortitfy the thread safety
in multi-threaded resource loading.

issue: https://github.com/thorvg/thorvg/issues/3306
2025-04-03 21:09:21 +02:00
Jinny You
dec4b141ec lottie/slot: fix potential memory leak when overriding twice
Co-Authored-By: Hermet Park <hermet@lottiefiles.com>
2025-03-12 20:26:39 +01:00
Mira Grudzinska
589e93fa74 lottie: parsing embedded fonts data (#3220)
Only parsing and font loading is added with
a very basic text update while building the scene.

@Issue: https://github.com/thorvg/thorvg/issues/3184
2025-03-12 02:10:32 +01:00
Jinny You
1ae817b634 lottie/slot: Support transform slot overriding
issue: https://github.com/thorvg/thorvg/issues/2591
2025-01-16 16:11:55 +01:00
Hermet Park
1fa30d9321 lottie: ++slot overriding
- fixed the ommiting the duplicate keyframe data overriding
- code refactoring

issue: https://github.com/thorvg/thorvg/issues/2988
2024-11-26 01:19:54 +09:00
Mira Grudzinska
b3c1c33285 lottie: shapes support in text range selector
@issue: #2178
2024-11-26 01:18:59 +09:00
Mira Grudzinska
483b40c78e lottie: easing support in text range selector
@issue: #2178
2024-11-26 01:18:53 +09:00
Hermet Park
1779689f03 lottie: Fixed a regression bug
Reverted commit db800c8d45,
which introduced another regression that omitted support
for multiple image asset references.

Updated the data of active images in the pooler
within the override() function to resolve the issue.
2024-11-19 01:01:34 +09:00
Hermet Park
a989dc9a7d lottie: fixed a memory leak
A regression bug by efe7440fa0

To address this, removed the non-essential image pooling mechanism.

issue: https://github.com/thorvg/thorvg/issues/2959
2024-11-18 23:42:04 +09:00
Hermet Park
88098f547f lottie: corrected an omission in overriding the default slot
issue: https://github.com/thorvg/thorvg/issues/2953
2024-11-18 23:40:37 +09:00
Jinny You
98fbc90f9b lottie/slot: Support image overriding 2024-11-18 23:39:28 +09:00
Mira Grudzinska
d37ab3b39f lottie: maxAmount support in the text range selector
@issue: #2178
2024-11-18 23:35:40 +09:00
Mira Grudzinska
76206a174e lottie: smoothness support in the text range selector
@issue: #2178
2024-11-18 23:35:31 +09:00
Mira Grudzinska
606e107712 lottie: text range selector++
Change in the algorithm for selecting characters included
in the range selector. This is the first step towards adding
support for maxAmount, smoothness, and easing.

@Issue: https://github.com/thorvg/thorvg/issues/2178
2024-11-18 23:24:58 +09:00
Hermet Park
e954297a64 lottie: improve slots to properly override solid fill opacity 2024-11-09 17:31:19 +09:00
Hermet Park
b5943d627f lottie: multiply opacity to the fill alpha value,
opacity of a shape may bring a composition
when it has both stroke and fill
2024-10-22 00:40:06 +09:00
Hermet Park
2b3a2e5ddf lottie: fixed a corrupted colorstop population
the color stop number should be retained during
the population of frames

issue: https://github.com/thorvg/thorvg/issues/2765
2024-10-03 16:33:16 +09:00
Mira Grudzinska
1c48cd3cdc lottie: fix gradient populating
When populating the gradient, the color/alpha should
be assigned the first possible value from the provided
ones, rather than the default value of 255.
2024-10-03 12:39:46 +09:00
Hermet Park
ab8b4ef73e lottie: support layer effect & gaussian blur
issue: https://github.com/thorvg/thorvg/issues/2718
2024-09-30 16:44:22 +09:00
Hermet Park
d2c89a5f2d lottie: --type casting warning in MSVC 2024-09-30 16:44:22 +09:00
Jinny You
c10c713c05 lottie/text: applied Text Range randomization.
on each parse, if the `randomize` is enabled,
the start and end of the Text Range are redefined
with the same gap as the original range.

issue: https://github.com/thorvg/thorvg/issues/2178
2024-09-30 16:44:22 +09:00
Mira Grudzinska
ec4b08245c lottie: handle trim path edge cases
According to the definition of trim path elements,
the begin and end values are specified as percentages
in the range of 0-100% (this is also confirmed by AE,
where it's not possible to exceed this range).
Added clamping to align with spec.
2024-09-30 16:44:22 +09:00
Mira Grudzinska
362b51028d lottie: fix trim path regression
To avoid editing the trim path values provided
by the user, the logic for their interpretation
was moved from the API to the renderer (7c87d8e).
This caused an issue in the lottie animations when
the trim path is applied more than once. Now fixed.

@issue: https://github.com/thorvg/thorvg/issues/2670
2024-09-30 16:44:22 +09:00
Hermet Park
9f5a83f067 lottie: ++scene rendering optimization
Apply LottieRenderPooler to maskings.
2024-09-30 15:53:02 +09:00
Hermet Park
2478a5f65a lottie/expressions: feature support enhancement
- revised the transformation building logic.
- rectified to properly search "this" composition layers.
- rectified the linear interpolation implementation.
- added "pingpong" looping attributes.
2024-09-30 15:38:05 +09:00
Hermet Park
4e3d027fa7 lottie: code refactoring
- removed unnecessary variables.
- migrated the composition methods to the precomp layer.
2024-09-30 15:38:00 +09:00
Hermet Park
d7e4fc7d6a lottie: ++optimization with object culling
More precisely, culling the render objects by
determining if the group has no renderable objects.

Additionally, check opacity to quickly return
in the rendering process.
2024-09-30 15:37:40 +09:00
Hermet Park
699063625b lottie: ++scene rendering optimization
Apply LottieRenderPooler to path/rect/ellipse/polystar.

This enhances the animation performance: ~10%
2024-09-30 15:34:57 +09:00
Hermet Park
ba3d2b77a1 lottie: introduced LottieRenderPooler
LottieRenderPooler is designed to manages rendering
instances(paints) efficiently through a simple pooling
mechanism to resuse among the animations

This replaces the previous individusal paints implemenations
among solidfill, precomp vierport and pictures,
also fix a potential paints corruption problems.
2024-09-30 15:33:49 +09:00
Hermet Park
43a5bf2fce lottie: ++ scene composing optimization
retain resuable layer solid paint during animation.
2024-09-30 15:29:22 +09:00
Hermet Park
3adee7238c lottie: ++ scene composing optimization
retain reusable precomp clipper shapes during animation.
2024-09-30 15:29:22 +09:00
Hermet Park
12d0504a23 common: replace the round() with nearbyint()
nearbyint() is 2x faster than round() in our local test.
2024-09-30 15:24:39 +09:00
Hermet Park
c9d1df3957 common/math: code refactoring
Replaced the prefix "math" with "tvg" namespace.
2024-09-30 15:22:38 +09:00
Hermet Park
d3a900701f common/math: introduced custom atan2()
the custom atan2 algorithm by Remez.
see: https://en.wikipedia.org/wiki/Remez_algorithm

This improved the Lottie example by ~2ms.
Total atan2 performance time was reduced by 43%
2024-09-30 15:21:27 +09:00
Hermet Park
dd0705eef9 lottie: allow image asset sharing among LottiePicture instances
Previously, the Lottie builder didn't account for image asset sharing
among multiple layers. This update rectifies the situation.

issue: https://github.com/thorvg/thorvg/issues/2428
2024-09-30 12:48:08 +09:00
Josh Soref
e3c66db301 common: fix 178+ spelling errors 2024-09-30 12:41:38 +09:00
Mira Grudzinska
e6f4b5a2a8 common: strokeTrim api introduced
New api sets/gets the trim of the stroke
along the defined path segment, allowing
control over which part of the stroke is
visible.

@issue: https://github.com/thorvg/thorvg/issues/2190
2024-06-24 14:37:53 +09:00
Hermet Park
53f2a3f10b lottie: try packing data compactly. 2024-06-24 14:35:40 +09:00
Hermet Park
33883f302d lottie: optimize the internal data
encode the object name with the hash value
to save memory and enable fast data comparison.
2024-06-24 14:35:34 +09:00
Mira Grudzinska
b812277a06 lottie: add 'tp' tag support
So far it hasn't been possible to specify
a matte layer - by default, it was the layer
above the calling layer. The 'tp' tag support
has been introduced, enabling referencing any
layer by its index.
In cases where the layer referencing the matte
was the first one, a segmentation fault was
observed. This issue has now been resolved.

@Issue: https://github.com/thorvg/thorvg/issues/2325
2024-06-24 14:34:34 +09:00
Hermet Park
5c48127012 lottie: code clean up
- remove an unused return value.
- move bodies from header to implementation file.
- no logical changes.
2024-06-24 14:29:29 +09:00
Hermet Park
eeb06870a0 lottie: fixed a memory leak
Free the children data properly,
rarely observerd this, only when a layer is hidden.
2024-06-24 12:36:47 +09:00
Hermet Park
9cff11f25e lottie/expressions: apply expressions to missing properites. 2024-06-24 12:32:57 +09:00
Hermet Park
709ef9158f lottie: support the expression feature
The current development of the expression engine is experimental.
It does not support multi-threading.

Therefore, when tvg::Initializer::init() is configured
with more than one thread, expressions will be automatically disabled.

issue: https://github.com/thorvg/thorvg/issues/1640
2024-06-24 12:29:17 +09:00
Hermet Park
bfed28e86e common: code refactoring
introduced mathDeg2Rad() and mathRad2Deg() for a common implementation.
2024-06-24 12:12:19 +09:00
Lucas Niu
194bd8f01d lottie: Support the Animation Segment(Marker)
A single animation might have a desinated markers with naming: 0 ~ 0.5 (sector A), 0.5 ~ 1.0  (sector B). Selecting one of them using a marker name(sector A) and could play only that part with animation controllers.

usage:
- `animation->segment("sectionA") // Named segment(Marker)`
- `auto cnt = animation->markerCnt()`
- `auto name = animation->markers(index)`
- `animation->segment(0, 0.5) // Segment`
- `animation->segment(&begin, &end)`

Co-authored-by: Jinny You <jinny@lottiefiles.com>
2024-06-24 12:00:25 +09:00
Hermet Park
ecee01ebd6 lottie: Properly handle the TrimPath mode.
This correction addresses the drawing order of
objects when a group contains a TrimPath and
is merging shapes.

Additionally, the TrimPath method is can applied
to the engine to control the drawing behavior by
7f3dc541d6b7abcdc03facd884489f37c327fd98

issue: https://github.com/thorvg/thorvg/issues/2047
2024-04-06 12:48:30 +09:00
Hermet Park
40647d5882 lottie: optimize the rendering by preventing partial rendering branches.
this optimization is to figure out if this group is a simple path drawing.
In that case, the rendering context can be sharable with the parent's.
2024-04-06 12:08:23 +09:00
Hermet Park
736a79674b lottie: code refactoring.
removed unused static condition.

static was prepared for optimization,
but not used at all.

we will revisit this later when time permits.

binary size: -6kb
2024-04-06 12:08:23 +09:00