Commit graph

289 commits

Author SHA1 Message Date
Hermet Park
f5337015e9 renderer: text refactoring
- assign the shape instance as mandatory.
- assign the text instance internally.
2024-08-23 10:45:55 +09:00
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
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
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
Ł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
e12a244b9e 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-07-12 11:01:01 +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
Jinny You
62e7f0a7c6 test/lottie: added the slot resetting use case 2024-04-06 12:08:23 +09:00
Rafał Mikrut
71f596b173 Better regression testing 2024-04-06 12:08:22 +09:00
Jinny You
fb20938b14 test: Added test code for the lottie slot
This patch adds the test case for the recently introduced lottie slot API.

@Issues: https://github.com/thorvg/thorvg/issues/2029
2024-04-06 12:08:21 +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
a8fc3a6e50 renderer: revise the internal logic.
dispose of the resources at the end of the paint deletion.
This will help retain the resources of the retained paints
and reuse them after reconstructing the next scene.
2024-04-05 17:46:32 +09:00
Jinny You
92288c8291 updated copyright date (#1866) 2024-01-02 20:34:12 +09:00
Hermet Park
6f19c581e8 infra: renamed the folders, images -> resources.
these folders might have more than images.
2024-01-02 20:34:10 +09:00
Hermet Park
f98d01c2c5 test: added gif save test
Skipped capi tests this time, since it has no saver api now.
2024-01-02 20:34:06 +09:00
Hermet Park
0832a188fe animation/lottie: updated the frame count unit.
replace the frame count unit from the int32_t to float
since animations could smoothly interpolate key-frames.

This notificably improve the animation smoothness in Lottie

Beta API changes:
Result Animation::frame(uint32_t no) -> Result Animation::frame(float no)
uint32_t Animation::curFrame() const -> float Animation::curFrame() const
uint32_t Animation::totalFrame() const -> float Animation::totalFrame() const
2023-12-26 17:51:53 +09:00
Hermet Park
c7123a1547 test: enhanced the unit-test coverage
supplements animation/lottie/sw_engine test cases.

updated the page: https://github.com/thorvg/thorvg/wiki/Unit-Tests

Issue: https://github.com/thorvg/thorvg/issues/1669
2023-09-26 10:48:33 +09:00
Hermet Park
2f1873f04e test/capi: update unit tests
added a Tvg_Composite_Method::TVG_COMPOSITE_METHOD_NONE case
2023-09-25 21:33:23 +09:00
Hermet Park
87dee3c1f7 loader/lottie: fix a memory leak
A dangling scene instance should be deleted properly.
2023-09-18 10:41:00 +09:00
Hermet Park
7d797ee548 Yet we don't break apis, this patch reverts the next:
cb36c25aff
8c0fc2b25a
c1e4e0808a

Those reverted changes sholud be in the bucket, the next issue item:

@Issue: https://github.com/thorvg/thorvg/issues/1372
2023-08-24 01:00:57 +09:00
Mira Grudzinska
cb36c25aff test: dashed stroke with offset added 2023-08-23 12:40:27 +09:00
Mira Grudzinska
8c0fc2b25a capi: dashed stroke setter and getter modyfied
tvg_shape_set_stroke_dash() and tvg_shape_get_stroke_dash()
require an extra argument: offset
2023-08-23 12:40:27 +09:00
Hermet Park
3eca77b280 infra wasm: remove useless wasm test.
the test hasn't been maintained properly,
and we won't be maintaining it anymore.

please use thorvg.viewer intead. it's much more accurate.
2023-08-04 15:09:28 +09:00
Hermet Park
0e97d21752 common canvas: Alter the concept of the Canvas::clear() API.
We've changed the behavior of Canvas::clear(false).

The canvas::clear(false) now retains the paints, allowing the user to update the next frame
more easily without having to recompose the paint list.

Previously, clear(false) removed the paint list from the canvas,
requiring the user to re-push all of them in the next frame.

Now, we offer the Canvas::paints() API, allowing users to modify the paint list directly instead.

This change will break compatibility with previous versions of Canvas.

Therefore, this update is included in ThorVG 1.0.

@Issue: https://github.com/thorvg/thorvg/issues/1372
2023-08-02 17:23:53 +09:00
Mira Grudzinska
c5a02b90df tests: bounds test ++
The 'transformed' arg of the 'bounds' api
wasn't tested. Added.
2023-08-01 14:53:12 +02:00