Commit graph

3795 commits

Author SHA1 Message Date
Mira Grudzinska
468a1db1fa svg_loader: handle embedded fonts
It is possible to embed fonts directly into an SVG file.
Support for parsing and loading embedded fonts has been added.

@Issue: https://github.com/thorvg/thorvg/issues/1897
2025-03-17 17:31:45 +09:00
Hermet Park
f1e9ce0460 common: refactoring the dash pattern
introdced the length to avoid duplicate among engines
2025-03-17 15:28:23 +09:00
Jinny You
02a28bf9c3 lottie/slot: fix image deep copy logic
When the datas are copied with deep copy, memory issue caused (SEGV on unknown address) due to these reasons:

1. `mimeType` is nullptr when it's not embedded(base64) data

2. datas(b64Data, mimeType) should not be clear, it's used for next slot copy in same pair.
2025-03-17 12:42:13 +09:00
Hermet Park
ca3c0949b0 doc: updated README 2025-03-15 13:58:09 +09:00
Hermet Park
44acb11fdc updated CONTRIBUTORS 2025-03-12 15:05:21 +09:00
Mira Grudzinska
be32e97d96 svg: fix incorrect assignment of <stop> elements
If the svg contained an unsupported element with <stop> elements,
they were incorrectly assigned to the last loaded gradient. Now fixed.

@Issue: https://github.com/thorvg/thorvg/issues/3321
2025-03-12 15:02:25 +09:00
Hermet Park
36be459c80 renderer: ++wasm build portability
removed the direct thread inclusion
when those thread features are disabled
2025-03-12 13:14:13 +09:00
Hermet Park
6847d951d8 examples: updated Animation sample 2025-03-12 13:10:25 +09:00
Mira Grudzinska
ac080ffabc lottie: add support for text follow path
Added support for cases without text grouping and range selector.

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

@Issue: https://github.com/thorvg/thorvg/issues/2888
2025-03-12 13:08:26 +09:00
Hermet Park
24378cc200
gl_engine: ++neat code (#3319) 2025-03-11 19:16:58 +09:00
Hermet Park
6f9fd6ff01 sw_engine: minor refactoring
simpler logic to computes.
2025-03-11 14:31:22 +09:00
Hermet Park
852ca2a523 sw_engine: fix a incorrect rle cell position.
All cells that are on the left of the clipping region
go to the - 1 horizontal position.

issue: https://github.com/thorvg/thorvg/issues/2657
2025-03-11 14:31:17 +09:00
Jinny You
e4834e9190
lottie/text: render carriage return with local font (#3310)
Added missing carriage return support in local font case.

issue: #3301
2025-03-11 13:39:55 +09:00
Hermet Park
488fd88ce1 lottie: --compiler warnings
In member function ‘constexpr LottieGenericProperty<LottieScalarFrame<float>, float>& LottieGenericProperty<LottieScalarFrame<float>, float>::ope>    inlined from ‘LottieFloat& LottieStroke::dashValue()’ at ../src/loaders/lottie/tvgLottieModel.h:60:104,
    inlined from ‘void LottieParser::parseStrokeDash(LottieStroke*)’ at ../src/loaders/lottie/tvgLottieParser.cpp:623:82:
../src/loaders/lottie/tvgLottieProperty.h:297:8: warning: ‘<anonymous>.LottieGenericProperty<LottieScalarFrame<float>, float>::value’ may be used>  297 | struct LottieGenericProperty : LottieProperty
      |        ^~~~~~~~~~~~~~~~~~~~~
../src/loaders/lottie/tvgLottieModel.h: In member function ‘void LottieParser::parseStrokeDash(LottieStroke*)’:
../src/loaders/lottie/tvgLottieModel.h:60:104: note: ‘<anonymous>’ declared here
   60 |             for (uint8_t i = 0; i < dashattr->size; ++i) newValues[i] = LottieFloat(dashattr->values[i]);
      |
2025-03-10 14:28:04 +09:00
Jinny You
010364174e examples/slot: added example for expressions slot overriding 2025-03-10 12:42:12 +09:00
Jinny You
0e76ba3e47 lottie/slot: Support expressions overriding
issue: #3168

Co-Authored-By: Hermet Park <hermet@lottiefiles.com>
2025-03-10 12:42:12 +09:00
Thaddeus Crews
e235eb8152 common: support c++20 builds 2025-03-10 09:45:19 +09:00
Hermet Park
57dd66de1b example/capi: chores++ 2025-03-07 01:00:09 +09:00
Hermet Park
c854a7207f wg_engine: hotfix of memory sanitizer
../src/renderer/wg_engine/tvgWgRenderer.cpp:623:78: runtime error: downcast of address 0x5040005b7010 which does not point to an object of type 'RenderEffectFill'
0x5040005b7010: note: object is of type 'tvg::RenderEffectTint'
 00 00 00 00  80 07 5d 35 c9 7f 00 00  20 60 23 00 30 50 00 00  00 00 00 00 00 00 00 00  00 00 00 00
              ^~~~~~~~~~~~~~~~~~~~~~~
              vptr for 'tvg::RenderEffectTint'
../src/renderer/wg_engine/tvgWgRenderer.cpp:624:85: runtime error: downcast of address 0x5040005b7050 which does not point to an object of type 'RenderEffectFill'
0x5040005b7050: note: object is of type 'tvg::RenderEffectTritone'
 00 00 00 00  a0 07 5d 35 c9 7f 00 00  40 5e 23 00 30 50 00 00  00 00 00 00 00 00 00 00  00 00 00 00
              ^~~~~~~~~~~~~~~~~~~~~~~
2025-03-07 00:04:48 +09:00
Hermet Park
28d653e22f renderer: hotfix crash
addressed extra corner case errors by
9e6a514022
2025-03-06 23:46:15 +09:00
Hermet Park
97b48a97c1 examples: polished for a sleek initial screen appearance 2025-03-06 19:07:38 +09:00
Hermet Park
9e6a514022 common: ++stability of the font cache
Use the font name as the cache key for
precise comparison instead of the file path.
2025-03-06 19:00:06 +09:00
Jinny You
384fa7f2cb lottie/slot: fix potential memory leak when overriding twice
Co-Authored-By: Hermet Park <hermet@lottiefiles.com>
2025-03-06 12:40:15 +09:00
Hermet Park
96dc3d6697 common: str refactoring
renamed the prefix to be slimmer and more compact.
2025-03-06 12:18:24 +09:00
Mira Grudzinska
f98057063b renderer: rectified the fast track for clipping
- Issue was present when masking and clipping were applied
simultaneously. In the case where the mask was in fastTrack
mode and the clip was also clipped, the fastTrack was not
reset, resulting in an incorrect rendering effect.

- For rectangular clippers with a stroke width > 0, stroke clipping
should be applied. However, the fastTrack mode was set instead,
resulting in regular clipping instead of stroke clipping.
2025-03-05 23:28:13 +09:00
Hermet Park
e2f1557de5 examples: chores++
- removed AnimatedMasking.
- unified ImageScaleUp/Down.
- build GifSaver only gif_saver is enabled.
2025-03-05 23:25:06 +09:00
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