Commit graph

2631 commits

Author SHA1 Message Date
Jinny You
20a6ca19e7 web: Support file types
- added new exportable type `tvg`
- support jpg/png/svg/tvg load
2024-01-03 13:51:42 +09:00
Jinny You
5f088a2357 wasm: Revise saver methods 2024-01-03 13:51:42 +09:00
Hermet Park
8375c53461 ttf: removed the beta tag.
incorporate TTF support into the CI build tests.
2024-01-03 12:57:07 +09:00
Hermet Park
139a1c5e85 ttf: fix the windows compilation errors. 2024-01-03 12:57:07 +09:00
Hermet Park
15baf20363 tvg picture: binary version up. 2024-01-02 20:39:30 +09:00
Hermet Park
24901e7d59 docs: updated doxygen for 0.12 release 2024-01-02 20:39:19 +09:00
Sergii Liebodkin
450d56face
xides compilation issue with loaders (#1885) 2024-01-02 18:15:36 +09:00
Hermet Park
a6f4b5f38c examples: ++safety.
Guarantee the resource free at the termination.
2023-12-31 11:41:02 +09:00
Hermet Park
468b132739 renderer: enhanced shared surface handling with mutex implementation
Introduced a dedicated mutex for each surface instance
to ensure safe sharing between the loader, renderer, and engine.

This enhancement allows for secure modification and access to bitmap data,
addressing potential concurrency issues.

Multiple Picture instances can now safely share a single loader instance,
optimizing performance.

This change builds upon the previous Loader Cache improvements:
ff6ea4b6c4
2023-12-31 11:37:12 +09:00
Hermet Park
fbcfb3f865 svg: ensure that all allocated memory.
observed a memory leak at a corner case.
2023-12-31 10:45:26 +09:00
Hermet Park
cf35ca3392 lottie: resolve a thread sanitizer report.
Issue: https://github.com/thorvg/thorvg/issues/1874
2023-12-29 20:06:21 +09:00
Hermet Park
217c53e823 renderer/loader: improve thread safety
activeLoaders can be accessed by loaders within the worker thread.

the issue came up with the Loader cache feature:
ff6ea4b6c4

Issue: https://github.com/thorvg/thorvg/issues/1874
2023-12-29 16:57:09 +09:00
Hermet Park
ea4662a927 sw_engine: resolve a thread sanitizer report.
Synchronize before accessing the shared bbox.

Issue: https://github.com/thorvg/thorvg/issues/1874
2023-12-29 16:57:09 +09:00
Hermet Park
83042aa0a2 renderer/taskscheduler: Resolve a thread sanitizer report.
Since each thread worker accesses the 'threads.count' variable,
delay the thread starting until initialization is completed.
2023-12-29 16:57:09 +09:00
Hermet Park
8d3449a90d renderer/loader: code refactoring.
Removed internal unique_ptr usage for a more compact size.
2023-12-29 16:19:37 +09:00
Hermet Park
415276ae1c Revert "svg: removed an unnecessary nested scene."
A regression bug is occured.
clipper is also required to be transformed with loader->resize()...

This reverts commit e62a8668e7.
2023-12-28 18:46:42 +09:00
Hermet Park
97f41b4ad5 text/ttf: fixed all memory violations. 2023-12-28 18:37:05 +09:00
Hermet Park
e62a8668e7 svg: removed an unnecessary nested scene. 2023-12-28 18:06:33 +09:00
Jinny You
2c6c8d3b21
updated copyright date (#1866) 2023-12-28 10:43:25 +09:00
Hermet Park
ca44e46d3b gl_engine: fix a compiler warning.
../src/renderer/gl_engine/tvgGlRenderer.cpp:450:24: warning: comparison of integer expressions of different signedness: ‘int’ and ‘uint32_t’ {aka ‘unsigned int’} [-Wsign-compare]
  450 |     for (auto i = 0; i < mComposePool.count; i++) {
      |
2023-12-27 16:42:49 +09:00
Hermet Park
1d9ea58be3 api: promote to official APIs.
New API:
- CanvasEngine::All
- SwCanvas::Colorspace::ABGR8888S
- SwCanvas::ColorSpace::ARGB8888S
2023-12-27 16:42:26 +09:00
Hermet Park
84e8e38f0a doc: remove unnecessary doxy guide. 2023-12-27 11:05:58 +09:00
Hermet Park
74f186b973
Update README.md 2023-12-27 00:46:01 +09:00
RuiwenTang
edb118a0c7 gl_engine: fix svg gradient position not correct
* change the color and stop size to 16 in shader and buffer block
* calculate transform when upload gradient info to gpu pipeline
2023-12-26 17:58:27 +09:00
Hermet Park
a38ee1e04e
Update README.md 2023-12-26 10:25:53 +09:00
Hermet Park
3c24150755
Update README.md 2023-12-26 10:22:29 +09:00
Hermet Park
2e870b5e98 doc: updated the guide. 2023-12-26 10:19:45 +09:00
Hermet Park
5bdfd03294 examples/text: Added Text example. 2023-12-25 12:40:12 +09:00
Hermet Park
0f69eef8ed renderer: introduce a ThorVG Text interface.
Introduced New APIs under the experimental tags.

- Result Text::font(const char* name, float size, const char* style = nullptr);
- Result Text::text(const char* text);
- Result Text::fill(uint8_t r, uint8_t g, uint8_t b);
- static Result Text::load(const std::string& path);
- static Result Text::unload(const std::string& path);
- static Text::std::unique_ptr<Text> gen();
- static Text::uint32_t identifier()

@Issue: https://github.com/thorvg/thorvg/issues/969
2023-12-25 12:40:12 +09:00
Hermet Park
061222bb59 renderer/loader: support ttf loader.
Applied 2 more internal LoaderMgr interfaces for
gobally manage the font data resources.

The next function is introduced for lookup the existing loader
with the font name (key)
- static LoaderMgr::LoadModule* loader(const char* key);

The next function is introduced to free the existing loader
with the loader source(file path)
- static bool retrieve(const string& path);

Additionally implements the base loader to bind the ttf loader.
2023-12-25 12:40:12 +09:00
Hermet Park
3c4e434b39 loader/ttf: introduce a new sfnt(scalable font) loader.
ttf is an industry standard format that is the most widely used
in the products. Now thorvg supports the basic features of
the font to supplement the text drawing.

The implementation is followed the ttf spec,
the covered features are:

- horizontal layouting with kerning.
- utf8 -> utf32 converted glyph drawing.

To use the feature, please enable ttf loader:
$meson -Dloaders="ttf_beta, ..."

@Issue: https://github.com/thorvg/thorvg/issues/969
2023-12-25 12:40:12 +09:00
Hermet Park
bd37e8ba37 common: Revise internal loader interfaces.
We are introducing the FontLoader, which slightly differs
from the ImageLoader in terms of features. To adequately
support both, we have separated the loader functionalities
into FontLoader and ImageLoader. This allows us to optimally
adapt the LoadModule for each case.
2023-12-25 12:40:12 +09:00
Hermet Park
58961f84d5 sw_engine/fill: fix a linear filling scaling issue.
The condition is not valid,
Let it draw the fill as it's requested.

Issue: https://github.com/thorvg/thorvg/issues/1834
2023-12-25 12:34:18 +09:00
Hermet Park
31fdd5d313
Update README.md 2023-12-24 13:26:58 +09:00
Sergii Liebodkin
8553044875 wg_engine: shape bbox based rendering (optimization)
Before the current changes, all surfaces were painted using a full-screen overlay, no matter how large the object was rendered. This approach is redundant and required reorganization. At the moment, all objects are rendered using an overlay equal to the box of the object itself, which reduces the cost of filling the surface.
Also surfaces and images were divided into different entities, which reduces the pressure on memory.
Also geometry data for rendering and geometry data for calculations in system memory were logically separated.
2023-12-23 13:37:56 +09:00
Sergii Liebodkin
323b615f0d wg_engine: Added shape opacity value usage
[issues 1479: Opacity](#1479)

Usage example:

    // prepare a shape (Rectangle + Rectangle + Circle + Circle) with opacity
    auto shape1 = tvg::Shape::gen();
    shape1->appendRect(0, 0, 200, 200);                //x, y, w, h
    shape1->appendRect(100, 100, 300, 300, 100, 100);  //x, y, w, h, rx, ry
    shape1->appendCircle(400, 400, 100, 100);          //cx, cy, radiusW, radiusH
    shape1->appendCircle(400, 500, 170, 100);          //cx, cy, radiusW, radiusH
    shape1->fill(255, 255, 0);                         //r, g, b
    shape1->opacity(128)                               //opacity
    canvas->push(std::move(shape1));
2023-12-21 09:43:33 +09:00
Hermet Park
40d46e9f8a loader/svg: optimize the path conversion.
Push the path data into a given shape directly.
This will skip unnecessary memory copies.

Issue: https://github.com/thorvg/thorvg/issues/1848
2023-12-20 20:34:58 +09:00
Hermet Park
2149ddbb01 Welcome to our new official ThorVG developer. 2023-12-20 18:28:54 +09:00
JunsuChoi
6d9d051acf
loader/svg: Do not draw shapes with invalid path information
If appendPath() returns InvalidArguments(not Success)
,do not create a tvg::Shape.
2023-12-20 16:18:18 +09:00
Jinny You
1544ce2ba2 web: Add a readme 2023-12-20 15:45:14 +09:00
Jinny You
d5f141ce14 web: Add config to support npm module 2023-12-20 15:45:14 +09:00
Jinny You
e67add4d87 web: Add examples
- `index.html` : basic example
- `benchmark.html` : to check FPS, memory usage, latency(ms)
2023-12-20 15:45:14 +09:00
Jinny You
3fe025f81f web: Implement features
- define separated model for better readability of interface
- implemented thorvg basic features

added features:
- Add version info
- Support setBgColor
- Support save2gif
- Support bounce mode
- Support intermission
- Support skipping needless animation by dom visible
2023-12-20 15:45:14 +09:00
Jinny You
c913d2ef69 web: Add wasm loading logic 2023-12-20 15:45:14 +09:00
Jinny You
b4916fdec4 web: Add library build script 2023-12-20 15:45:14 +09:00
Jinny You
41dae07872 web: Add lit element
- introduce a `lit`(https://lit.dev)
- lit is most popular web component builder
- with lit, we can build high-performance WP with less code
2023-12-20 15:45:14 +09:00
Jinny You
05fe9ec4a5 web: Set up eslint 2023-12-20 15:45:14 +09:00
Jinny You
de01f861dd web: Set up typescript 2023-12-20 15:45:14 +09:00
Jinny You
2ab0010685 web: Add gitignore 2023-12-20 15:45:14 +09:00
Jinny You
c99864e475 web: Add a package manifest info 2023-12-20 15:45:14 +09:00