Commit graph

307 commits

Author SHA1 Message Date
Hermet Park
782f067b22 renderer: hotfix a null memory copy 2025-01-30 21:09:27 +09:00
faxe1008
6489e65064 common: Use explicit floating-point value types.
Co-Authored-By: Hermet Park <hermet@lottiefiles.com>
2025-01-16 18:34:12 +01:00
Hermet Park
e12765ef41 lottie: support default slot overriding
issue: https://github.com/thorvg/thorvg/issues/2915
2024-11-09 17:31:16 +09:00
Hermet Park
f42559e613 lottie/slot: revise gradient fill support
Revise gradient fill data parsing by adding support
for the color stop count (p) parameter in slot data.

issue: https://github.com/thorvg/thorvg/issues/2795
2024-11-08 12:46:03 +09:00
Hermet Park
5813e7e09f test/capi: fixed a memory leak 2024-10-04 01:53:10 +09:00
Hermet Park
8ebaf06ffd test: shutdown the false alram of the valgrind
- Conditional jump or move depends on uninitialised value(s)
2024-10-03 19:02:40 +09:00
Hermet Park
ee19380d50 tvg: updated binary with v0.15 tagging 2024-10-01 12:58:13 +09:00
Hermet Park
c39910cfd6 test: fix a memory leak 2024-10-01 12:58:13 +09:00
Mira Grudzinska
7e30bd850c tests: ++lcov 2024-09-30 16:44:22 +09:00
Hermet Park
d3edc0c5f7 api: clean up
promoted offical c++ apis (v0.15)
 - enum class BlendMethod
 - enum class CanvasEngine::Wg
 - virtual Result Canvas::viewport(int32_t x, int32_t y, int32_t w, int32_t h);
 - class Text
 - Result Text::fill(uint8_t r, uint8_t g, uint8_t b)
 - Result Text::fill(std::unique_ptr<Fill> f)
 - static Result Text::unload(const std::string& path)
 - static Result Text::load(const std::string& path)
 - static Result Text::load(const char* name, const char* data, uint32_t size, const std::string& mimeType = "ttf", bool copy = false)
 - static std::unique_ptr<Text> Text::gen()
 - class WgCanvas
 - static std::unique_ptr<WgCanvas> WgCanvas::gen()
 - static const char* Initializer::version(uint32_t* major, uint32_t* minor, uint32_t* micro)
 - class LottieAnimation

promoted official c apis (v0.15)
 - Tvg_Blend_Method
 - Tvg_Result tvg_engine_version(uint32_t* major, uint32_t* minor, uint32_t* micro, const char** version)
 - Tvg_Result tvg_canvas_set_viewport(Tvg_Canvas* canvas, int32_t x, int32_t y, int32_t w, int32_t h)
 - Tvg_Result tvg_paint_set_blend_method(Tvg_Paint* paint, Tvg_Blend_Method method)
 - Tvg_Paint* tvg_text_new(void)
 - Tvg_Result tvg_text_set_fill_color(Tvg_Paint* paint, uint8_t r, uint8_t g, uint8_t b)
 - Tvg_Result tvg_text_set_gradient(Tvg_Paint* paint, Tvg_Gradient* gradient)
 - Tvg_Result tvg_font_load(const char* path)
 - Tvg_Result tvg_font_load_data(const char* name, const char* data, uint32_t size, const char *mimetype, bool copy)
 - Tvg_Result tvg_font_unload(const char* path)
 - Tvg_Animation* tvg_lottie_animation_new(void)

removed experimental apis
 - BlendMethod paint::blend() const
 - bool Shape::strokeTrim(float* begin, float* end) const
 - Tvg_Result tvg_paint_get_blend_method(const Tvg_Paint* paint, Tvg_Blend_Method* method)
 - Tvg_Result tvg_shape_get_stroke_trim(Tvg_Paint* paint, float* begin, float* end, bool* simultaneous)
 - tvg_text_set_linear_gradient(Paint* paint, Tvg_Gradient* gradient)
 - tvg_text_set_radial_gradient(Paint* paint, Tvg_Gradient* gradient)

issue: https://github.com/thorvg/thorvg/issues/1372
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
371139e220 renderer: blending refactoring++
- reordered the blending types to align with lottie spec.
- removed source over.
2024-09-30 16:44:22 +09:00
Hermet Park
fac8ba3d9f renderer: text refactoring
- assign the shape instance as mandatory.
- assign the text instance internally.
2024-09-30 16:44:21 +09:00
Hermet Park
0f17f6c69a 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-09-30 16:44:21 +09:00
Elliott Sales de Andrade
ee19753f36 build: Remove redundant comparisons
If a Meson option is typed as `boolean`, the `get_option` returns a
boolean, and comparing it with `true` is redundant. Meson also errors if
you try to compare across types, so it couldn't _not_ be a boolean.

Also, Meson is not C, so no need for parentheses around `if` conditions.
2024-09-30 16:44:21 +09:00
Mira Grudzinska
2a342a5463 API: deprecate the appendArc() api
@Issue: https://github.com/thorvg/thorvg/issues/2632
2024-09-30 16:44:21 +09:00
Hermet Park
2942e76bae test: coverage enhancement
+ Accessor::id()
+ Picture::paint()
2024-09-30 15:49:14 +09:00
Hermet Park
730b0d23f0 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-09-30 15:48:18 +09:00
Hermet Park
21d3cc4eb9 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-09-30 15:48:18 +09:00
Łukasz Pomietło
2b3930b46d 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-09-30 15:48:13 +09:00
Mira Grudzinska
220764fde9 tests: version api tests 2024-09-30 15:35:45 +09:00
Hermet Park
78ece5befd renderer: Rectified the paint transforms.
This corrects the return value to Result::InsufficientCondition
when a custom transform is applied.

Additionally, unnecessary x and y member fields have been removed.
2024-09-30 12:57:14 +09:00
Hermet Park
4345d6b8a5 API: revise the APIs.
deprecate the `identifier()` APIs by replacing them with `type()`.

ThorVG is going to introduce an instance `id()`,
and this could be confused with the `identifier()` methods.

with this new type() method can reduce the memory size
by removing unncessary type data.

New Experimental C APIs:
- enum Tvg_Type
- Tvg_Result tvg_paint_get_type(const Tvg_Paint* paint, Tvg_Type* type)
- Tvg_Result tvg_gradient_get_type(const Tvg_Gradient* grad, Tvg_Type* type)

New Experimental C++ APIs:
- Type Paint::type() const
- Type Fill::type() const
- Type LinearGradient::type() const
- Type RadialGradient::type() const
- Type Shape::type() const
- Type Scene::type() const
- Type Picture::type() const
- Type Text::type() const

Deprecated C APIs:
- enum Tvg_Identifier
- Tvg_Result tvg_paint_get_identifier(const Tvg_Paint* paint, Tvg_Identifier* identifier)
- Tvg_Result tvg_gradient_get_identifier(const Tvg_Gradient* grad, Tvg_Identifier* identifier)

Deprecated C++ APIs:
- enum class Type
- uint32_t Paint::identifier() const
- uint32_t Fill::identifier() const
- static uint32_t Picture::identifier()
- static uint32_t Scene::identifier()
- static uint32_t Shape::identifier()
- static uint32_t LinearGradient:identifier()
- static uint32_T RadialGradient::identfier()

Removed Experimental APIs:
- static uint32_t Text::identifier()

issue: https://github.com/thorvg/thorvg/issues/1372
2024-09-30 12:55:16 +09:00
Josh Soref
e3c66db301 common: fix 178+ spelling errors 2024-09-30 12:41:38 +09:00
Hermet Park
a51c067894 test/capi: --compiler warning on MSVC
warning C4305: 'argument': truncation from 'double' to 'float'
2024-06-27 14:44:39 +09:00
Mira Grudzinska
ff3767da2b tests: ++coverage 2024-06-27 14:42:27 +09:00
Mira Grudzinska
e8702de059 tvg_saver: fix 'order' serialization
Serialization of the "order" attribute caused
the bytes counter to be overwritten, resulting
in the created TVG file being corrupted.
Correctly created tag.tvg file has been included
as a test resource..
2024-06-27 14:42:27 +09:00
Hermet Park
7ee3db0ce9 tvg: updated binaries 2024-06-27 14:42:27 +09:00
Hermet Park
bb9749094c test: corrected wrong test-suite.
The value should be out of the range to make "NonSupport"
2024-06-27 14:42:27 +09:00
Mira Grudzinska
a61286afaa tests: resolve different type comparison warning 2024-06-27 14:42:27 +09:00
Mira Grudzinska
410f58fa26 tests: add missing capi saver tests & ifdefs 2024-06-27 14:42:23 +09:00
Mira Grudzinska
03242b5367 common: add missing ifdef
In the absence of support for the TTF loader
crashes occurred. Fixed.
2024-06-24 14:56:36 +09:00
Mira Grudzinska
fd28cb9304 test: capi tests updated by text apis 2024-06-24 14:55:15 +09:00
Mira Grudzinska
5dfe2d92cf tests: add tests for text loading from memory 2024-06-24 14:54:42 +09:00
Hermet Park
dbb0fc9476 test: resolve compiler warnings on msvc.
warning C4305: 'argument': truncation from 'double' to 'float'
2024-06-24 14:43:25 +09:00
Hermet Park
d5f41c85d3 api: corrected return type.
NonSupport indicates unsupported options due to disabled features
or lack of system support. InvalidArgument indicates the case
such as incorrect parameter values.
2024-06-24 14:42:46 +09:00
Mira Grudzinska
20a0d1379e test: add strokeTrim tests 2024-06-24 14:41:22 +09:00
Hermet Park
407fcf69e3 common: code refactoring
Replace the math functions with operator overloading.
This should potentially reduce the code size.
2024-06-24 14:33:49 +09:00
Hermet Park
746c466df3 test: added viewport test 2024-06-24 14:29:19 +09:00
Hermet Park
e17fdbe3c6 test: clean up test suites
Merge two separate units: SwCanvas and SwCanvasBase.
2024-06-24 14:28:20 +09:00
Jinny You
f000d9f766 test/lottie: added the slot resetting in animated property case 2024-06-24 14:18:59 +09:00
Hermet Park
06553966e1 test/animation - added a frame counting test-suite. 2024-06-24 14:13:52 +09:00
Mira Grudzinska
b2be63a2d3 test: fix margin value
The precision margin for the comparison
has been set to 0.01f instead of 004004.
2024-06-24 14:11:54 +09:00
Hermet Park
374e4ab82f test: corrected wrong implementation.
identifier should have been methods.
2024-06-24 12:35:17 +09:00
Jinny You
911d14535d bindings/capi: Fix incompatible parameter
C API doesn't support default parameter, removed it.

Issue: #2228
2024-06-24 12:29:59 +09:00
Mira Grudzinska
548a201b93 build: add missing ifdef
The thorvg_lottie.h file wasn’t accessible
if the lottie loader was not activated,
causing a compilation error.
2024-06-24 12:18:10 +09:00
Jinny You
22513b2fea test/lottie: Add the segment use case 2024-06-24 12:05:34 +09:00
Rafał Mikrut
1c74e1e40a Finding crashes and adding comments 2024-06-24 11:57:28 +09:00
Hermet Park
f5cd67b77e tvg: updated binary resources to v0.13 2024-04-07 15:15:59 +09:00
Hermet Park
f578a8947f test: improve the test-coverage.
make the lottie/text coverage up.

issue: https://github.com/thorvg/thorvg/issues/2067
2024-04-07 15:15:59 +09:00