Commit graph

2631 commits

Author SHA1 Message Date
Hermet Park
56c4859138 saver: ++robustness
do not delete the given picture if the reference counting is
more than 0.
2024-04-06 12:08:21 +09:00
Mira Grudzinska
115c0242c3 common: Changing the rounded rect starting point
According to the SVG standard, drawing a rectangle
starts at (x+rx, y) point. Till now it was (x+w, y+ry).
The difference was visible only for dashed strokes.
2024-04-06 12:08:21 +09:00
Mira Grudzinska
1b3505e74f common: Changing the circle/ellipse starting point
According to the SVG standard, drawing a circle/ellipse
should start at the '3 o'clock' position and proceed
in a clock-wise direction. Until now, this point was
set at '12 o'clock'.
The differences in the outcome were visible for dashed
strokes.

issue: https://github.com/thorvg/thorvg/issues/1686
2024-04-06 12:08:21 +09:00
Mira Grudzinska
a7bcc7b6d8 lottie: use internal append rect/ellipse func
The lottie format defines the starting point for
drawing rectangles and ellipses differently than
the API available in the TVG. In the case of using
dashes or trim paths, this leads to discrepancies.
Therefore, when using the lottie builder, internal
functions for appending rectangles and circles are
utilized.

@issue: https://github.com/thorvg/thorvg/issues/1997
2024-04-06 12:08:21 +09:00
Hermet Park
4dda73a8d2 Update README.md
Added an thorvg NPM link in the Lottie Player documentation.
2024-04-06 12:08:21 +09:00
Hermet Park
f03cff2353 examples: ++threading stability.
Ensure synchronous calls are made after updating the canvases.
2024-04-06 12:08:21 +09:00
Hermet Park
0f83850da6 binding/capi: support lottie extensions
these experimental apis are allowed to use
when the lottie loader is enabled.

APIs:
- Tvg_Animation* tvg_lottie_animation_new()
- Tvg_Result tvg_lottie_animation_override(Tvg_Animation* animation, const char* slot)
2024-04-06 12:08:21 +09:00
Hermet Park
97240a893a lottie: clean up code and minor bugs by mistake. 2024-04-06 12:08:21 +09:00
Jinny You
bafb8e2b86 examples: Added lottie advanced features example 2024-04-06 12:08:21 +09:00
Jinny You
c8a7e5b02e lottie: Introduce the LottieAnimation class
This class extends the Animation and serves advanced Lottie features.
It's designed to separately have Lottie Animation's unique specs.

For now, this will have Slot overriding feature,
you can include <thorvg_lottie.h> for its extensive features.

@APIs:
- Result LottieAnimation::override(const char* slotJson) noexcept;
- static std::unique_ptr<LottieAnimation> LottieAnimation::gen() noexcept;

@Issue: https://github.com/thorvg/thorvg/issues/1808
2024-04-06 12:08:21 +09:00
Jinny You
5ed068cec3 lottie: Support the slot overriding feature
Internal model and parser modifications have been made
to parse "sid" and retrieve their data into the LottieComposition.
This will enable dynamic changes to the following Lottie objects:

The slot feature will encompass these properties:

- LottieSolidStroke
- LottieSolidFill
- LottieGradientStroke
- LottieGradientFill
- LottieTextDoc"

Issue: https://github.com/thorvg/thorvg/issues/1808

Co-authored-by: Hermet Park <hermet@lottiefiles.com>
2024-04-06 12:08:21 +09:00
Vincent Torri
da6199a2bd Lottie loader: fix compilation on windows
strlen() was used in tvgLottieModel.h without the inclusion of
cstring. This patch fixes this
2024-04-06 12:08:21 +09:00
Jinny You
447a3d8ad5 lottie: Revise the solid model
To ensure consistent properties, `LottieSolid` has been defined.

Both `LottieSolidStroke` and `LottieSolidFill` can be typecasted to the `LottieSolid`.
2024-04-06 12:08:21 +09:00
Jinny You
e333ca9515 lottie: Revise the gradient model
Currently, the `LottieGradient` does not incorporate the `LottieObject` functionality.

It now inherits from the `LottieObject`.
2024-04-06 12:08:21 +09:00
JunsuChoi
c6cf9cb2cf svg: Improve valid check for url(#id)
Improve parenthesis checking and space checking.
 - There must be only one pair of parentheses.
 - There cannot be spaces(and ') between id strings.

Issue: https://github.com/thorvg/thorvg/issues/1983

Co-authored-by: Hermet Park <hermet@lottiefiles.com>
2024-04-06 12:08:21 +09:00
Hermet Park
2087db7ebf gl_engine: fix a compile warnings, errors.
../src/renderer/gl_engine/tvgGlRenderPass.cpp:35:34: warning: macro expands to multiple statements [-Wmultistatement-macros]
   35 |     if (mColorTex != 0) GL_CHECK(glDeleteTextures(1, &mColorTex));
      |                                  ^~~~~~~~~~~~~~~~
../src/renderer/gl_engine/tvgGlCommon.h:33:9: note: in definition of macro ‘GL_CHECK’
   33 |         x; \
      |         ^
2024-04-06 12:08:21 +09:00
Hermet Park
fe6493351a lottie: introduced LottieProperty base class
this is useful for slot & expression type casting.
2024-04-06 12:08:21 +09:00
Hermet Park
c08c11db7d common: code refactoring
refactor common code to consolidate Bezier and line
function implementations into a single location.
2024-04-06 12:08:21 +09:00
Hermet Park
71c636e33c Revert "Revert "sw_engine: Increasing accuracy for dashed curves""
This reverts commit e49f9125b2.
2024-04-06 12:08:21 +09:00
Hermet Park
c01c8338d7 Revert "sw_engine: Increasing accuracy for dashed curves"
This reverts commit a8c0030d80.
2024-04-06 12:08:21 +09:00
Mira Grudzinska
d399ae922a sw_engine: Increasing accuracy for dashed curves
Dashed curves require greater precision in calculating
their lengths and while splitting Bezier curves.
Otherwise, it results in visual discrepancies compared
to the expected outcomes.
Approximate functions 'bezLengthApprox' and 'bezAtApprox'
used for calculations in the lottie loader.

issue: https://github.com/thorvg/thorvg/issues/1686
2024-04-06 12:08:21 +09:00
Mira Grudzinska
e718940f81 sw_engine: fixing stroke outline
In the case of non-uniform scaling for
thick strokes, artifacts were visible.
The calculations took into account the angle
resulting from the already transformed points,
whereas the untransformed points should have
been considered - the transformation is taken
into account in the next step.

@issue: https://github.com/thorvg/thorvg/issues/1915
2024-04-06 12:08:21 +09:00
Sergii Liebodkin
345753a397 wg_engine: meson script fixed
[issues 1991: Basic steps to compile for linux (wg_beta, examples)](#1991)
2024-04-06 12:08:21 +09:00
JunsuChoi
81fcca06bc examples/picture/svg: Adjust size ratio
Adjust the image size and position to fit the window size.
2024-04-06 12:08:21 +09:00
Hermet Park
6b63c85404 lottie/parser: clean up the exception handling mechanisms.
Since the parser has become stable enough,
remove the exceptions and instead rely on parser error handling.
2024-04-06 12:08:21 +09:00
Hermet Park
b0540929e5 common/array: code refactoring
Make the array interface pair begin()/end() for consistency.
2024-04-06 12:08:21 +09:00
Hermet Park
213ebc15d3 Update CODEOWNERS 2024-04-06 12:08:21 +09:00
Hermet Park
aa07e98c7b loader/webp: do not expose webp apis.
this reduces the bin size around -1.5kb
2024-04-06 12:08:21 +09:00
Sergii Liebodkin
081f276f21 wg_engine: animation optimizations (part 1)
[issues 1479: update](#1479)

gpu vertex buffer reallocations optimization
2024-04-06 12:08:21 +09:00
Hermet Park
e559388f63 lottie: remove the duplicated binary search logic. 2024-04-06 12:08:21 +09:00
JunsuChoi
b400512fda loader/svg: Fix empty id to null
empty id is invalid. Therefore, set it to null and make it is not used.

issue: https://github.com/thorvg/thorvg/issues/1977
2024-04-06 12:08:21 +09:00
Jinny You
b7a57e65c1 web: code refactoring
improved code consistency:
- removed double-quotes on string literal.
- removed double-equals (==)
- updated comments
2024-04-06 12:08:21 +09:00
Martin Capitanio
3b96c14551 Portability: Fix compiler shadowing warning 2024-04-06 12:08:21 +09:00
Hermet Park
baf04d1cde webp: removed non-existing symbol methods. 2024-04-06 12:08:21 +09:00
Hermet Park
c64ed2ec03 loaders: enhance decoding efficiency
enhance decoding efficiency by determining the desired canvas format
during image loading. This allows loaders to preemptively decode
the image in the specified format, to not convert the format again.
2024-04-06 12:08:21 +09:00
Hermet Park
c4e6b03b84 loaders: decode the image with premultiplied alpha.
basically, the renderer requires images with premultiplied alpha.
2024-04-06 12:08:21 +09:00
Hermet Park
5d892c241c Revert "lottie: compatibility++"
This reverts commit c89f6253bf.

No more valid by 3f235d9e3f
2024-04-06 12:08:21 +09:00
Hermet Park
01cbbb19fc renderer/loader: enhance picture format compatibility
Attempt to load a given file/data using candidate formats
when the desired loader fails. This approach will enhance
the compatibility with various file formats in unexpected scenarios.

Previously, we had removed this feature, but have since
recognized its necessity due to the impact on file data
in specific corner cases.
2024-04-06 12:08:21 +09:00
Hermet Park
0df7c00917 renderer/canvas: fix a regression error.
just figured out & fixed a side effect by this change:
9e69089524
2024-04-06 12:08:21 +09:00
Hermet Park
da0e5f31c7 infra: remove codeql.
Currently, CodeQL is not functioning, but we have applied another tool:
https://www.codefactor.io/repository/github/hermet/thorvg
2024-04-06 12:08:21 +09:00
RuiwenTang
2855b9b339 gl_engine: add stencil and cover render task
* add new render task to do stencil and cover rendering which is a
  fallback rendering method to handle cases that trianglation tessellation
  failed

* add a new tessellator to generate stencil and cover vertex mesh
2024-04-06 12:08:21 +09:00
Hermet Park
a9d91e3620 Update CODEOWNERS 2024-04-06 12:08:21 +09:00
Hermet Park
bf6e9f638a Update CONTRIBUTING.md 2024-04-06 12:08:21 +09:00
Junsu Choi
e0eeaf54b0 loader/webp: Support static webp loader
Built to libwebp code in to support the static option of webp loader.
Code from :https://github.com/jacklicn/libwebp

This forking version only contains the minimal webp decoding feature.

Binary Size: +68kb

Co-authored-by: Hermet Park <hermet@lottiefiles.com>

issue: https://github.com/thorvg/thorvg/issues/1427
2024-04-06 12:08:18 +09:00
JunsuChoi
6a1249e77a infra/window: Remove version fix of meson
Version 0.58 find missing libraries and causes an error.
(ex: libwebp 1.0).
There is no need to fix the current version, so always use the latest version.
2024-04-05 18:01:28 +09:00
Hermet Park
d07eb87ca3 renderer/canvas: Optimize logic by removing paint verification.
Allow direct updates to the paint object without prior validation.
The verification process is deemed inefficient;
users are expected to ensure the paint is updated using a canvas
that contains it.

This might break the backward compatibility.
2024-04-05 18:01:28 +09:00
Hermet Park
2613521aa8 sw_engine: Improve image up-scaler quality
Adjusted the sampling position basis by -0.5 pixel
to enhance edge line interpolation quality.

This change addresses an issue with the image up-scaling process,
resulting in clearer and more accurate visuals.

issue: https://github.com/thorvg/thorvg/issues/1949
2024-04-05 18:01:28 +09:00
Hermet Park
ef5568fbd6 renderer: ensure canvas rendering continues despite invalid scene parts
Previously, the logic was set to halt rendering when any part of the paints,
particularly bitmap-based images, failed to render.

This update modifies the behavior to continue drawing the scene,
allowing for the successful rendering of other elements.

issue: https://github.com/thorvg/thorvg/issues/1951
2024-04-05 18:01:28 +09:00
RuiwenTang
9255c48bf5 gl_engine: enhance the tessellation algorithm
* merge vertices that are close enough before tessellation
* append return branch in tessellation to prevent dead loop caused by floating point precision
2024-04-05 18:01:28 +09:00
Hermet Park
8c3e76162b doc: updated dependencies section. 2024-04-05 18:01:28 +09:00