Commit graph

3014 commits

Author SHA1 Message Date
Hermet Park
65c808fc02 common: spec out TexMap
Spec out this incomplete experimental feature,
this is a still promising one, we will reintroduce
this officially after 1.0 release

size: -2kb

issue: https://github.com/thorvg/thorvg/issues/1372
2024-08-23 10:45:14 +09:00
Elliott Sales de Andrade
eb462c6e32 build: Override dependency for use as subproject
A pkgconfig file is already provided, which enables using `thorvg` once
it is installed. However, this file is not, and cannot be, available at
setup time if using `thorvg` as a subproject.

In such cases, Meson provides the `override_dependency` mechanism for a
subproject to tell its parent how to use it.
2024-08-23 10:35:35 +09:00
Hermet Park
ac729068f5 lottie: ensure a null terminator at the end of the copied data
In certain cases, the user might want to set mapped memory directly.
This update ensures that a null terminator is appended to the string data.

Co-Authored-By: Mira Grudzinska <mira@lottiefiles.com>

Issue: https://github.com/thorvg/thorvg/issues/2642
2024-08-23 10:35:23 +09:00
Hermet Park
82563bf29a doc: hotfix 2024-08-20 11:50:29 +09:00
Hermet Park
03d4b754df bump up version 0.14.6 2024-08-15 23:19:13 +09:00
Mira Grudzinska
183b67b967 lottie: prioritization of roundness in rectangles
Added prioritization of rectangle roundness over
rounded corners, in line with AE results.
2024-08-15 23:18:51 +09:00
Hermet Park
8927294374 common: spec out Scene Clipper
Scene Clipper is an unusual feature
that is too unstable and ambiguous in ThorVG.

Users can achieve the same functionality
with multiple composed shapes instead of scene clipping.

size: -2.5kb

issues:
- https://github.com/thorvg/thorvg/issues/1548
- https://github.com/thorvg/thorvg/issues/1549
- https://github.com/thorvg/thorvg/issues/1573
2024-08-15 23:18:39 +09:00
Mira Grudzinska
4af3825bc3 lottie: handle edge case for rounded rect
For rounded rectangles the roundness value should
be determined using to the formula:
r = min(r, max(size.x, size.y)/2)
rather than the previous method:
r = min(size.x/2, size.y/2, r)
2024-08-15 23:14:19 +09:00
Hermet Park
e0a8a9b25f wasm: thorvg canvas resize problem.
The canvas syncs before changing a target buffer.

issue: https://github.com/thorvg/thorvg/issues/2580
2024-08-15 23:14:12 +09:00
Hermet Park
9fe0b001d6 lottie: code refactoring
getting too many parameters,
migrated static functions to class member functions,
reducing the binary size by 2KB

no logical changes
2024-08-15 23:14:04 +09:00
Hermet Park
331ea0cae3 lottie: ++scene rendering optimization
Apply LottieRenderPooler to RenderContext propagators.
2024-08-15 23:13:52 +09:00
Hermet Park
142cb05e63 lottie: ++scene rendering optimization
Apply LottieRenderPooler to maskings.
2024-08-15 23:10:27 +09:00
Mira Grudzinska
7e19a960d8 lottie: handle rounded polygons
The implementation of rounded polygons was
mistakenly omitted, now has been added.

@Issue: https://github.com/thorvg/thorvg/issues/2624
2024-08-15 23:10:15 +09:00
Hermet Park
a04ebe18f3 bump up version v0.14.5 2024-08-09 11:33:38 +09:00
Mira Grudzinska
6902c790d2 common: add missing consts
Adding const was necessary to allow calling
the functions on constant objects.
2024-08-09 11:33:38 +09:00
Mira Grudzinska
fdc45edf32 common: increase precision for bezier calculations
The epsilon value currently used for the precision
of Beziers calculations is sufficient for comparing
curve lengths. However, for the parameter t, which
ranges from 0 to 1, an accuracy of 1% can introduce
errors.
The solution is to increase the precision for the t
parameter while keeping the rest of the calculations
at the previously used epsilon value.

@Issue: https://github.com/thorvg/thorvg/issues/2619
2024-08-09 11:33:38 +09:00
Hermet Park
0776216ed0 infra: switch the optimization option to level 3
In case of modern systems, size is not a big problem,
so we turn the optimization option to default
for better performance.

FPS: ~20% enhanced
Size: ~25% increased

Note that this doesn't affect to the web player.
2024-08-09 11:33:38 +09:00
Hermet Park
b88ccd2cfc renderer: rectified the bounds() behavior
Text fill is broken by 43c87b4eb5
2024-08-09 11:33:38 +09:00
Hermet Park
96c8c17d33 lottie: support matte+masking combination
introduced an intermediate scene for embracing
the matte and maskings
2024-08-09 11:33:38 +09:00
Hermet Park
e0e00fe6fe lottie/expressions: rectified fill color support
Assign the fill color value properly.
2024-08-09 11:33:38 +09:00
Hermet Park
b40ef5b6a9 lottie: code refactoring
Moved common data declarations to tvgLottieCommon.h.
2024-08-09 11:33:38 +09:00
Hermet Park
8da5d0663a lottie/expressions: revised exception handlings 2024-08-09 11:33:38 +09:00
Hermet Park
82d8601df0 lottie/model: implement the missing property() interface 2024-08-09 11:33:38 +09:00
Hermet Park
6ef1986fe1 renderer/paint: revise the Paint::bounds() behavior
The current Paint::bounds(transform=true) returns the coordinates
of the paint in its local coordinates after transformation.

However, it did not convert the origin to the world coordinate.

This is problematic when the user wants to determine
the paint's position and size with the origin being the canvas.
Specifically, this matters that when the paint is belonged
to a certain scene.

Now, the bounds() method returns the coordinates
of the paint's bounding box with the corrected world space.
User can figure out the actual boundary within the painted result.

Remark that, this may break the functional behavior compatibility.
2024-08-09 11:33:38 +09:00
Hermet Park
7ec8d2f392 renderer/picture: added a method to search for a paint object
This utility method allows access to a specific paint instance
by its unique identifier.

Experimental API:
- const Paint* Picture::paint(uint32_t id)
- const Tvg_Paint* tvg_picture_get_paint(Tvg_Paint* paint, uint32_t id)
2024-08-09 11:33:38 +09:00
Hermet Park
e9b69cb7eb renderer/accessor: added the id generator.
This function computes a unique identifier value based on the provided string.
You can use this to assign a unique ID to the Paint object.

Experimental APIs:
- uint32_t Accessorr::id(const char* name)
- uint32_t tvg_accessor_id(const char* name)
2024-08-09 11:33:38 +09:00
Hermet Park
e082602064 API: introduce a Paint ID member as a reserved field
The "id" is a reserved field to specify a paint instance in a scene.
in this change, it assigns the layer id to the lottie scene as well.
2024-08-09 11:33:38 +09:00
Hermet Park
7afe90ce8e renderer/accessor: revise set() api for animation support
before:
unique_ptr<Picture> Accessor::set(unique_ptr<Picture> picture, function<bool(const Paint* paint)> func)

after:
Result Accessor::set(const Picture* picture, std::function<bool(const Paint* paint, void* data)> func, void* data)
2024-08-09 11:33:38 +09:00
Hermet Park
b20d5da552 renderer: newly support the Lighten/Darken Masking options
Lighten is applied, where multiple masks intersect,
the highest transparency value is used.

Darken is applied, where multiple masks intersect,
the lowest transparency value is used.

Experimental API:
- CompositeMethod::LightenMask
- CompositeMethod::DarkenMask

issue: https://github.com/thorvg/thorvg/issues/2608
2024-08-09 11:33:38 +09:00
Stephan T. Lavavej
82aa0c2bf4 Revert "common: fix a crash on CI windows test."
This reverts commit e51dfb068a.
2024-08-09 11:33:38 +09:00
Hermet Park
52f68b79b6 lottie/expressions: add missing expressions property updates
apply expressions to separate x/y transform coordinates.
2024-08-09 11:33:38 +09:00
Mira Grudzinska
5ff9c08ba9 sw_engine: handle grad edge cases
For a linear gradient defined by identical start and end
points, and for a radial gradient with a radius of 0,
the rendered shape should have the color of the last
specified color stop.
The documentation has been updated accordingly.

@Issue: https://github.com/thorvg/thorvg/issues/2582
2024-08-09 11:33:38 +09:00
Hermet Park
a5f69a9bbc lottie: remove useless condition check.
lottie is always animatable.
2024-08-09 11:33:38 +09:00
Mira Grudzinska
2f21e76d85 common: fix trimming
By mistake > was used instead of >=.
The issue was observed for trim when
the trim length was exactly zero.
2024-08-09 11:33:38 +09:00
Mira Grudzinska
1ef9c6be9b common: move&fix trimming wrapping logic
The logic of interpretation of trimming start and
end values has been moved to the sw_engine,
so the values provided by the user are not modified.
No logical changes in the interpretation alg.

For pairs of trim's start/end values where the distance
between begin and end is >= 1, the entire stroke should
be drawn, but instead, nothing or only part is drawn. Fixed.

Stroke trim docs fixed.
2024-08-09 11:33:38 +09:00
Hermet Park
a85f323425 lottie/expressions: feature enhancement
added groupIndex() support
added property (ix) value support
2024-08-09 11:33:38 +09:00
Hermet Park
a70c211409 lottie: code refactoring
Access its type from a property instance,
through coherent data structure.
2024-08-09 11:33:38 +09:00
Łukasz Pomietło
045b30b94f ttf_loader: Basic support for composite glyphs loading (#2600)
Adds the ability to load some composite glyphs and prevents an error when a composite glyph is used.

Implementation based on ttf glyf table documentation: https://learn.microsoft.com/en-us/typography/opentype/spec/glyf

There are still some missing features like scaling, parent glyph point based positioning etc. I think this is a topic for future work. Howerever, it looks like implemented features are enough for utf-8 latin subset in major fonts.

issue: #2599
2024-08-09 11:33:33 +09:00
Hermet Park
8c4b9b2772 renderer: code refactoring
Replaced the transformation with
a strong associated data field.

This helps to reduce the binary size (-1k).
2024-08-09 10:49:26 +09:00
Hermet Park
0c709b2e43 common: code refactoring
Trimming the transform data pass,
from RenderTransform to Matrix.

No logical changes.
2024-08-09 10:37:39 +09:00
Mira Grudzinska
273fe5b46d sw_engine: fix radial coefficients calculations
In the Taylor series expansion, there was a missing
division by 2! in the term with the second derivative.

@Issue: https://github.com/thorvg/thorvg/issues/2530
2024-08-09 10:29:53 +09:00
Hermet Park
3fb017c2fb examples/text: hotfix
corrected wrong arguments.
2024-08-08 12:37:10 +09:00
Hermet Park
ece447895a bump up version v0.14.4 2024-07-26 13:05:37 +09:00
Hermet Park
84475df8ab lottie/expressions: hotfix
- fixed a memory leak.
- corrected loopIn key value.
2024-07-26 13:05:37 +09:00
Hermet Park
267a467dab sw_engine: rectified the image raster return value.
Return the raster image as a success unless
it fails due to any problematic condition.

The changed cases are just invisible condition
of the images.
2024-07-26 12:13:37 +09:00
Hermet Park
57e0d5b448 renderer/animation: rectified the segment value exception
A zero-range segment can be useful for a stopped motion.
There is no need to prohibit these values.
2024-07-26 11:37:16 +09:00
Hermet Park
b95ddd3112 lottie/expressions: feature support enhancement
- revised the transformation building logic.
- rectified to properly search "this" composition layers.
- rectified the linear interpolation implementation.
- added "pingpong" looping attributes.
2024-07-26 11:37:16 +09:00
Hermet Park
6d97172227 lottie: code refactoring
- removed unnecessary variables.
- migrated the composition methods to the precomp layer.
2024-07-26 11:37:16 +09:00
Mira Grudzinska
641fe5b544 sw_engine: fix linear grad issue
The restriction of the 'length' of a linear gradient
to values greater than FLT_EPSILON was causing rendering
issues in cases where it was a valid gradient with well
defined dx and dy values.

@Issue: https://github.com/thorvg/thorvg/issues/2582
2024-07-26 11:37:16 +09:00
Hermet Park
771b401f90 svg: resolve compiler warnings.
../src/loaders/svg/tvgSvgLoader.cpp: In function ‘bool _toColor(const char*, uint8_t*, uint8_t*, uint8_t*, char**)’:
../src/loaders/svg/tvgSvgLoader.cpp:108:17: warning: ‘hue’ may be used uninitialized [-Wmaybe-uninitialized]
  108 |     const char* _end = end ? *end : nullptr;
      |                 ^~~~
../src/loaders/svg/tvgSvgLoader.cpp:713:31: note: ‘hue’ was declared here
  713 |         const char *content, *hue, *saturation, *brightness;
      |                               ^~~
../src/loaders/svg/tvgSvgLoader.cpp:108:17: warning: ‘saturation’ may be used uninitialized [-Wmaybe-uninitialized]
  108 |     const char* _end = end ? *end : nullptr;
      |                 ^~~~
../src/loaders/svg/tvgSvgLoader.cpp:713:37: note: ‘saturation’ was declared here
  713 |         const char *content, *hue, *saturation, *brightness;
      |                                     ^~~~~~~~~~
../src/loaders/svg/tvgSvgLoader.cpp:108:17: warning: ‘brightness’ may be used uninitialized [-Wmaybe-uninitialized]
  108 |     const char* _end = end ? *end : nullptr;
      |                 ^~~~
../src/loaders/svg/tvgSvgLoader.cpp:713:50: note: ‘brightness’ was declared here
  713 |         const char *content, *hue, *saturation, *brightness;
      |                                                  ^~~~~~~~~~
2024-07-26 11:37:16 +09:00