Commit graph

1031 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
ecd4fb8a70 lottie/expressions: ++safety
Prevent segfault in case of the omitted name json data
2025-01-17 12:27:49 +09:00
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