Commit graph

343 commits

Author SHA1 Message Date
Hermet Park
8f9d82c314 test/capi: --compiler warning on MSVC
warning C4305: 'argument': truncation from 'double' to 'float'
2024-06-27 14:43:53 +09:00
Mira Grudzinska
f26bdeba8d tests: ++coverage 2024-06-26 22:06:19 +09:00
Mira Grudzinska
a56fc81733 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-26 14:15:50 +09:00
Hermet Park
d3b7da9f97 release: updated tvg binaries 2024-06-24 17:35:14 +09:00
Hermet Park
9fb8a49d52 renderer/canvas: ++exceptional handling.
do not allow change the target if the condition is not satisfied.
2024-06-24 01:29:57 +09:00
Hermet Park
8540246178 test: corrected wrong test-suite.
The value should be out of the range to make "NonSupport"
2024-06-21 16:28:20 +09:00
Mira Grudzinska
fac78c50d9 tests: resolve different type comparison warning 2024-06-21 10:12:40 +09:00
Mira Grudzinska
25370f438e tests: add missing capi saver tests & ifdefs 2024-06-20 00:03:07 +09:00
Mira Grudzinska
a337a8c57a common: add missing ifdef
In the absence of support for the TTF loader
crashes occurred. Fixed.
2024-06-19 20:08:14 +09:00
Mira Grudzinska
b14b8375f6 test: capi tests updated by text apis 2024-06-18 10:50:53 +09:00
Mira Grudzinska
cb47dc0d28 tests: add tests for text loading from memory 2024-06-17 11:45:25 +09:00
Hermet Park
0cd256f99c test: resolve compiler warnings on msvc.
warning C4305: 'argument': truncation from 'double' to 'float'
2024-06-07 23:56:30 +09:00
Hermet Park
ade5eb2e8d 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-05 23:03:05 +09:00
Mira Grudzinska
669b5badf4 test: add strokeTrim tests 2024-06-05 11:55:36 +09:00
Hermet Park
a1818cf62b common: code refactoring
Replace the math functions with operator overloading.
This should potentially reduce the code size.
2024-05-27 10:48:46 +09:00
Hermet Park
a8de40818e test: added viewport test 2024-05-18 18:10:50 +09:00
Hermet Park
de75c58b89 test: clean up test suites
Merge two separate units: SwCanvas and SwCanvasBase.
2024-05-18 18:10:50 +09:00
Jinny You
baaae5e416 test/lottie: added the slot resetting in animated property case 2024-05-16 17:46:54 +09:00
Hermet Park
ad183c0586 test/animation - added a frame counting test-suite. 2024-05-14 15:28:48 +09:00
Mira Grudzinska
6a9a390e9d test: fix margin value
The precision margin for the comparison
has been set to 0.01f instead of 004004.
2024-05-14 13:22:49 +09:00
Hermet Park
ac295f32e2 test: corrected wrong implementation.
identifier should have been methods.
2024-05-09 10:27:39 +09:00
Jinny You
55c4d6fe28 bindings/capi: Fix incompatible parameter
C API doesn't support default parameter, removed it.

Issue: #2228
2024-04-30 23:19:24 +09:00
Mira Grudzinska
51eec98aae build: add missing ifdef
The thorvg_lottie.h file wasn’t accessible
if the lottie loader was not activated,
causing a compilation error.
2024-04-17 00:00:32 +09:00
Jinny You
cc53bce8ab test/lottie: Add the segment use case 2024-04-14 23:54:26 +09:00
Rafał Mikrut
7a955108d6 Finding crashes and adding comments 2024-04-09 11:42:59 +09:00
Hermet Park
e6b87b270c tvg: updated binary resources to v0.13
issue: https://github.com/thorvg/thorvg/issues/2067
2024-04-06 15:06:20 +09:00
Hermet Park
b0f258d531 test: improve the test-coverage.
make the lottie/text coverage up.

issue: https://github.com/thorvg/thorvg/issues/2067
2024-04-05 16:51:22 +09:00
Jinny You
48f58637e1 test/lottie: added the slot resetting use case 2024-03-21 16:56:28 +09:00
Rafał Mikrut
25e6539ea7 Better regression testing 2024-03-20 12:09:48 +09:00
Jinny You
5695f84307 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-03-06 19:51:57 +09:00
Hermet Park
9e69089524 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-02-06 01:30:19 +09:00
Jinny You
2c6c8d3b21
updated copyright date (#1866) 2023-12-28 10:43:25 +09:00
Hermet Park
7ab5cb90aa infra: renamed the folders, images -> resources.
these folders might have more than images.
2023-12-12 08:57:44 +09:00
Hermet Park
f2c29063d2 api: updated the recent changed api again.
Reordered by the data packing size.
Also removed a wrong capi default parameter value.

Result Picture::load(const char* data, uint32_t size, const std::string& mimeType, bool copy = false, const std::string& rpath = "")
-> Result load(const char* data, uint32_t size, const std::string& mimeType, const std::string& rpath = "", bool copy = false)

Tvg_Result tvg_picture_load_data(Tvg_Paint* paint, const char *data, uint32_t size, const char *mimetype, bool copy, const char* resourcePath)
-> Tvg_Result tvg_picture_load_data(Tvg_Paint* paint, const char *data, uint32_t size, const char *mimetype, const char* resourcePath, bool copy);
2023-11-23 11:59:38 +09:00
Sergii Liebodkin
548962f5f8 apis/engines: Revise the clear() buffer behavior.
ThorVG has offered an option to clear the buffer since version 1.0.
This is essential when users utilize the canvas target buffer
with the main render target. They share the buffer
and need to draw contents onto the existing contents.

API:
Result Canvas::clear(bool free = true)
-> Result Canvas::clear(bool paints = true, bool buffer = true)

Tvg_Result tvg_canvas_clear(Tvg_Canvas* canvas, bool free);
-> Tvg_Result tvg_canvas_clear(Tvg_Canvas* canvas, bool paints, bool buffer);

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

Co-Authored-By: Hermet Park <hermet@lottiefiles.com>
2023-11-20 18:23:00 +09:00
Hermet Park
f081e1f6ae gif/encoder: fixed memory violation.
There was an invalid palette data access
when no frame data had been changed, detected by memory sanitizer.
2023-11-17 20:44:53 +09:00
Hermet Park
ab35ab2171 test: added gif save test
Skipped capi tests this time, since it has no saver api now.
2023-11-17 20:44:53 +09:00
Hermet Park
66305f3e6d sw_engine: Clear buffer at the proper time.
Clear the buffer when canvas->clear() is called.

TODO: We need to add a color value parameter to clear it.
2023-11-15 21:12:24 +09:00
Sergii
4da90b2847 picture: added ability to support premultiplied for picture raw loader
[issues 1479: picture raw loader to support premultiplied](https://github.com/thorvg/thorvg/issues/1764)

api changes:
    Result Picture::load(uint32_t* data, uint32_t w, uint32_t h, bool copy);
    Result Picture::load(uint32_t* data, uint32_t w, uint32_t h, bool premultiplied, bool copy);

capi changes
    TVG_API Tvg_Result tvg_picture_load_raw(Tvg_Paint* paint, uint32_t *data, uint32_t w, uint32_t h, bool copy);
    TVG_API Tvg_Result tvg_picture_load_raw(Tvg_Paint* paint, uint32_t *data, uint32_t w, uint32_t h, bool premultiplied, bool copy);
2023-11-08 10:46:23 +09:00
Hermet Park
d3c60955fa tvg: revise the tvg binary format for 1.0 release
- The TVG binary format now consistently compresses the data.
- Removed redundant internal properties as part of this change.

Please note that this change will break compatibility with the TVG file format from version 1.0 onward.

Issue: https://github.com/thorvg/thorvg/issues/1372
2023-11-02 11:58:23 +09:00
Hermet Park
d879e56856 saver: Revised the API for the 1.0 release
replaced the 'compress' option with 'quality'

API changes:
Result Saver::save(std::unique_ptr<Paint> paint, const std::string& path, bool compress) ->
Result Saver::save(std::unique_ptr<Paint> paint, const std::string& path, uint32_t quality = 100)

TVG_API Tvg_Result tvg_saver_save(Tvg_Saver* saver, Tvg_Paint* paint, const char* path, bool compress) ->
Tvg_Result tvg_saver_save(Tvg_Saver* saver, Tvg_Paint* paint, const char* path, uint32_t quality)

Issue: #1372
2023-11-02 11:58:23 +09:00
Hermet Park
d6fffd13c2 api: revise the engine initializer for the 1.0 release.
This change introduces the CanvasEngine::All type to automatically
initialize the engines available on the current system.

These revisions improve the usability of these APIs.

Addtions:
- enum class CanvasEngine::All

Modifications:
- Result Initializer::init(CanvasEngine engine, uint32_t threads) ->
Result Initializer::init(uint32_t threads, CanvasEngine engine = tvg::CanvasEngine::All)
2023-10-30 11:48:02 +09:00
Mira Grudzinska
25a1321243 common: stroke dash offset support with new apis.
This change just allows users to use the offset of the stroke dash.
Actually feature enhacement has been introduced by
478e45f9f3.

@APIs:
uint32_t Shape::strokeDash(const float** dashPattern) ->
uint32_t Shape::strokeDash(const float** dashPattern, float* offset = nullptr)

Result Shape::strokeDash(const float* dashPattern, uint32_t cnt) ->
Result Shape::strokeDash(const float* dashPattern, uint32_t cnt, float offset = 0.0f)

Tvg_Result tvg_shape_set_stroke_dash(Tvg_Paint* paint, const float* dashPattern, uint32_t cnt) ->
Tvg_Result tvg_shape_set_stroke_dash(Tvg_Paint* paint, const float* dashPattern, uint32_t cnt, float offset)

Tvg_Result tvg_shape_get_stroke_dash(const Tvg_Paint* paint, const float** dashPattern, uint32_t* cnt) ->
Tvg_Result tvg_shape_get_stroke_dash(const Tvg_Paint* paint, const float** dashPattern, uint32_t* cnt, float* offset)

@Issue: https://github.com/thorvg/thorvg/issues/1372
2023-10-30 11:47:51 +09:00
Hermet Park
db55481e97 renamed stroke apis family.
float Shape::stroke(float width) -> float Shape::strokeWidth(float width)
Result Shape::stroke(uint8_t r, uint8_t g, uint8_t b, uint8_t a = 255) -> Result Shape::strokeFill(uint8_t r, uint8_t g, uint8_t b, uint8_t a = 255)
Result Shape::stroke(std::unique_ptr<Fill> f) -> Result Shape::strokeFill(std::unique_ptr<Fill> f)
Result Shape::stroke(const float* dashPattern, uint32_t cnt, float offset = 0.0f) ->  Result Shape::strokeDash(const float* dashPattern, uint32_t cnt, float offset = 0.0f)
Result Shape::stroke(StrokeCap cap) -> Result Shape::strokeCap(StrokeCap cap)
Result Shape::stroke(StrokeJoin join) -> Result Shape::strokeJoin(StrokeJoin join)
Result Shape::strokeColor(uint8_t* r, uint8_t* g, uint8_t* b, uint8_t* a = nullptr) const -> Result Shape::strokeFill(uint8_t* r, uint8_t* g, uint8_t* b, uint8_t* a = nullptr) const

@Issue: https://github.com/thorvg/thorvg/issues/1372
2023-10-27 11:46:51 +09:00
Hermet Park
e570064eba 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-10-24 11:49:57 +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