Commit graph

3382 commits

Author SHA1 Message Date
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
Hermet Park
6b0c81bf36 lottie/expressions: rectified $bm_sum()
Added only a single element to x.
2024-08-29 21:16:58 +09:00
Hermet Park
b36db92a7b lottie/expressions: hotfix a crash
Stabilized $bm_sum(), by allowing the different dimensional
arguments.

issue: https://github.com/thorvg/thorvg/issues/2664
2024-08-29 19:41:37 +09:00
JunsuChoi
dd223b4065 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-08-29 12:05:47 +02:00
Mira Grudzinska
bb3c6516e5 lottie: fix trim
The bug caused the trim path to not be applied
when it appeared in a group between different
shapes.
2024-08-29 17:30:41 +09:00
Mira Grudzinska
76c1b20dee 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-08-28 23:03:44 +09:00
Łukasz Pomietło
c92cf4e139 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-08-28 21:30:16 +09:00
Sergii Liebodkin
732a2be7e8 wg_engine: scene blending optimization
- used hardware blending stage for scene blending
- used AABB for scene blending
- reduced number of offfscreen buffers coping
- reduced number of render pass switching
- used render pipelines abilities to convert offscreen pixel format to screen pixel format
- removed unused shaders
2024-08-28 18:33:07 +09:00
Jinny You
747967638d wasm: fix typo 2024-08-27 17:33:56 +09:00
Hermet Park
45358a70ca lottie/parser: enable logs to notify missing features 2024-08-26 20:30:33 +09:00
Hermet Park
4fda695c3c lottie/expressions: Improve safety
- Prevent expression processing if a property fails to parse.
- Fixed an incorrect usage of JerryScript.

This is a hotfix to address expression-related crashes.
2024-08-25 23:11:47 +09:00
lpogic
df8c79fbc1 text: fixed a corrupted italic style application
issue: https://github.com/thorvg/thorvg/issues/2669
2024-08-24 21:45:13 +09:00
tangruiwen.mmh1103
5f5060dbf2 gl_engine: fix mistake in the calculation of stroke miter limit
* correct the stroke width and color calculation with scaling
* fix the miter limit calculation to make bevel join fallback correct
2024-08-24 13:57:48 +09:00
Hermet Park
df2d3a95f8 lottie/jerryscript: ++build reliance 2024-08-23 15:08:55 +09:00
Hermet Park
11b756791b common/math: remove inlining
Let the compiler decide whether to inline.
2024-08-23 14:41:02 +09:00
Mira Grudzinska
87d85047aa lottie: add offsetPath support
Due to the lack of an analytical solution for Bezier
curves offsetting, a simple and computationally cheap
approximation has been implemented. The algorithm shifts
the segments connecting control points and determines
new points based on their intersections.

@issue: https://github.com/thorvg/thorvg/issues/2230
2024-08-23 01:18:50 +09:00
Mira Grudzinska
e4ec2a8a0e lottie: roundness refactored based on #2295 2024-08-23 01:18:50 +09:00
Mira Grudzinska
6bb95883e5 common: prevent warning - expression result unused 2024-08-22 22:54:00 +09:00
Hermet Park
82c1e68b16 renderer/text: --memory leak
regression by 71d3fce1dd
2024-08-22 22:39:35 +09:00
Hermet Park
00127cba54 sw_engine/texmap: ++fixed memory access violation
Co-Authored-By: Mira Grudzinska <mira@lottiefiles.com>
2024-08-22 22:39:35 +09:00
Mira Grudzinska
09313ae307 lottie: fix text update
The occurrence of a 'carriage return' (13) or 'end of text' (3)
caused the skipping of the next character check, immediately
searching for it in the list of available characters.
If the next character was also 13 or 3, it led to incorrect
interpretation; however, if it was the last character in the
sequence, a crash occurred.
2024-08-22 21:27:25 +09:00
Hermet Park
ac384332fe examples: added image rotation 2024-08-22 13:01:53 +09:00
Mira Grudzinska
ed38e1e0e0 sw_engine: fix TexmapPolygon rastering
The y range initialization was missing a check to ensure
that the height is a positive value. This could lead to
an attempt to call malloc with a negative argument, which
cast to an unsigned value, caused a crash.
2024-08-21 18:46:02 +09:00
Jinny You
58db802ac1 wasm: code refactoring
Introduced the abstract EngineMethod to handle
different engines more effectively using polymorphism.

Co-authored-by: Jinny You <jinny@lottiefiles.com>
2024-08-21 17:17:50 +09:00
Hermet Park
71d3fce1dd renderer: text refactoring
- assign the shape instance as mandatory.
- assign the text instance internally.
2024-08-21 14:51:53 +09:00
Hermet Park
c75311d239 api: corrected wrong const specifier
Setter obvisouly modifies the instance.
2024-08-21 14:50:40 +09:00
Mira Grudzinska
022f9fc897 examples: capi example ++
Animation is loaded from a memory instead from a file.
2024-08-20 18:46:29 +09:00