Commit graph

143 commits

Author SHA1 Message Date
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
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
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
1e1be53136 lottie: --compiler warnings on clang
removed uninitialized value and override marks
2025-03-28 01:33:57 +09:00
Hermet Park
3136cac6e4 Revert "lottie: minor optimization"
This reverts commit 51bc7e81f8.

note: side effect!
2025-03-26 20:56:24 +09:00
Hermet Park
51bc7e81f8 lottie: minor optimization
trim out a group when it has only one child.
2025-03-26 00:28:20 +09:00
Hermet Park
5de098f128 lottie: suppport writable expressions
This function sets the value of a specified expression variable within a particular layer.
It is useful for dynamically changing the properties of a layer at runtime.

Experimental API
- Result LottieAnimation::assign(const char* layer, uint32_t ix, const char* variable, float value)
- Tvg_Result tvg_lottie_animation_assign(Tvg_Animation* animation, const char* layer, uint32_t ix, const char* var, float val)
2025-03-24 12:11:15 +09:00
Mira Grudzinska
ac080ffabc lottie: add support for text follow path
Added support for cases without text grouping and range selector.

Co-Authored-By: Hemet Park <hermet@lottiefiles.com>

@Issue: https://github.com/thorvg/thorvg/issues/2888
2025-03-12 13:08:26 +09:00
Jinny You
0e76ba3e47 lottie/slot: Support expressions overriding
issue: #3168

Co-Authored-By: Hermet Park <hermet@lottiefiles.com>
2025-03-10 12:42:12 +09:00
Hermet Park
96dc3d6697 common: str refactoring
renamed the prefix to be slimmer and more compact.
2025-03-06 12:18:24 +09:00
Hermet Park
3c836b1b2a lottie: revise the text justify logic
removed the duplicate logic,
improved for neat and easy maintainance
2025-03-04 15:15:06 +09:00
Hermet Park
82a9a05405 common: replace the strdup() with strDuplicate()
tvg expects the coherent memory allocator usage,
while strdup() is out of the control. so replaced it.
2025-02-28 12:04:53 +09:00
Hermet Park
b77f3ca024 common: introduced designated memory allocators
Support the bindings to be more integrable with a system's coherent memory management.

Pleaes note that thorvg now only allow the desinated memory allocators here:
malloc -> tvg::malloc
calloc -> tvg::calloc
realloc -> tvg::realloc
free -> tvg::free

issue: https://github.com/thorvg/thorvg/issues/2652
2025-02-18 17:20:31 +09:00
Mira Grudzinska
ad261731b6
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-02-14 15:52:10 +01:00
Hermet Park
305da05b1b lottie: resolved minor memory leaks 2025-02-14 00:31:14 +09:00
Mira Grudzinska
391777091c lottie: ++ dashed stroke support
Until now lottie loader supported only a single
dash-gap pair, and only the case where only the dash
was provided was handled correctly. When both values
were provided, the gap was incorrectly increased by
the dash value. If more values were supplied, only
the last pair was considered.

@Issue: https://github.com/thorvg/thorvg/issues/3191
2025-02-13 23:37:32 +09:00
Fabian Blatz
71bb4163ed common: fixed double-precision promotion compilation warnings
Co-Authored-By: Hermet Park <hermet@lottiefiles.com>
2025-02-12 20:23:34 +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
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
07e73a9e6f common: code refactoring
use ARRAY_FOREACH() for neat code and
accessing the memory efficiently than normal indexing.
2025-01-15 18:03:46 +09:00
Mira Grudzinska
096b834771 lottie: fix text stroke's 'of' property
The text stroke's 'of' property determines whether
the stroke appears above (true) or below (false)
the fill.
Previously, it was incorrectly used to decide whether
the stroke would render.

@Issue: https://github.com/thorvg/thorvg/issues/3126
2025-01-15 14:13:47 +09:00
Jinny You
22872a7dd5 lottie/slot: Support transform slot overriding
issue: https://github.com/thorvg/thorvg/issues/2591
2025-01-07 16:03:37 +09:00
Hermet Park
a12accbc93 updated copyright 2025-01-03 14:32:31 +09:00
Hermet Park
75a4c7f543 api: aligned enum values with the lottie spec
Please note that this could occur ABI break.
2024-12-27 21:16:27 +09:00
Hermet Park
0e9bc74603 api: renamed FillRule::Winding to NonZero
aligned the name with the web standard.
2024-12-27 21:16:27 +09:00
Hermet Park
b041bdab4a lottie: support stroke layer effect
issue: https://github.com/thorvg/thorvg/issues/2718
2024-12-26 18:40:40 +09:00
Hermet Park
838785d75a lottie: revise the masking logic
- Allow the masking data even though they were mask None mode.
  Those will be used by the layer stroke effect.
- Fixed masking Offset to apply to all masking chains.
- Optimized fast track masking with resolving the opaicty condition.
- Clean up the overall code.
2024-12-18 23:51:47 +09:00
Hermet Park
17fd454459 lottie: support Tritone LayerEffect
issue: https://github.com/thorvg/thorvg/issues/2718
2024-12-18 14:37:30 +09:00
Hermet Park
1eff126b40 lottie: support Tint LayerEffect
issue: https://github.com/thorvg/thorvg/issues/2718
2024-12-17 12:16:44 +09:00
Hermet Park
a0a7ec25a2 lottie: support Layer Effect Fill type
During the fill properties, only color/opacity is available.
Not support other properties since they are unclear spec now.

issue: https://github.com/thorvg/thorvg/issues/2718
2024-12-12 18:50:33 +09:00
Hermet Park
e34ba91ff1 lottie: code refactoring
removed a unused parameter.
2024-12-12 13:38:55 +09:00
Mira Grudzinska
6b416409c3 lottie: add TextCaps property support 2024-12-06 00:40:48 +09:00
Hermet Park
af7dbf2277 lottie: ++parser stability
fixed a parsing failure that occurred
when a desired single value was presented as part of an array.

issue: https://github.com/thorvg/thorvg/issues/2975
2024-11-27 16:54:33 +09:00
Hermet Park
951ea77f5d lottie: compact code++
use constructor to remove unnecessary function call
2024-11-26 01:11:03 +09:00
Hermet Park
e811a513f2 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:11:03 +09:00
Mira Grudzinska
a6fb2ef9a7 lottie: easing support in text range selector
@issue: #2178
2024-11-21 01:05:11 +09:00
Hermet Park
b7888c2ff3 lottie: --minor memory leak 2024-11-19 01:55:38 +09:00
Mira Grudzinska
a0f1c2d99d infra: prevent warning on windows
"conversion from 'float' to 'int8_t', possible loss of data"
2024-11-18 19:03:30 +09:00
Jinny You
931d0748bb lottie/slot: Fix incorrect image slot schema
Issue: #2964
2024-11-18 19:01:10 +09:00
Hermet Park
0b0488df82 lottie: corrected an omission in overriding the default slot
issue: https://github.com/thorvg/thorvg/issues/2953
2024-11-18 16:59:17 +09:00
Jinny You
efe7440fa0 lottie/slot: Support image overriding 2024-11-15 17:56:42 +09:00
Hermet Park
d8fa8f364c lottie: improve slots to properly override solid fill opacity 2024-11-09 17:28:56 +09:00
Hermet Park
f84b2331da lottie: support default slot overriding
issue: https://github.com/thorvg/thorvg/issues/2915
2024-11-09 17:28:52 +09:00
Hermet Park
2ad6753680 lottie: support drop shadow effect
issue: https://github.com/thorvg/thorvg/issues/2153
issue: https://github.com/thorvg/thorvg/issues/2718
2024-11-06 00:56:11 +09:00
Hermet Park
87761dc7c7 lottie/slot: revise gradient fill support
Revise gradient fill data parsing by adding support
for the color stop count (p) parameter in slot data.

issue: https://github.com/thorvg/thorvg/issues/2795
2024-11-04 11:43:36 +09:00
Hermet Park
c75ec0f333 lottie: code clean up 2024-11-01 22:44:39 +09:00
Jinny You
4f2e725da0 lottie/text: Support text alignment options
Introduced new properties:
- group alignment
- text grouping (words, line)

Issue: #2178
2024-11-01 22:11:45 +09:00
Hermet Park
f1cd65a876 lottie: corrected a shallow keyframe data copy bug
The previous assignment operator was missed due to a template error,
which has now been corrected.

issue: https://github.com/thorvg/thorvg/issues/2797
2024-11-01 12:40:38 +09:00
Mira Grudzinska
d9bbd433e8 lottie: correct the array reserved size
The color input will contain at least colorStops.count * 4
elements (not including alpha). Since the alpha offset values
don't have to much colorStops, estimation is used.
2024-10-18 12:10:11 +09:00