Commit graph

3479 commits

Author SHA1 Message Date
Mira Grudzinska
11a029c99d gl_engine: apply common trimming logic
The trim-related implementation has been removed
and replaced with the one available in common.

@Issue: https://github.com/thorvg/thorvg/issues/2854
2025-02-06 22:29:06 +09:00
Mira Grudzinska
a046abc47b wg_engine: apply common trimming logic
The trim-related implementation has been removed
and replaced with the one available in common.

@Issue: https://github.com/thorvg/thorvg/issues/2854
2025-02-06 22:29:06 +09:00
Mira Grudzinska
c2880c57d8 sw_engine: move trimming logic to TrimPath
The trim handling from sw_engine has been removed.
Instead the common logic from the TrimPath structure
is used.
On the sw_engine side, the dashed outline is now
used for both: dashed and/or trimmed strokes.

@Issue: https://github.com/thorvg/thorvg/issues/2854
2025-02-06 22:29:06 +09:00
Mira Grudzinska
5493a9e952 common: introduce basic TrimPath struct
The first step towards unifying trimming across engines.

@Issue: https://github.com/thorvg/thorvg/issues/2854
2025-02-06 22:29:02 +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
Jinny You
4aba0caaad wasm: fix build issue in sw/wg build only case
- resolved EMSCRIPTEN_WEBGL_CONTEXT_HANDLE declaration problem.
- currentContext() should be also called after `mContext` is initialized.
2025-01-15 21:27:00 +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
8f98681ea7 renderer: minor code clean++ 2025-01-15 12:24:32 +09:00
Hermet Park
1c3b958d5b svg: ++loc reduction 2025-01-14 21:04:45 +09:00
Hermet Park
2e35f4eabb doc: minor capi doc correction 2025-01-14 19:40:37 +09:00
Hermet Park
ce3f0a75e2 gl_engine: corrected ColorDodge, ColorBurn equation
issue: https://github.com/thorvg/thorvg/issues/3072
2025-01-14 12:19:18 +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
Jinny You
5361ad1617 common: optimize clamp() for reduced overhead in web 2025-01-13 22:41:55 +09:00
Hermet Park
f5aa347a70 api: renamed api for consistency
API modification:
- Shape::fillColor() -> Shape::fill()

issue: https://github.com/thorvg/thorvg/issues/3116
2025-01-13 16:53:14 +09:00
Hermet Park
a31eceeafa sw_engine: assign the stride omitted
This fixes a wrong compositor access
during the rasterization

issue: https://github.com/orgs/thorvg/discussions/3109
2025-01-13 15:07:57 +09:00
Hermet Park
bc1ad7104d example: corrected reveresed arguments 2025-01-13 12:14:15 +09:00
faxe1008
912752906c renderer: Fix loader logic for mimetype check
Fixes the logic of the mimetype check before trying to load with the
given mimetype.
2025-01-11 13:53:24 +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
3d6fe5ffae sw_engine: ++portability on macOS
fixed a runtime error report of the sanitizer
at data casting.

issue: https://github.com/thorvg/thorvg/issues/3102
2025-01-09 00:43:30 +09:00
Hermet Park
d72c740ac6 common: properly update the clamp()
A regression brokeage by da54c83b5f
2025-01-09 00:04:18 +09:00
Sergii Liebodkin
222e8a25a1 wg_engine: fix context handle passimg by ref
Use reference insted of value for context passing
2025-01-08 17:21:57 +09:00
Hermet Park
d2d93792df wg_engine: corrected ColorDodge, ColorBurn equation
issue: https://github.com/thorvg/thorvg/issues/3072
2025-01-08 13:54:09 +09:00
Hermet Park
084c7ff214 sw_engine: corrected blendings
corrected wrong ColorDodge, ColorBurn, Exclusion, SoftLight blendings

issue: https://github.com/thorvg/thorvg/issues/3072
2025-01-08 13:27:58 +09:00
Hermet Park
da54c83b5f common/math: revise clamp() aligning with the std style 2025-01-08 13:27:58 +09:00
Jinny You
2a6e3ca40a examples: add slot transform overriding samples 2025-01-07 16:03:37 +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
Hermet Park
3d999ca1db examples: revise the blending sample
Note that scene blending doesn't work properly
2025-01-07 12:16:07 +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
acc614ab2f sw_engine: prevent warning
Remove unused version of SUBPIXELS().
2025-01-03 10:24:46 +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
2fb925a2d7 sw_engine: corrected the rle cell building
Properly build the cell cover value
when a new cell value is just overlapped.

This fixes certain weird visual artifacts at a corner case.

issue: https://github.com/thorvg/thorvg/issues/2929
2025-01-02 17:49:28 +09:00
Hermet Park
47524300bb sw_engine: minor code clean up 2025-01-02 17:49:28 +09:00
RuiwenTang
3c6d686795 gl_engine: fix fbo and texture leak
GlRenderTarget contains framebuffer and render target objects,
these GPU resources need to be released before reusing the structure and calling init with the new size.
2024-12-31 16:25:11 +09:00
Hermet Park
12b3747d08 examples: updates svg resources 2024-12-31 14:02:26 +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
Hermet Park
76203c3dbb gl_engine: ensure the gl context switching
This only covers emscripten environment,
need to cover other system.

issue: #3023

Co-Authored-By: Hermet Park <hermet@lottiefiles.com>
2024-12-31 12:07:52 +09:00
Jinny You
596de01b12 gl_engine: revise target API for context managing
Issue: #3024
2024-12-31 12:07:52 +09:00
Hermet Park
1cbc11cadd renderer: revamped engine interfaces
Introduced updated pre/post calls
for proper preparation of the drawing process.
2024-12-31 12:07:52 +09:00
Hermet Park
ccf5a8158f gl_engine: ++binary optimization
- removed unique_ptr, shared_ptr
- replaced std::vector with tvg::Array
- reduced binary size by -10kb
2024-12-30 22:24:53 +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
Mira Grudzinska
82dc41479e sw_engine: fix clipping
A shape with both fill and stroke, where clipping left
only a fragment of one (either fill or stroke), was not
rendered at all. Now fixed.
2024-12-30 12:01:24 +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
Marcin Baszczewski
f2883a31da gl_engine: Fix for rendering short paths
Ensure they do not terminate prematurely for paths
with a step of 0 or exceptionally small values
when a valid stroke-width is present.

In my opinion, the optimal approach was to separate vertex generation
into dedicated methods: strokeRoundPoint and strokeSquarePoint.

My update supports two different stroke-cap styles.
I have also tested it with various files (JSON, SVG)
as well as a small example application similar
to the one included in the previous pull request (#3066).

issue: https://github.com/thorvg/thorvg/issues/3065
2024-12-27 21:11:38 +09:00