Commit graph

3158 commits

Author SHA1 Message Date
Hermet Park
2e9641d061
Update README.md 2024-09-22 01:36:28 +09:00
Hermet Park
0e2d1dfcfa common: code refactoring
Properly renamed internal interfaces.
No logical changes.

- Compositor -> RenderCompositor
- Surface -> RenderSurface
2024-09-21 16:37:37 +09:00
JunsuChoi
853d701d27 svg_loader: Fix calculation when stroke-width unit is percentage
When stroke-width unit is percentage, loader refer to the normalized diagonal of viewport.
+) Add Diagonal type so as not to affect existing types.

https://svgwg.org/svg2-draft/painting.html#StrokeWidth
https://svgwg.org/svg2-draft/coords.html#Units

example)
```
<svg width="100" height="50" xmlns="http://www.w3.org/2000/svg">
   <rect x="15" y="15" width="70" height="20" fill="none" stroke="#F00" stroke-width="10%"/>
   <rect x="15" y="15" width="70" height="20" fill="none" stroke="#00F" stroke-opacity=".3" stroke-width="10"/>
</svg>

```

related issue: https://github.com/thorvg/thorvg/issues/2131
2024-09-20 21:29:36 +09:00
Hermet Park
6712861154 lottie: --type casting warning in MSVC 2024-09-19 23:23:29 +09:00
Sergii Liebodkin
79d4d64e4a wg_engine: fix strokes triangulation artifacts
Fixed detection of close vertices using comparison with epsilon and related artifacts in stencil buffer as extra pixels.
Fixed incorrect tessellation of curves using scaling.
2024-09-19 16:51:41 +09:00
Hermet Park
03dbb7a8e1 examples: updated a lottie sample 2024-09-19 15:30:40 +09:00
Jinny You
d70ddcd67c 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-19 15:29:38 +09:00
Hermet Park
d70aa68dcc test: replaced ClipPath with clip() 2024-09-19 14:46:05 +09:00
Hermet Park
ece1537271 examples: replaced ClipPath with clip() 2024-09-19 14:46:05 +09:00
Hermet Park
b0683a26ec 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-19 14:46:05 +09:00
Jinny You
b9b1336817 lottie/text: hotfix for parsing text range issue
If randomize is not enabled, "rn" prop falls into skip()
2024-09-19 14:41:37 +09:00
RuiwenTang
1fe9f269b1 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-19 11:58:38 +09:00
Jinny You
9c5933a4e5 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-19 11:05:24 +09:00
Mira Grudzinska
84ba907b70 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-18 18:23:37 +09:00
Hermet Park
ae6faf56c5 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-17 21:13:59 +09:00
Hermet Park
5fc52ea6b0 renderer: hotfix a crash
prevent a nullptr memory access
regression by f5337015e9

issue: https://github.com/godotengine/godot/issues/97078
2024-09-17 11:53:01 +09:00
Hermet Park
a633322b8b lottie: ++expressions coverage
added missing velocityAtTime() for float types.

issue: https://github.com/thorvg/thorvg/issues/2724
2024-09-15 17:04:27 +09:00
Hermet Park
0e06413749 Revert "examples: updated samples"
This reverts commit 1e72e8f3a3.
2024-09-15 15:24:36 +09:00
Hermet Park
1e72e8f3a3 examples: updated samples 2024-09-15 00:19:33 +09:00
Hermet Park
68fff066fc lottie: fixed memory violation.
set the dirName as the current location by default.

issue: https://github.com/thorvg/thorvg/issues/2733
2024-09-14 15:33:15 +09:00
Sergii Liebodkin
7a6a89cf26
wg_engine: wrong gradient transformation fixed
issue: https://github.com/thorvg/thorvg/issues/2620
2024-09-13 13:36:21 +09:00
Hermet Park
91a538d1f2
Update README.md 2024-09-13 13:03:18 +09:00
Hermet Park
4f9540dd30
Update README.md 2024-09-13 13:02:28 +09:00
Hermet Park
c562d63487 examples: updated lottie resources 2024-09-13 11:03:41 +09:00
Jinny You
fbe6d59c04 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-12 22:01:26 +09:00
Hermet Park
9f43039403 sw_engine: clean up code 2024-09-12 21:57:26 +09:00
Hermet Park
7aacae170f 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-12 21:57:26 +09:00
Hermet Park
c974940016 sw_engine: Added missing matting and blending for direct images
issue: https://github.com/thorvg/thorvg/issues/1767
2024-09-12 21:57:26 +09:00
Hermet Park
0962c55c82
Update README.md 2024-09-12 12:56:51 +09:00
Mira Grudzinska
bf9f5ab1c5 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-10 19:02:24 +09:00
Hermet Park
6775f6e463 sw_engine: blending stabilization++
Currently, only blending might work.
Blending and composition must be handled together.
2024-09-10 14:55:04 +09:00
Jinny You
3f67c38c50
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-10 11:44:32 +09:00
Hermet Park
a746e1fcd6 renderer: blending refactoring++
- reordered the blending types to align with lottie spec.
- removed source over.
2024-09-09 21:18:13 +09:00
Jinny You
b59e833c65
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-09 12:03:59 +09:00
Hermet Park
4b46337516 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-07 01:54:26 +09:00
Hermet Park
2a33096582 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-06 21:18:21 +09:00
Hermet Park
dd6ad0fc6e api: clean form++ 2024-09-06 14:32:02 +09:00
Sergii Liebodkin
e2e4fc6964
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-06 13:08:58 +09:00
Hermet Park
d807ac91ea examples: ++svg samples 2024-09-05 23:52:22 +09:00
Mira Grudzinska
ce61a33756 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-05 23:47:30 +09:00
Hermet Park
ae4240f48e common: remove redundant code 2024-09-05 23:40:32 +09:00
Hermet Park
6baeca91d8 common/math: replace isinfinite() with isinf() 2024-09-04 03:00:13 +09:00
Mira Grudzinska
6db6672567 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-04 02:52:16 +09:00
Hermet Park
c1c51fbc10 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-03 19:03:54 +09:00
Łukasz Pomietło
31e7d44a92
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-02 17:44:31 +09:00
Mira Grudzinska
ac2b5c86e6 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-02 11:47:30 +09:00
Mira Grudzinska
59f950e71b common: introduce tvg::clamp 2024-09-02 11:47:30 +09:00
Mira Grudzinska
b71b329a01 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-01 01:29:05 +09:00
Hermet Park
38697022f0 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-08-30 00:53:44 +09:00
Mira Grudzinska
078b1c8d86 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-08-29 23:56:45 +09:00