Commit graph

2408 commits

Author SHA1 Message Date
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
Jinny You
28ba5fe1b8 wasm: Update emscripten build config
enabled options:
- EXPORT_ES6 > to import glue code in es6 module system
- SINGLE_FILE > to build library as a single JS file, single file reduces loading latency
- MODULARIZE > proper option to build es6 module (optimized)
- EXPORTED_RUNTIME_METHODS > allow es6 module based glue code to import FS
2023-12-20 15:45:14 +09:00
Jinny You
99a841b404 wasm: Revise the wasm binding for lottie-player
- removed and replaced `tvgWasm`
2023-12-20 15:45:14 +09:00
Sergii Liebodkin
93f0e493ac wg_engine: refactor context handles
New approach provide:
- instance, adaptor, device and default queue
- device capabilitieas
- command buffer executor
- error handling
2023-12-20 10:43:18 +09:00
Sergii Liebodkin
1a6571f596 wg_engine: refactor render targets handling
For further development of features, we need to create off-screen buffers that will allow us to implement functionality related to composition and blending, as well as for loading data to system memory from the framebuffer. Separating the framebuffer into a separate entity allows you to create several instances of them, switch between them, and blend them according to given rules.

For current time we have only a single render target instance, that have a handle to drawing into surface surface, like a native window.

New approach allows:
- offscreen rendering
- render pass handling
- switching between render targets
- ability to render images, strokes and shapes into independent render targets
2023-12-20 01:33:23 +09:00
RuiwenTang
51a69880fd gl_engine: fix wrong scissor value cause content not fully rendered 2023-12-19 22:35:47 +09:00
Hermet Park
0552820c87 renderer: minor optimization.
reduce the binary size.
2023-12-19 13:02:09 +09:00
RuiwenTang
53b0b87bb7 gl_engine: optimize framebuffer creation and save some runtime memory
since the framebuffer will draw back to parent RenderPass, it can be
reused in next compose rendering.

So instead of create framebuffer every time when beginCompose is called, we
trying to reuse the framebuffer created before in the same stack level
2023-12-19 01:59:16 +09:00
Hermet Park
cd2e343192 doc: polish up the doxygen.
- applied @retval for those const values.
- applied @return for return value description.
2023-12-18 23:39:46 +09:00
Hermet Park
9d06308207 wg_engine: apply tvg coding style. 2023-12-18 23:34:13 +09:00
Sergii Liebodkin
e2458570f8 wg_engine: pipelines and bind groups refactoring
- shader and system types synchronized
- pipelens and bind groups description separated
- pipelines description simplified
2023-12-18 22:45:13 +09:00
Hermet Park
6f78d80ae6 renderer/picture: fixed a regression
reverted a wrong change from the previous code refactoring
in 5643348472
2023-12-16 00:10:42 +09:00
Hermet Park
5643348472 common: clean up the code. 2023-12-14 15:59:38 +09:00
Hermet Park
1ba20b9dfa doc: added thorvg-gpt badge (link) 2023-12-14 12:31:18 +09:00
Hermet Park
50aaade560
Update CONTRIBUTING.md 2023-12-14 12:27:59 +09:00
Hermet Park
9d73a7b5a3 Update CODEOWNERS
* removed inactive member.
2023-12-14 12:25:45 +09:00
Vincent Torri
edf1f56c67 include missing headers for strcmp(), strdup() and realloc() 2023-12-13 10:33:52 +09:00
Hermet Park
0aa39111ad common/array: code refactoring.
Use a default constructor with reservation.
2023-12-13 09:34:44 +09:00
Hermet Park
528ea0d587 renderer/scheduler: --binary size by 2.2kb
replace the stl with own lightweight data structures.
2023-12-13 09:03:17 +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
273850a972 renderer/shape: Apply the magic number kappa to achieve rounded corners.
The magic number kappa (0.552284), which is associated with the bezier curve,
has been introduced. This formula is supposed to be applied to the rounded corners
of the rectangle to ensure consistent drawing results.

Issue: https://github.com/thorvg/thorvg/issues/1824
2023-12-11 09:14:46 +09:00
Hermet Park
be922c5bf9
Create CODE_OF_CONDUCT.md 2023-12-09 08:46:29 +09:00
Hermet Park
a9d39eaf56 renderer/loader: optimization++
removed the internal unique_ptr usage to reduce the binary size(-553)
2023-12-08 23:35:19 +09:00
Hermet Park
20fdcb4ccd docs: updated 2023-12-08 10:07:47 +09:00