Commit graph

2724 commits

Author SHA1 Message Date
Hermet Park
18b9e8141d
Update README.md 2024-05-07 01:51:20 +09:00
Hermet Park
0ad9630d0e lottie/expressions: ++exceptional handling
Stop handling if the interpreting result is invalid.
2024-05-06 14:32:34 +09:00
Hermet Park
c0582d8d2d lottie/expressions: apply expressions to missing properites. 2024-05-06 11:14:23 +09:00
Hermet Park
81ff238fef lottie/expressions: enhance stability
When the system fails to interpret the expression code,
it forcibly disables the feature per property.

This improvement enhances stability and performance
by avoiding reckless attempts to interpret JavaScript code.

When we confirm the full stability with expressions,
we can revert this code.
2024-05-06 11:14:23 +09:00
Hermet Park
0ea0def99d lottie/expressions: ++exceptional handling.
Add an exceptional handling if interpreting code is failed.
2024-05-06 11:14:23 +09:00
Hermet Park
830e5de0ce lottie/expressions: make it up the insufficient content() behavior
this is a follow-up fix for the initial expressions feature.
2024-05-06 11:14:23 +09:00
Hermet Park
1b4502bade lottie: fix a logic by a mistake. 2024-05-06 11:14:23 +09:00
RuiwenTang
9521e80e4c gl_engine: fix stencil logical not correct
Fix the stencil reference and compile function cause rendering not
correct
2024-05-06 11:02:35 +09:00
RuiwenTang
eb6067f87b gl_engine: optimize tessellation performance
* restrict the scissor box of composite task
* do not tessellate stroke or fill geometry if there is no Fill or
  Stroke color
* use actually transformed curve to calculate polyline count when doing
  curve flatten
2024-05-02 13:07:59 +03:00
Vincent Torri
b1912e2ef9 infra: fix build failure using c++17 (or later) with MSVC.
the WIN32_LEAN_AND_MEAN definition will remove the unused
features in windows.h that helps to improve the build-speed
as well as fixing the issue.

Issue: https://github.com/thorvg/thorvg/issues/2225

Co-Authored-By: Hermet Park <hermet@lottiefiles.com>
2024-05-02 16:09:01 +09:00
Jinny You
55c4d6fe28 bindings/capi: Fix incompatible parameter
C API doesn't support default parameter, removed it.

Issue: #2228
2024-04-30 23:19:24 +09:00
Hermet Park
7a9ba52d0c doc: adds the api version history 2024-04-30 14:32:07 +02:00
Hermet Park
6211db93bc lottie/jerryscript - size down the engine.
get rid of unused features in thorvg lottie.
2024-04-30 15:26:37 +09:00
Hermet Park
324d0f8943 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-04-30 15:26:37 +09:00
Hermet Park
4d02cda350 lottie/model: Added some essential functions through expressions.
These internal methods have been introduced to search for content within
an object (parent) using a given parameter (name or index).

- LottieLayer* LottieGroup::asset(const char* name)
- LottieLayer* LottieComposition::asset(const char* name)
- LottieLayer* LottieComposition::layer(uint16_t id)
- LottieLayer* LottieComposition::layer(const char* name)

This converts the frame number to the corresponding time.
- float LottieComposition::timeAtFrame(float frameNo)
2024-04-30 15:26:37 +09:00
Hermet Park
ce1fb53c9a lottie: ++binary search stability.
this ensures that the return value is not below 0,
when the frame count is just 2.
2024-04-30 15:26:37 +09:00
Hermet Park
063a5c6c3a lottie: specify the explicit parsing type.
these explicit type values are expected
to be referenced by the expressions.
2024-04-30 15:26:37 +09:00
Hermet Park
8118a9a661 lottie: generalize parent context access in parsing.
ensure parent context is generally accessible,
not limited to gradients.
2024-04-30 15:26:37 +09:00
Hermet Park
4dba662aaf examples/lottie: added expressions sample 2024-04-30 15:26:37 +09:00
Hermet Park
e62b144afe lottie: integrate JerryScript engine for expressions
introduced the JerryScript engine to interpret Lottie
expressions, enhancing the capability to support runtime
programmable animation logic within Lottie expressions
spec. This feature, based on js scripting, represents
the most complicated addition to the Lottie spec so far.

ThorVG probably could includes an option to toggle
this feature at build time, allowing for customizable user
configurations according to specific requirements.

removed unused features for the optimal size:
- DEBUGGER
- MEM_STATS
- SNAPSHOT
- BUILTIN_JSON
- BUILTIN_PROXY
- BUILTIN_REFLECT
- BUILTIN_ATOMICS
- PROMISE_CALLBACK
- MODULE_SYSTEM
- SYSTEM_PORT

This is an experimental version.
Please manually enable the 'lottie-expressions' in meson.build
when you wish to use it.

See: https://jerryscript.net/
2024-04-30 15:26:37 +09:00
RuiwenTang
bb7f23da78 gl_engine: fix rendering error caused by viewport and stencil state
Fix some error:
* glViewport not controlled by framebuffer, and need to set manually when
target framebuffer is changed.
* change even-odd stencil operation, so no need to do third draw call to
  clear stencil buffer
* fix the missing `GlCanvas::update` calls in Lottoe and LottieExtension
2024-04-29 17:14:31 +09:00
Sergii Liebodkin
a532ac3eb2 wg_engine: blending and composition optimization
[issues 1479: Masking, InvMasking, LumaMasking, InvLumaMasking](#1479)

Computes composition and blending using simgle pass istead of two full screen passes
2024-04-29 16:36:00 +09:00
Hermet Park
e9311aeda4
Update AUTHORS 2024-04-27 03:01:06 +09:00
Francisco Ramírez
51877b328a
docs: Add Conan Installation steps 2024-04-27 02:59:42 +09:00
Jinny You
e7d27f8930 lottie: correct the text alignment
When the Lottie Text Justify sets to center, text alignment should also be center.
2024-04-26 11:11:15 +09:00
JunsuChoi
0d20eb71eb loader/svg: Check current graphics node that not closed
If any of the graphics nodes are not closed,
the graphics nodes between them are ignored.

related issue: https://github.com/thorvg/thorvg/issues/2210
2024-04-25 16:23:07 +09:00
JunsuChoi
a1ffa039bb loader/svg: If link string is empty, not create picture object
An empty link causes the wrong loader to be found and causes various problems.

related issue : https://github.com/thorvg/thorvg/issues/2078#issuecomment-2067726046
2024-04-25 13:18:53 +09:00
Mira Grudzinska
9183f1c11e common: fix composition while masking
Using a mask (any type) with alpha set to less
than 255 through the fill(r, g, b, a) API resulted
in incorrect compositions of fill and stroke.
Incorrect results were also observed for luma masks,
as their alpha is calculated based on the other color
channels.

@issue: https://github.com/thorvg/thorvg/issues/1653
2024-04-25 10:55:35 +09:00
RuiwenTang
25d43ddacf gl_engine: fix gradient rendering error
* Fix error when handle GradientTransform calculation. And move the inv
calculation into gradient vertex shader.
* Fix cubic tessellation not close the last point
2024-04-25 10:54:53 +09:00
Mira Grudzinska
d55b8afd6a svg_loader: fix opacity cloning
The opacity value should be copied along
with other node properties.
2024-04-25 10:41:15 +09:00
Jinny You
edc63ce28e web/examples: added dynamic component creation case
This change would help on testing dynamic creation/deletion of component.
2024-04-23 12:22:02 +09:00
Jinny You
f960c04474 web: memory stability++
Call the explicit memory deletion—binded in function `delete()`, which is highly recommended by the Memory management in Emscripten guideline.

The function will guarantee that the WASM module is cleaned up from the memory.

see: https://emscripten.org/docs/porting/connecting_cpp_and_javascript/embind.html#memory-management

Additionally, WASM module's initialization part has been refactored to correspond to the change.
2024-04-23 12:22:02 +09:00
Mira Grudzinska
08fe14280d svg_loader: copy display property
The display property was not copied along with other
node properties. This caused incorrect rendering
of an object with display=none if accessed through
a use tag.
2024-04-23 11:20:37 +09:00
Mira Grudzinska
8d81ad360f svg_loader: correct polygon's points loading
Only an even number of correctly read points defining
a polygon should be loaded and passed on for rendering.
Any remaining points should be ignored.
2024-04-22 11:12:15 +09:00
Mira Grudzinska
2cb89c71a1 Revert "loader/svg: Skip to invalid polygon"
This reverts commit 75e587a9a9.
If incorrect data for the points in a polygon is provided,
the element should still be rendered, but only up to the point
where the error occurs—using an even number of the points that
have been successfully loaded.
2024-04-22 11:12:15 +09:00
Hermet Park
c3a6523294 infra: ++gitignore 2024-04-22 11:10:44 +09:00
Hermet Park
5d22b6fb9e infra: enable ttf loader in default. 2024-04-22 11:10:44 +09:00
Hermet Park
3399b36679 infra: meson code clean up 2024-04-22 11:10:44 +09:00
Mira Grudzinska
568846491d build: enforcing saver/loader usage for given tool
Selecting a tool without choosing the required tools
resulted in a usage error. Now, the activation
of the appropriate saver/loader for a given tool
is enforced.
2024-04-19 10:01:30 +09:00
Sergii Liebodkin
c778f451b1 wg_engine: update mesh generations and render mechanics
[issues 1479: lottie](#1479)

- optimaze stroking algorithm by prevent vector normalizations
- using render meshes heaps to reduce webgpu instances re-creations
- using single instance of pilylines for standard operations such as trim and split
- "on-the-fly" strokes generations with dash pattern
- "on-the-fly" mesh objects generation in a process of path decoding
- merge strokes into single mesh by each shape
2024-04-18 18:54:02 +09:00
Sergii Liebodkin
398d181e3f wg_engine: added preallocated index buffers for triangle fans
[issues 1479: lottie](#1479)
2024-04-18 18:54:02 +09:00
Sergii Liebodkin
90ce9d81bc wg_engine: added math and polyline structures for geometry generating optimizations
[issues 1479: lottie](#1479)
2024-04-18 18:54:02 +09:00
Mira Grudzinska
3a03fd7080
sw_engine: fix max length of trimmed strokes
The error was visible when multiple shapes were
simultaneously trimmed. The length of a single
shape was zeroed out only in selected cases,
which caused accumulation that could lead to
incorrect extension of the variable determining
the maximum length.

@issue: https://github.com/thorvg/thorvg/issues/2173
2024-04-17 11:25:27 +09:00
JunsuChoi
f61efc6d84 loader/svg: Add check to the limits of result of StrToFloat
The string passed to the svg parser is not guaranteed to always be a valid string.
Certain strings may have numbers that cannot be converted.
Therefore, make sure to check whether the converted value is in the appropriate range before returning.

related issue: https://github.com/thorvg/thorvg/issues/2078#issuecomment-2037495121
2024-04-17 11:00:03 +09:00
Hermet Park
ab4cf28888 lottie: code clean up 2024-04-16 18:14:49 +02:00
Mira Grudzinska
51eec98aae build: add missing ifdef
The thorvg_lottie.h file wasn’t accessible
if the lottie loader was not activated,
causing a compilation error.
2024-04-17 00:00:32 +09:00
Jinny You
54eedd4bb6 lottie/loader: Fix crash when parsing error
When parsing error, lottie loader raises runtime crash.
Check whether the composition is nullptr.
2024-04-16 13:37:27 +02:00
JunsuChoi
1bbf9bbb7d loader/svg: Return actual decoded size
Returns the actual length of the decoded array.

related issue: https://github.com/thorvg/thorvg/issues/2156
2024-04-16 13:32:03 +02:00
RuiwenTang
da45fa6608 gl_engine: using depth buffer to support path clip
* Append depth buffer attachment in tvgGlRenderPass
* using depth test if Shape has path clip
2024-04-16 13:36:13 +09:00
Hermet Park
0268e9e3d1 lottie: ++stability
ensure that the loading has been completed before overriding.
2024-04-16 10:30:14 +09:00