Commit graph

3281 commits

Author SHA1 Message Date
Hermet Park
79e5a0f3eb examples: updated a lottie sample 2024-09-30 16:44:22 +09:00
Jinny You
e8665840db lottie/text: Fix incorrect text range without end condition
Improving text render compatibility by fixing wrong Text Range.

When lottie doesn't have `end` prop in the range, system must ignore condition regarding to `end`.

The original logic unintentionally swaps `start` and `end` prop, because `end` is the zero in this case. Then the text range animation behaves the opposite.
2024-09-30 16:44:22 +09:00
Hermet Park
ab54345d9a test: replaced ClipPath with clip() 2024-09-30 16:44:22 +09:00
Hermet Park
8f8af68955 examples: replaced ClipPath with clip() 2024-09-30 16:44:22 +09:00
Hermet Park
7a0c12ed8b api: Introduced Paint::clip() API
Separate clip function from the Composite()
clipping and composition can be used together.

This helps avoid the introduction of nested scenes
when composition and clipping overlap.

Deprecated:
- enum class CompositeMethod::ClipPath
- enum Tvg_Composite_Method::TVG_COMPOSITE_METHOD_CLIP_PATH

Experimental API:
- Result Paint::clip(std::unique_ptr<Paint> clipper)
- Tvg_Result tvg_paint_set_clip(Tvg_Paint* paint, Tvg_Paint* clipper)

Issue: https://github.com/thorvg/thorvg/issues/1496
2024-09-30 16:44:22 +09:00
Jinny You
82d4725c3e lottie/text: hotfix for parsing text range issue
If randomize is not enabled, "rn" prop falls into skip()
2024-09-30 16:44:22 +09:00
RuiwenTang
4bc1e60dfd gl_engine: implement advance blending
Implement some advance blending equation in GLEngine by using two
RenderPass.

* The first pass render the content into an off-screen framebuffer, also
blit the screen content to an off-screen Texture.

* The second pass renders the final blended color to the screen.
Also use a stencil test to prevent non-drawn areas from participating in the color blending calculation.

issue: https://github.com/thorvg/thorvg/issues/2435
2024-09-30 16:44:22 +09:00
Jinny You
c10c713c05 lottie/text: applied Text Range randomization.
on each parse, if the `randomize` is enabled,
the start and end of the Text Range are redefined
with the same gap as the original range.

issue: https://github.com/thorvg/thorvg/issues/2178
2024-09-30 16:44:22 +09:00
Mira Grudzinska
8acb135cb0 wg_engine: fix vertices while line joining
Vertex ordering during line join needed adjustment.
Vertices were forming two partialy overlapping triangles
instead of a rectangle. The issue was rarely visible since
the resulting rectangle often overlapped significantly
with other rectangles.
2024-09-30 16:44:22 +09:00
Hermet Park
915acd2ec3 lottie/expressions: ++coverage
Allow direct key[0]/key[1] access for key.value in expression

issue: https://github.com/thorvg/thorvg/issues/2722
2024-09-30 16:44:22 +09:00
Hermet Park
24ed6656d0 renderer: hotfix a crash
prevent a nullptr memory access
regression by f5337015e9

issue: https://github.com/godotengine/godot/issues/97078
2024-09-30 16:44:22 +09:00
Hermet Park
c80b21c1f7 lottie: ++expressions coverage
added missing velocityAtTime() for float types.

issue: https://github.com/thorvg/thorvg/issues/2724
2024-09-30 16:44:22 +09:00
Hermet Park
0d028678dc Revert "examples: updated samples"
This reverts commit 1e72e8f3a3.
2024-09-30 16:44:22 +09:00
Hermet Park
7f6eace8e3 examples: updated samples 2024-09-30 16:44:22 +09:00
Sergii Liebodkin
02ebfc1332 wg_engine: wrong gradient transformation fixed
issue: https://github.com/thorvg/thorvg/issues/2620
2024-09-30 16:44:22 +09:00
Hermet Park
e2f00be400 Update README.md 2024-09-30 16:44:22 +09:00
Hermet Park
7d642a1da3 Update README.md 2024-09-30 16:44:22 +09:00
Hermet Park
6a4a4bba98 examples: updated lottie resources 2024-09-30 16:44:22 +09:00
Jinny You
d42919ac1d wg_engine: Enable premultiplied canvas on browser
Emscripten 3.1.66 includes support for WebGPU's premultiplied canvas.

Surface configurations have been updated with premultiplied alpha mode to support this feature.

see: c82a307c61
2024-09-30 16:44:22 +09:00
Hermet Park
197b98c9d2 sw_engine: clean up code 2024-09-30 16:44:22 +09:00
Hermet Park
9b65b67a86 sw_engine: rectified 8 grayscale drawing
8 bits matting images must be blended, not overwriting.

issue: https://github.com/thorvg/thorvg/issues/1767
2024-09-30 16:44:22 +09:00
Hermet Park
1aa5742feb sw_engine: Added missing matting and blending for direct images
issue: https://github.com/thorvg/thorvg/issues/1767
2024-09-30 16:44:22 +09:00
Hermet Park
cfc3c26e90 Update README.md 2024-09-30 16:44:22 +09:00
Mira Grudzinska
c37e4056ac svg_loader: append text to the SvgTextNode
Text can be added in parts due to the presence
of the <tspan> tag. This requires that each
subsequent piece of text is appended rather than
overwriting the previous one.
2024-09-30 16:44:22 +09:00
Hermet Park
5cfd541ea9 sw_engine: blending stabilization++
Currently, only blending might work.
Blending and composition must be handled together.
2024-09-30 16:44:22 +09:00
Jinny You
bf3e861b5a lottie/text: Support line spacing
Compute line spacing based on the text range selector, applying the maximum spacing value for each line.
issue: https://github.com/thorvg/thorvg/issues/2178
2024-09-30 16:44:22 +09:00
Hermet Park
371139e220 renderer: blending refactoring++
- reordered the blending types to align with lottie spec.
- removed source over.
2024-09-30 16:44:22 +09:00
Jinny You
a7aac95b03 lottie/text: Support Text Based
Added support for Text Based of Text Range Selector, by processing further properties:
2. Character Excluding Spaces
3. Words
4. Lines

see: https://github.com/thorvg/thorvg/issues/2178
2024-09-30 16:44:22 +09:00
Hermet Park
217e5ef419 renderer: ++reliability in text drawing
Allow the canvas to pass through
even if text elements are not properly supported.

issue: https://github.com/thorvg/thorvg/issues/2715
2024-09-30 16:44:22 +09:00
Hermet Park
403710ffbc sw_engine: cleaned up the blending operations.
Corrected the alpha interpolation order during blending.
This also corrected the hard mix blending result in the guitar sample.

issue: https://github.com/thorvg/thorvg/issues/2704
2024-09-30 16:44:22 +09:00
Hermet Park
5849431850 api: clean form++ 2024-09-30 16:44:22 +09:00
Sergii Liebodkin
785a75a1ca wg_engine: external device handles (web integration)
move instance, adapter and device creation from renderer to application
its necessary for web integration, because browser have its own mechanics to create hardware handles
this changes makes webgpu canvas more universal to use in case of system and web applications

issue: https://github.com/thorvg/thorvg/issues/2410
2024-09-30 16:44:22 +09:00
Hermet Park
ca7f837e5c examples: ++svg samples 2024-09-30 16:44:22 +09:00
Mira Grudzinska
e271485607 svg_loader: fix text nodes issue
Since the text node wasn't pushed onto the loader's stack,
closing the text node incorrectly caused an element to be
popped from the stack (if one was present).
This could result in elements that were supposed to have
that element as a parent being rendered incorrectly or not
being rendered at all.
Now, the text node is correctly pushed onto the stack.

@Issue: https://github.com/thorvg/thorvg/issues/2706
2024-09-30 16:44:22 +09:00
Hermet Park
5d1e324aee common: remove redundant code 2024-09-30 16:44:22 +09:00
Hermet Park
6c6b29ad42 common/math: replace isinfinite() with isinf() 2024-09-30 16:44:22 +09:00
Mira Grudzinska
163f7d1716 common: precision increase while matrix inversion
A numerically motivated limit on the matrix determinant
set at 1e-6 was not sufficient. The limit has been increased
by checkoing whether 1/det is still a number.
2024-09-30 16:44:22 +09:00
Hermet Park
c4678eb420 lottie/parser: ++ null value handling
Note that, only dealt with a obivous case in practice.

issue: https://github.com/thorvg/thorvg/issues/2703
2024-09-30 16:44:22 +09:00
Łukasz Pomietło
3c5cf13eb5 loader/ttf: Spaces and invalid glyphs rendering fix
If for any reason an invalid glyph is found in text, 
it will now be skipped when rendering 
(instead of increasing offset by last valid glyph advance).

Issue: #2687
2024-09-30 16:44:22 +09:00
Mira Grudzinska
ec4b08245c lottie: handle trim path edge cases
According to the definition of trim path elements,
the begin and end values are specified as percentages
in the range of 0-100% (this is also confirmed by AE,
where it's not possible to exceed this range).
Added clamping to align with spec.
2024-09-30 16:44:22 +09:00
Mira Grudzinska
8b8a6ba3e7 common: introduce tvg::clamp 2024-09-30 16:44:22 +09:00
Mira Grudzinska
c9c8e35476 sw_engine: increased accuracy in dashing
The limit on leftovers was too small, which became
noticeable for animations with trimming - currently
implemented with the dashing alg.
The limit has been increased.
2024-09-30 16:44:22 +09:00
Hermet Park
44ca306841 sw_engine: fixed incorrect image blending operations
The anti-aliased outline color was incorrectly blended
at the multiply option.

The fix can be observed in the example:
'examples/lottie/resourcesguitar.json'

in order to do this, RenderMehthod::blend() method introduced
`bool direct` for figuring out the intermediate composition.
2024-09-30 16:44:22 +09:00
Mira Grudzinska
1fc0546dea common: uint8_t version of the lerp
An uint8_t version of the lerp function
is introduced to handle cases where
the interpolation factor t exceeds 1, which
previously caused overflow issues due to casting.
2024-09-30 16:44:22 +09:00
Hermet Park
82f2ce4bd4 lottie/expressions: rectified $bm_sum()
Added only a single element to x.
2024-09-30 16:44:22 +09:00
Hermet Park
b660a99bca lottie/expressions: hotfix a crash
Stabilized $bm_sum(), by allowing the different dimensional
arguments.

issue: https://github.com/thorvg/thorvg/issues/2664
2024-09-30 16:44:22 +09:00
JunsuChoi
faec19bff6 svg_loader: Adjust hsl values out of range
The range of saturation and brightness values is 0 ~ 100% and range of hue is 0 ~ 360.
If a value greater than 100% is loaded, it will be modified to be 100%.

issue: https://github.com/thorvg/thorvg/issues/2678
2024-09-30 16:44:22 +09:00
Mira Grudzinska
d7405e7be8 lottie: fix trim
The bug caused the trim path to not be applied
when it appeared in a group between different
shapes.
2024-09-30 16:44:22 +09:00
Mira Grudzinska
362b51028d lottie: fix trim path regression
To avoid editing the trim path values provided
by the user, the logic for their interpretation
was moved from the API to the renderer (7c87d8e).
This caused an issue in the lottie animations when
the trim path is applied more than once. Now fixed.

@issue: https://github.com/thorvg/thorvg/issues/2670
2024-09-30 16:44:22 +09:00
Łukasz Pomietło
cde6a24b1b renderer/text: fix a missing text update
previously font size & italic style had been ignored
even if its attributes are changed.

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

issue: https://github.com/thorvg/thorvg/issues/2676
2024-09-30 16:44:22 +09:00