Commit graph

1018 commits

Author SHA1 Message Date
Hermet Park
dfa05a5c43 common: neat & clean code++ 2025-01-17 00:46:03 +09:00
Hermet Park
2d32c2a45c lottie: updated lottie apis doc
- removed useless return value info.
- removed all beta api tags.
2025-01-16 00:19:10 +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
Hermet Park
1c3b958d5b svg: ++loc reduction 2025-01-14 21:04:45 +09:00
Hermet Park
48c8094d19 api: path api revision for v1.0
Unify the Path commands & pts getters.

C++ API modiciation:
- uint32_t Shape::pathCommands(const PathCommand** cmds) const
- uint32_t Shape::pathCoords(const PathCommand** cmds) const
 -> Result Shape::path(const PathCommand** cmds, uint32_t* cmdsCnt, const Point** pts, uint32_t* ptsCnt)

C API modification:
- Tvg_Result tvg_shape_get_path_coords(const Tvg_Paint* paint, const Tvg_Point** pts, uint32_t* cnt)
- Tvg_Result tvg_shape_get_path_commands(const Tvg_Paint* paint, const Tvg_Path_Commands** cmds, uint32_t* cnt)
 -> Tvg_Result tvg_shape_get_path(const Tvg_Paint* paint, const Tvg_Path_Command** cmds, uint32_t* cmdsCnt, const Tvg_Point** pts, uint32_t* ptsCnt)

issue: https://github.com/thorvg/thorvg/issues/3116
2025-01-14 11:47:28 +09:00
faxe1008
0c09580cd4 common: Use explicit floating-point value types.
Co-Authored-By: Hermet Park <hermet@lottiefiles.com>
2025-01-10 12:16:13 +09:00
faxe1008
9a8173cc22 drenderer: include alloca.h for Zephyr
Changes the conditional for to also include the alloca.h header in case
it is build for the zephyr rtos.
2025-01-10 11:27:59 +09:00
Hermet Park
e72b4e6a9b webp: --compiler warning
warning: writing 4 bytes into a region of size 0 [-Wstringop-overflow=]
2025-01-09 23:45:19 +09:00
Hermet Park
da54c83b5f common/math: revise clamp() aligning with the std style 2025-01-08 13:27:58 +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
Mira Grudzinska
4818c70dd4 svg: specs ++
Completely remove an element if the applied clip/mask is empty.

@Issue: https://github.com/thorvg/thorvg/issues/3089
2025-01-07 11:05:33 +09:00
Hermet Park
a12accbc93 updated copyright 2025-01-03 14:32:31 +09:00
Mira Grudzinska
3643121956 lottie: enforce fill clipper over stroke clipper
After the stroke clipper is introduced, using clipping
requires ensuring that clipping is based on fill rather
than on stroke. Fixed now.

regression by: 324bff30d1
2025-01-03 11:52:38 +09:00
Mira Grudzinska
defec5e43b svg_loader: fix transformation order
If a clip was defined by a use node pointing
to a basic shape subject to transformation, and
the use node itself was translated, the order
of applying these transformations was incorrect.
2025-01-02 17:50:25 +09:00
Hermet Park
7e810ce54d svg: fixed broken clip regression bugs
introduced by 8492a63

https://github.com/thorvg/thorvg/issues/3083
https://github.com/thorvg/thorvg/issues/3082
2024-12-31 12:36:04 +09:00
Hermet Park
5ea1db128e svg: remove styles from the clipPath
Main purpose clippath is to cutout the
drawing region with a path. Otherwise
we need to use MaskMethod.
2024-12-31 12:36:04 +09:00
Jinny You
38a4465656 lottie: fix viewport clipping issue when resize
After resizing an animation, the base clipper for the viewport of the root scene did not update accordingly. This caused the animation to always be clipped by its initial size.

Additionally, this issue introduced a regression in v1 when the `Result Picture::size(float w, float h)` function was called.

issue: https://github.com/thorvg/thorvg/issues/3039
2024-12-30 14:52:42 +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
713840eb42 lottie: Fixed a regression in masking logic
The scene tree should be arranged prior to appending the masking.
This was caused by 838785d75a
2024-12-26 18:13:10 +09:00
Mira Grudzinska
72482877e7 portability: fix file size check on Windows
Resolved an issue where parsing failed due to mismatch
between file size obtained via `ftell` and the actual
bytes read by `fread`. This occurred because newline
translation (`\r\n` to `\n`) in text mode altered the byte
count, leading to incorrect assumptions about the data size.
2024-12-23 01:09:00 +09:00
Hermet Park
285d1427ad common: refactored the scene effect tint
Pre-convert the data type from float to uint8_t
2024-12-20 12:10:11 +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
29bf244265 lottie: ++exception handling
dropshadow opacity range seems 0 ~ 256.
make it sure in 0 ~ 255.
2024-12-18 19:05:59 +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
1806b32971 common: optimization pImpl data structures
ThorVG pImpl idiom caused internal data to be scattered
across hierarchical classes. This refactoring consolidates
the data by inheriting pImpl internally, reducing memory
allocation counts and eliminating unnecessary strategy methods.
2024-12-14 12:24:57 +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
Hermet Park
b24d196809 lottie: code clean up
- a file name (LottieCommon -> LottieData) was changed
- removed duplicate code
- removed dead code
2024-12-09 19:39:29 +09:00
Mira Grudzinska
6b416409c3 lottie: add TextCaps property support 2024-12-06 00:40:48 +09:00
Hermet Park
0ebbc614be api: 1.0 specification revision
- Enhanced Scene management to provide users with more control.
- Scenes now support adding specific scenes at defined positions and removing them as needed.
- Ensure safe access to Canvas, Scene paints() by adding const specifiers.
- Removed virtual specifier for the canvas primitive apis.
- Introduced a nested scene in the canvas to remove logic duplication.

C++ API Modification:
- Result Scene::push(Paint* paint)
 -> Result Scene::push(Paint* target, Paint* at = nullptr)
- Result Scene::clear(bool free = true)
 -> Result Scene::remove(Paint* paint = nullptr)
- Result Canvas::push(Paint* paint)
 -> Result Canvas::push(Paint* target, Paint* at = nullptr)
- list<Paint*>& Scene::paints()
 -> const list<Paint*>& Scene::paints() const
- list<Paint*>& Canvas::paints()
 -> const list<Paint*>& Canvas::paints() const

C++ API Addition:
- Result Canvas::remove(Paint* paint = nullptr);

C API Modifications:
- Tvg_Result tvg_scene_clear(Tvg_Paint* scene, bool free)
 -> Tvg_Result tvg_scene_remove(Tvg_Paint* scene, Tvg_Paint* paint)

C API Addition:
- Tvg_Result tvg_scene_push_at(Tvg_Paint* scene, Tvg_Paint* target, Tvg_Paint* at)
- Tvg_Result tvg_canvas_push_at(Tvg_Canvas* canvas, Tvg_Paint* target, Tvg_Paint* at)
- Tvg_Result tvg_canvas_remove(Tvg_Canvas* canvas, Tvg_Paint* paint)

issue: https://github.com/thorvg/thorvg/issues/2957
issue: https://github.com/thorvg/thorvg/issues/1372
2024-12-04 11:44:58 +09:00
Hermet Park
f33b63abad common: inlist code refactoring
introduced INLIST_FOREACH() / INLIST_SAFE_FOREACH()
for common implementation
2024-12-02 15:15:35 +09:00
Hermet Park
1422c4ca5f renderer: make the file io configurable
certain systems, may not support file I/O operations.
ThorVG should provide users with an option to configure
builds according to their requirements.

This ensures that file I/O calls are avoided,
preventing potential crashes.

Please use the meson '-Dfile=true/false' option for this.

Please note that "THORVG_FILE_IO_SUPPORT" might be expected
for your thorvg manual build.

issue: https://github.com/thorvg/thorvg/issues/3008
2024-12-02 11:50:59 +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
b453bd4f40 lottie: fix bug in expressions
'end' used instead of 'offset'
2024-11-25 21:54:37 +09:00
Hermet Park
8995bc32a2 lottie: portability++
issue: https://github.com/lvgl/lvgl/issues/7214
2024-11-23 11:43:33 +09:00
Mira Grudzinska
0cc0d0e1c8 lottie: shapes support in text range selector
@issue: #2178
2024-11-21 01:20:53 +09:00
Mira Grudzinska
a6fb2ef9a7 lottie: easing support in text range selector
@issue: #2178
2024-11-21 01:05:11 +09:00
Hermet Park
22d94ea629 renderer: introduced paint reference counting
The reference count of the Paint object allows
easy & safe shared ownership and control over its lifetime
among users and the engine.

New APIs:
- uint8_t Paint::ref()
- uint8_t Paint::unref(bool free = true)
- uint8_t Paint::refCnt() const

issue: https://github.com/thorvg/thorvg/issues/1372 https://github.com/thorvg/thorvg/issues/2598
2024-11-20 01:53:25 +09:00
Mira Grudzinska
511495f6d8 svg_loader: handle currentColor inside gradient
@Issue: https://github.com/thorvg/thorvg/issues/2960
2024-11-20 01:46:19 +09:00
Hermet Park
b7888c2ff3 lottie: --minor memory leak 2024-11-19 01:55:38 +09:00
Hermet Park
b66ce727ff 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:55:38 +09:00
Hermet Park
66d4bab696 lottie: ++slot overriding
Keep trying overriding even if the given sid is invalid.

issue: https://github.com/thorvg/thorvg/issues/2969
2024-11-18 19:52:47 +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