Commit graph

3769 commits

Author SHA1 Message Date
Hermet Park
5c2e898cca examples: added bounding box sample 2025-03-05 14:46:55 +09:00
Hermet Park
67098793f0 renderer: revise the paint bounding box api
C++ API Modificaiton:
 - Result Paint::bounds(float* x, float* y, float* w, float* h, bool transform = false) const
  -> Result Paint::bounds(float* x, float* y, float* w, float* h) const

C++ API Addition:
 - Result Paint::bounds(Point* pt4) const

C API Modification:
- Tvg_Result tvg_paint_get_bounds(const Tvg_Paint* paint, float* x, float* y, float* w, float* h, bool transformed);
 -> Tvg_Result tvg_paint_get_aabb(const Tvg_Paint* paint, float* x, float* y, float* w, float* h);

C API Addition:
- Tvg_Result tvg_paint_get_obb(const Tvg_Paint* paint, Tvg_Point* pt4);

issue: https://github.com/thorvg/thorvg/issues/3290
2025-03-05 14:46:55 +09:00
Sergii Liebodkin
259dbc9840 wg_engine: stroke clipping issue
Issue: https://github.com/thorvg/thorvg/issues/3298
2025-03-05 14:10:43 +09:00
Sergii Liebodkin
b43177639c gl_engine: introduce the stroke clipper
See Clipping example
Issue: https://github.com/thorvg/thorvg/issues/3063
2025-03-04 18:37:53 +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
Jinny You
716311f44f lottie/text: fix justification in embedded font rendering
issue: #3266
2025-03-04 15:01:35 +09:00
Hermet Park
30a5f2891b renderer: improved the paint bounding box accuracy
previously, the bounding box calculation was simply
determined by comparing all the points, which led to
incorrect sizing due to Bezier control points.

Now, it accurately computes the curve boundary,
properly addressing this issue.
2025-03-04 14:37:43 +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
Sergii Liebodkin
889710ecee wg_engine: Introduce the stroke clipper
Issue: https://github.com/thorvg/thorvg/issues/3063
2025-02-28 11:34:01 +09:00
Sergii Liebodkin
173822b1d9 wg_engine: fix memory leak sanitizer report (fill effect)
Issue: https://github.com/thorvg/thorvg/issues/3292
2025-02-28 11:25:30 +09:00
Hermet Park
227a048752 examples: updated gifsaver
- walker.json has been removed
2025-02-27 23:32:48 +09:00
Hermet Park
e6ec370229 examples: removed Performance 2025-02-27 22:50:18 +09:00
Sergii Liebodkin
1f204ffb8d wg_engine: Introduce triton effect for webgpu renderer
Issue: https://github.com/thorvg/thorvg/issues/3054
2025-02-27 20:11:21 +09:00
Sergii Liebodkin
f024c54b87 wg_engine: Introduce tiny effect for webgpu renderer
Issue: https://github.com/thorvg/thorvg/issues/3054
2025-02-27 20:11:21 +09:00
Hermet Park
d386a5654a Lottie: optimize rendering performance
implemented an aggressive culling strategy to eliminate
unnecessary renderings if the rendering visuals were hidden
by other overlaid opaque fills or strokes

this pretty improves the performance for those scenarios
when rendering sequences are fragmented by fills/strokes.

Performance has been improved ~7% with those cases
2025-02-27 19:05:41 +09:00
Mira Grudzinska
89752ff661 sw_engine: hanndle empty clips
Generating the outline may return false, e.g., if the shape
is completely trimmed. If such a shape was used as a clip,
an attempt to generate 'rle' will still be made. In such a case,
a crash will occur because the outline is nullptr.
2025-02-27 19:04:49 +09:00
Mira Grudzinska
83eb2a0430 renderer: fix trimmed rect clippers
Rectangular clippers followed the 'fastTrack' path,
which caused their trimming to be ignored. Fixed.
2025-02-27 18:40:03 +09:00
Jinny You
bf5cea982c common: Support .lot extension
Add support for the .lot extension to recognize Lottie animation files, as this introduces an additional extension for Lottie.

issue: #3248
2025-02-27 16:46:30 +09:00
Hermet Park
ce96024e99 wasm: refine the logic for clarity
1. return null canvas when engine is not avaiable.
2. remove the ifdef for unnecessary taret calls.
2025-02-27 16:40:45 +09:00
Jinny You
583fb6503c wasm: optimize default font size
Enable default font compression to reduce WASM size.

The LZSS algorithm is a simple compression method with advantages in decompression performance.

Font data is optimized without external compression dependencies, reducing the embedded font size to 9KB (-40%).
2025-02-27 16:30:27 +09:00
Mira Grudzinska
47130ea911 ttf_loader: handling contours starting with OFF_CURVE
It might happen that the first point doesn't belong
to the contour - such cases were observed as artifacts
till now.

@Issue: https://github.com/thorvg/thorvg/issues/3268
2025-02-27 12:27:55 +09:00
Mira Grudzinska
2c73da0e20 gl_engine: fix line join while dashing
While dashing, changing the path command each time caused
a new 'move to' command to be added, even when dash segments
across different path commands should have been connected.

@Issue: https://github.com/thorvg/thorvg/issues/3231
2025-02-27 12:23:00 +09:00
Sergii Liebodkin
9a2d1136de wg_engine: Introduce fill effect for webgpu renderer
Issue: https://github.com/thorvg/thorvg/issues/3054
2025-02-27 12:15:42 +09:00
Hermet Park
9a79dd0267 lottie: code clean up++ 2025-02-26 19:00:16 +09:00
Hermet Park
7ef3352efa lottie: more precise culling for inverse mattes
don't do rendering further when the inverse mattes has
a fully translucent. This could improve rendering performance
in that case.
2025-02-26 12:55:47 +09:00
Hermet Park
01a4a4c806 examples: updated lottie samples 2025-02-25 23:00:10 +09:00
Mira Grudzinska
2bc6cb07b4 renderer: remove unused file
Should be removed while refactoring in 127738bb1d
2025-02-25 19:42:08 +09:00
Hermet Park
c5ca7b4b12 lottie: hotfix a regression
a regression by the code refactoring:
5b30e2ad65
2025-02-25 18:54:04 +09:00
Hermet Park
eb4b286da5 renderer: migrated TrimPath as the integrated rendering method
TrimPath -> RenderTrimPath

Co-Authored-By: Mira Grudzinska <mira@lottiefiles.com>
2025-02-25 15:38:03 +09:00
Hermet Park
4316498b8b examples: allow the engine name from the test script
Usage:
all.sh [engine name] [interval]

Example:
$./all.sh gl 3
2025-02-25 12:52:13 +09:00
Hermet Park
70f0ec9ff2 examples: renamed StrokeTrim -> TrimPath 2025-02-25 12:46:54 +09:00
Mira Grudzinska
7275b77c22 gl/wg_engine: fix differences in dashing among engines
The differences resulted from discrepancies between
the engines in applying equality or inequality signs
and in using different precision levels when determining
the dash remainder when transitioning to a new path
command.

@Issue: https://github.com/thorvg/thorvg/issues/3265
2025-02-25 12:30:26 +09:00
Sergii Liebodkin
64ed756c2c wg_engine: Introduce drop shadow effect for webgpu renderer
Issue: https://github.com/thorvg/thorvg/issues/3054
Supported color, angle, distance, sigma, quality params
2025-02-25 11:54:04 +09:00
Hermet Park
66a30b2c50 lottie: fixed a regression bug of a weird artififact observation
this reverts a logic that was introduced by
https://github.com/thorvg/thorvg/pull/3167

this logic change was not necessary thus revert it.
2025-02-24 15:47:09 +09:00
Mira Grudzinska
5b30e2ad65 lottie: prevent trimming in masks
Until now the fill's trimming was not supported,
which allowed masks to function correctly. Introducing
trimming for the entire shape caused the mask to be trimmed
as well, leading to incorrect results.

Co-Authored-By: Hermet Park <hermet@lottiefiles.com>
2025-02-24 15:06:16 +09:00
Mira Grudzinska
8f9527ccf1 gl_engine: support trimmed fill
This commit changes the API behavior.

@Issue: https://github.com/thorvg/thorvg/issues/3118
2025-02-24 15:06:07 +09:00
Mira Grudzinska
05a5a7ea0b wg_engine: support trimmed fill
This commit changes the API behavior.

@Issue: https://github.com/thorvg/thorvg/issues/3118
2025-02-24 15:05:59 +09:00
Mira Grudzinska
c4747e6802 sw_engine: support trimmed fill
Until now, only stroke trimming was possible,
but the Lottie standard requires support for
trimming both (if present), stroke and fill.
This commit changes the API behavior.

@Issue: https://github.com/thorvg/thorvg/issues/3118
2025-02-24 15:05:49 +09:00
Mira Grudzinska
b939a60bfa api: change api name strokeTrim() -> trimpath()
No changes in behaviour so far.
2025-02-24 15:05:38 +09:00
Hermet Park
02678b67f4 examples: unified samples and improved coverages
- Unify samples for simpler testing:
 - Masking + InvMasking
 - LumaMasking + InvLumaMasking

- Applied Dash for the Stroke Triming
2025-02-21 17:16:26 +09:00
Jinny You
151284c3cc lottie/expressions: Fix incorrect evaluation result check condition
A JavaScript code line may return undefined, but this should not be treated as an error.

For example, consider the following two lines of code:
- `var $bm_rt = 30` (Statement) → result: `undefined`
- `$bm_rt = 30` (Expression) → result: `30`

Both lines execute the same operation, but the JavaScript interpreter (REPL JS) evaluates them differently.

Therefore, an evaluation result of undefined should not be blocked, as it does not indicate a failed code execution.
2025-02-21 11:22:55 +09:00
Sergii Liebodkin
1416e99f34 example: fix types of drop shadows effect parameters (int to double) 2025-02-21 00:06:53 +09:00
Hermet Park
d50632d0d6 loader: fixed potential memory leaks in font handling
Simply loading a font doesn't mean it is in use.
Fixed the loader's reference count to prevent incorrect increments.
2025-02-21 00:05:36 +09:00
Hermet Park
a768276bb6 common: ++portablity
fix a error call of ambiguous overloaded ‘free(void*&)’
2025-02-20 23:16:27 +09:00
Hermet Park
8e1cd7b4c6 examples: added a default font for flawless test 2025-02-20 23:16:15 +09:00
Hermet Park
75c9028c19 gl_engine: code refactoring
- introduced GlGeometryBuffer that structure ensures the pairing of vertex and index data.
- improved for clean and neat code.
2025-02-20 21:41:29 +09:00
Jinny You
3737632e13 wasm: support default font initialization
Load default font data during initialization. This enables the web system to load when the system font cannot be used.

Added a binary-embeddable font file resource. This file has quite small size while containing essential glyphs.

- DM Sans: https://github.com/googlefonts/dm-fonts
2025-02-20 18:47:01 +09:00
Jinny You
646e35484f loaders: added lottie, svg font fallback mechanism
fallback for allowing any available fonts.

Co-Authored-By: Hermet Park <hermet@lottiefiles.com>
2025-02-20 18:47:01 +09:00
Hermet Park
8e5ca40250 text: allow the unnamed font
If the font name is not specified,
ThorVG will select any available font candidate.

This could be useful for font fallback mechanism.
2025-02-20 18:47:01 +09:00
Hermet Park
bed38a4521 common: remove redundant lzw decoder 2025-02-20 16:41:14 +09:00