Commit graph

890 commits

Author SHA1 Message Date
Jinny You
d88731498b lottie/text: Support Text Based
Added support for Text Based of Text Range Selector, by processing further properties:
2. Character Excluding Spaces
3. Words
4. Lines

see: https://github.com/thorvg/thorvg/issues/2178
2024-09-12 22:11:34 +09:00
Mira Grudzinska
0bcedd2f44 svg_loader: fix text nodes issue
Since the text node wasn't pushed onto the loader's stack,
closing the text node incorrectly caused an element to be
popped from the stack (if one was present).
This could result in elements that were supposed to have
that element as a parent being rendered incorrectly or not
being rendered at all.
Now, the text node is correctly pushed onto the stack.

@Issue: https://github.com/thorvg/thorvg/issues/2706
2024-09-06 00:01:29 +09:00
Hermet Park
9dbe141058 lottie/parser: ++ null value handling
Note that, only dealt with a obivous case in practice.

issue: https://github.com/thorvg/thorvg/issues/2703
2024-09-06 00:00:31 +09:00
Łukasz Pomietło
251ec5586b loader/ttf: Spaces and invalid glyphs rendering fix
If for any reason an invalid glyph is found in text, 
it will now be skipped when rendering 
(instead of increasing offset by last valid glyph advance).

Issue: #2687
2024-09-06 00:00:24 +09:00
Mira Grudzinska
bd87d136a5 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-05 23:59:52 +09:00
Hermet Park
c30447be98 lottie/expressions: rectified $bm_sum()
Added only a single element to x.
2024-08-30 01:01:47 +09:00
Hermet Park
354533c922 lottie/expressions: hotfix a crash
Stabilized $bm_sum(), by allowing the different dimensional
arguments.

issue: https://github.com/thorvg/thorvg/issues/2664
2024-08-30 01:01:40 +09:00
JunsuChoi
244e61205c svg_loader: Adjust hsl values out of range
The range of saturation and brightness values is 0 ~ 100% and range of hue is 0 ~ 360.
If a value greater than 100% is loaded, it will be modified to be 100%.

issue: https://github.com/thorvg/thorvg/issues/2678
2024-08-30 01:01:32 +09:00
Mira Grudzinska
0751b14186 lottie: fix trim
The bug caused the trim path to not be applied
when it appeared in a group between different
shapes.
2024-08-30 01:00:59 +09:00
Mira Grudzinska
bd5728a140 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-08-30 01:00:52 +09:00
Łukasz Pomietło
f324cc993d renderer/text: fix a missing text update
previously font size & italic style had been ignored
even if its attributes are changed.

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

issue: https://github.com/thorvg/thorvg/issues/2676
2024-08-30 01:00:42 +09:00
Hermet Park
223a07d0d2 lottie/jerryscript: ++build reliance 2024-08-30 00:56:48 +09:00
Mira Grudzinska
660484b12b lottie: add offsetPath support
Due to the lack of an analytical solution for Bezier
curves offsetting, a simple and computationally cheap
approximation has been implemented. The algorithm shifts
the segments connecting control points and determines
new points based on their intersections.

@issue: https://github.com/thorvg/thorvg/issues/2230
2024-08-23 10:56:23 +09:00
Mira Grudzinska
b521eee2be lottie: roundness refactored based on #2295 2024-08-23 10:50:43 +09:00
Mira Grudzinska
73fd8015f7 lottie: fix text update
The occurrence of a 'carriage return' (13) or 'end of text' (3)
caused the skipping of the next character check, immediately
searching for it in the list of available characters.
If the next character was also 13 or 3, it led to incorrect
interpretation; however, if it was the last character in the
sequence, a crash occurred.
2024-08-23 10:46:15 +09:00
Hermet Park
65c808fc02 common: spec out TexMap
Spec out this incomplete experimental feature,
this is a still promising one, we will reintroduce
this officially after 1.0 release

size: -2kb

issue: https://github.com/thorvg/thorvg/issues/1372
2024-08-23 10:45:14 +09:00
Hermet Park
ac729068f5 lottie: ensure a null terminator at the end of the copied data
In certain cases, the user might want to set mapped memory directly.
This update ensures that a null terminator is appended to the string data.

Co-Authored-By: Mira Grudzinska <mira@lottiefiles.com>

Issue: https://github.com/thorvg/thorvg/issues/2642
2024-08-23 10:35:23 +09:00
Mira Grudzinska
183b67b967 lottie: prioritization of roundness in rectangles
Added prioritization of rectangle roundness over
rounded corners, in line with AE results.
2024-08-15 23:18:51 +09:00
Mira Grudzinska
4af3825bc3 lottie: handle edge case for rounded rect
For rounded rectangles the roundness value should
be determined using to the formula:
r = min(r, max(size.x, size.y)/2)
rather than the previous method:
r = min(size.x/2, size.y/2, r)
2024-08-15 23:14:19 +09:00
Hermet Park
9fe0b001d6 lottie: code refactoring
getting too many parameters,
migrated static functions to class member functions,
reducing the binary size by 2KB

no logical changes
2024-08-15 23:14:04 +09:00
Hermet Park
331ea0cae3 lottie: ++scene rendering optimization
Apply LottieRenderPooler to RenderContext propagators.
2024-08-15 23:13:52 +09:00
Hermet Park
142cb05e63 lottie: ++scene rendering optimization
Apply LottieRenderPooler to maskings.
2024-08-15 23:10:27 +09:00
Mira Grudzinska
7e19a960d8 lottie: handle rounded polygons
The implementation of rounded polygons was
mistakenly omitted, now has been added.

@Issue: https://github.com/thorvg/thorvg/issues/2624
2024-08-15 23:10:15 +09:00
Hermet Park
96c8c17d33 lottie: support matte+masking combination
introduced an intermediate scene for embracing
the matte and maskings
2024-08-09 11:33:38 +09:00
Hermet Park
e0e00fe6fe lottie/expressions: rectified fill color support
Assign the fill color value properly.
2024-08-09 11:33:38 +09:00
Hermet Park
b40ef5b6a9 lottie: code refactoring
Moved common data declarations to tvgLottieCommon.h.
2024-08-09 11:33:38 +09:00
Hermet Park
8da5d0663a lottie/expressions: revised exception handlings 2024-08-09 11:33:38 +09:00
Hermet Park
82d8601df0 lottie/model: implement the missing property() interface 2024-08-09 11:33:38 +09:00
Hermet Park
7ec8d2f392 renderer/picture: added a method to search for a paint object
This utility method allows access to a specific paint instance
by its unique identifier.

Experimental API:
- const Paint* Picture::paint(uint32_t id)
- const Tvg_Paint* tvg_picture_get_paint(Tvg_Paint* paint, uint32_t id)
2024-08-09 11:33:38 +09:00
Hermet Park
e082602064 API: introduce a Paint ID member as a reserved field
The "id" is a reserved field to specify a paint instance in a scene.
in this change, it assigns the layer id to the lottie scene as well.
2024-08-09 11:33:38 +09:00
Hermet Park
b20d5da552 renderer: newly support the Lighten/Darken Masking options
Lighten is applied, where multiple masks intersect,
the highest transparency value is used.

Darken is applied, where multiple masks intersect,
the lowest transparency value is used.

Experimental API:
- CompositeMethod::LightenMask
- CompositeMethod::DarkenMask

issue: https://github.com/thorvg/thorvg/issues/2608
2024-08-09 11:33:38 +09:00
Hermet Park
52f68b79b6 lottie/expressions: add missing expressions property updates
apply expressions to separate x/y transform coordinates.
2024-08-09 11:33:38 +09:00
Hermet Park
a5f69a9bbc lottie: remove useless condition check.
lottie is always animatable.
2024-08-09 11:33:38 +09:00
Hermet Park
a85f323425 lottie/expressions: feature enhancement
added groupIndex() support
added property (ix) value support
2024-08-09 11:33:38 +09:00
Hermet Park
a70c211409 lottie: code refactoring
Access its type from a property instance,
through coherent data structure.
2024-08-09 11:33:38 +09:00
Łukasz Pomietło
045b30b94f ttf_loader: Basic support for composite glyphs loading (#2600)
Adds the ability to load some composite glyphs and prevents an error when a composite glyph is used.

Implementation based on ttf glyf table documentation: https://learn.microsoft.com/en-us/typography/opentype/spec/glyf

There are still some missing features like scaling, parent glyph point based positioning etc. I think this is a topic for future work. Howerever, it looks like implemented features are enough for utf-8 latin subset in major fonts.

issue: #2599
2024-08-09 11:33:33 +09:00
Hermet Park
8c4b9b2772 renderer: code refactoring
Replaced the transformation with
a strong associated data field.

This helps to reduce the binary size (-1k).
2024-08-09 10:49:26 +09:00
Hermet Park
84475df8ab lottie/expressions: hotfix
- fixed a memory leak.
- corrected loopIn key value.
2024-07-26 13:05:37 +09:00
Hermet Park
b95ddd3112 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-07-26 11:37:16 +09:00
Hermet Park
6d97172227 lottie: code refactoring
- removed unnecessary variables.
- migrated the composition methods to the precomp layer.
2024-07-26 11:37:16 +09:00
Hermet Park
771b401f90 svg: resolve compiler warnings.
../src/loaders/svg/tvgSvgLoader.cpp: In function ‘bool _toColor(const char*, uint8_t*, uint8_t*, uint8_t*, char**)’:
../src/loaders/svg/tvgSvgLoader.cpp:108:17: warning: ‘hue’ may be used uninitialized [-Wmaybe-uninitialized]
  108 |     const char* _end = end ? *end : nullptr;
      |                 ^~~~
../src/loaders/svg/tvgSvgLoader.cpp:713:31: note: ‘hue’ was declared here
  713 |         const char *content, *hue, *saturation, *brightness;
      |                               ^~~
../src/loaders/svg/tvgSvgLoader.cpp:108:17: warning: ‘saturation’ may be used uninitialized [-Wmaybe-uninitialized]
  108 |     const char* _end = end ? *end : nullptr;
      |                 ^~~~
../src/loaders/svg/tvgSvgLoader.cpp:713:37: note: ‘saturation’ was declared here
  713 |         const char *content, *hue, *saturation, *brightness;
      |                                     ^~~~~~~~~~
../src/loaders/svg/tvgSvgLoader.cpp:108:17: warning: ‘brightness’ may be used uninitialized [-Wmaybe-uninitialized]
  108 |     const char* _end = end ? *end : nullptr;
      |                 ^~~~
../src/loaders/svg/tvgSvgLoader.cpp:713:50: note: ‘brightness’ was declared here
  713 |         const char *content, *hue, *saturation, *brightness;
      |                                                  ^~~~~~~~~~
2024-07-26 11:37:16 +09:00
Hermet Park
ac7177127a 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-07-26 11:37:16 +09:00
Hermet Park
859cac20dd lottie: hotfix with an intermediate patch merge. 2024-07-26 11:37:16 +09:00
Hermet Park
ecec838006 lottie: ++scene rendering optimization
Apply LottieRenderPooler to texts.
2024-07-26 11:37:16 +09:00
Hermet Park
bd0a7725e0 lottie/expressions: ++coverage enhancement
Allow to access layer index globally.
2024-07-26 11:21:05 +09:00
Hermet Park
e0b2cc462b lottie/expressions: added a missing polystar property build. 2024-07-19 08:43:24 +09:00
Hermet Park
cf253dd873 lottie: ++scene rendering optimization
Apply LottieRenderPooler to path/rect/ellipse/polystar.

This enhances the animation performance: ~10%
2024-07-19 08:41:38 +09:00
Hermet Park
1131695ce4 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-07-19 08:39:53 +09:00
Hermet Park
d13606e14b lottie/parser: tiny binary size reduction 2024-07-19 08:35:18 +09:00
Mira Grudzinska
917917de7a lottie: support 'direction' in ellipses 2024-07-19 08:35:08 +09:00