Commit graph

35 commits

Author SHA1 Message Date
Hermet Park
889d1d1fa2 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-07-05 21:25:58 +09:00
Jinny You
2c6c8d3b21
updated copyright date (#1866) 2023-12-28 10:43:25 +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
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
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
JunsuChoi
595cc56e86 webp_loader: Introduce Webp image loader
Add external_webp loader which uses libwebp library.
2023-06-09 10:58:01 +09:00
Martin Capitanio
4def2a679c Fix clang compiler warnings in unit tests.
[clang] Warn on unqualified calls to std::move and std::forward
See: https://reviews.llvm.org/D119670

[141/166] Compiling C++ object test/tvgUnitTests.p/testAccessor.cpp.o
../thorvg-git/test/testAccessor.cpp:58:29: warning: unqualified call to
'std::move' [-Wunqualified-std-cast-call]
    picture = accessor->set(move(picture), nullptr);
                            ^
                            std::
...
2023-06-07 16:56:30 +09:00
Hermet Park
9d9f38c875 common: code refactoring
Replace standard casting with tvg::cast()
2023-05-15 12:07:55 +09:00
Hermet Park
5d930e51e4 test/examples: -- deprecated apis call warnings.
Result load(const char* data, uint32_t size, bool copy = false)
-> Result load(const char* data, uint32_t size, const std::string& mimeType, bool copy = false)

Result bounds(float* x, float* y, float* w, float* h)
-> Result bounds(float* x, float* y, float* w, float* h, bool transformed)
2023-04-22 18:32:22 +09:00
Hermet Park
f0ae3e9cee test: fix broken plugin support.
The thorvg test should not attempt to perform features
that were not enabled, as this will cause them to fail.

@Issues: https://github.com/thorvg/thorvg/issues/1251
2023-04-06 19:47:10 +09:00
Hermet Park
9b3c34c3b1 updated copyright. 2023-01-14 13:48:11 +09:00
Hermet Park
91730249ae test picture: add picture mesh api unit test
@Issue: https://github.com/Samsung/thorvg/issues/1241
2022-12-09 12:09:59 +09:00
Hermet Park
f0141e63de updated copyright date. 2022-01-12 14:08:48 +09:00
Hermet Park
fd74e0fae8 test: fix memory leak.
these duplicates are not unique_ptr, should be taken care.

@Issue: https://github.com/Samsung/thorvg/issues/995
2021-11-05 21:48:24 +09:00
JunsuChoi
021b86a065 test Picture: Fix array release
fix code
2021-11-01 15:04:05 +09:00
JunsuChoi
5fd60e14a2 test Picture : Remove unnecessary namespace
Remove `std::`
2021-10-28 13:59:24 +09:00
JunsuChoi
a7f7cbd29a test Picture: Change file open of ifstream to binary(and readonly) type
When opening a file using ifstream, a different problem occurs for each platform.
To fix this, change to binary, readonly type.

refer to:
https://stackoverflow.com/questions/9817806/why-does-my-program-produce-different-results-on-windows-and-linux-about-file-r
2021-10-28 13:59:24 +09:00
Hermet Park
8cc7f50235 test: API coverage up
Added identifier() test cases.
2021-10-22 18:47:05 +09:00
Hermet Park
b97f9338dd test: ++safety.
add null handlings just in case.
2021-10-07 15:04:46 +09:00
projectitis
a678846068
tests: fix stack overflow error in testPicture for windows 2021-10-07 14:51:07 +09:00
Mira Grudzinska
d67517337c tests: ++LOC svg loader, tvg saver 2021-10-06 11:11:21 +09:00
Michal Maciola
3ded3e359d utc: testing loading and saving .tvg
Added tests of loading and saving .tvg.
Created testSavers.cpp. Created files tag.tvg and test.tvg. Minor change
in tag.svg.
2021-09-03 11:02:25 +09:00
Michal Maciola
8ed6a1a12d utc: increase coverage of picture and fill 2021-08-20 12:36:09 +09:00
Michal Maciola
d82b088b7a utc: increase coverage up #1 2021-08-19 14:49:14 +09:00
Michal Maciola
3a05ae4c01 utc: increase coverage up 2021-08-19 14:49:14 +09:00
Michal Maciola
cff8815404
loaders: Pass mimetype to picture::load
* loaders: Pass mimetype to picture::load

Added mimetype attribute to enfaster loading using a proper loader.

@Changed api: Picture::load(const char* data, uint32_t size, const std::string& mimeType, bool copy = false)
@issue: #571
2021-08-05 11:02:26 +09:00
Hermet Park
5e52134e2a dexample Picture: improve the test coverage.
In this patch, it replaced the test images with Lenna.
and fix the wrong jpeg file size figuring.
2021-07-30 12:09:59 +09:00
Hermet Park
94eeb92dbe infra: seprate test image resources from the examples.
change for removing dependency.
2021-07-19 14:43:26 +09:00
Michal Maciola
f9d5c8b42d test: testPicture added .jpg and .png loading tests 2021-07-16 00:36:38 +09:00
Michal Maciola
c3aef76278 test: render jpg and png files 2021-07-16 00:29:39 +09:00
Michal Maciola
a8e13ed2b7 test: svg rendering
Added SVG file loading and rendering for increasing TC Line coverage
Line coverage for src/loaders/svg: 85.5%
2021-07-14 23:24:40 +09:00
Hermet Park
a5d2950902 test capi: code refactoring
use catch Approx functions to compare floating-point values.
2021-07-03 16:51:50 +09:00
Hermet Park
8e2765be39 common picture: fix invalid size returns from raw image.
picture/raw should update the size if the raw image
with size values are entered.
2021-07-03 16:15:57 +09:00
Hermet Park
64b25bb35b test picture: ++ raw data loading. 2021-07-03 16:15:57 +09:00
Hermet Park
10f80fa832 test Picture: add Picture unit tests 2021-07-02 14:02:09 +09:00