Commit graph

55 commits

Author SHA1 Message Date
Hermet Park
26e04611e6 infra: move the examples folder outside of the source directory.
examples are not considered a feature of ThorVG;
hence, they are excluded from the src directory.

This change allows developers to concentrate more effectively
on the core ThorVG sources for practical usages.
2024-04-06 12:48:27 +09:00
Jinny You
bafb8e2b86 examples: Added lottie advanced features example 2024-04-06 12:08:21 +09:00
JunsuChoi
4db67dea82 examples/picture/svg: Add PictureSvg example
This is the simplest example using tvg::Picture's SVG loader.
2024-04-05 18:01:24 +09:00
Hermet Park
dab0380398 examples/text: Added Text example. 2024-01-02 20:34:11 +09:00
Hermet Park
cd216a5235 example: renamed a sample, Svg2 -> DataLoad
The sample actually intends to test Picture::load() with a data.
2023-12-26 18:18:57 +09:00
JunsuChoi
a20216045a saver GifSaver: Introduce GifSaver for animation
Add save() API that takes tvg::Animation as a parameter.
This API uses gif.h to create each animation frame as a gif frame.
Gif creation do not support threads because they must be added sequentially.
Please see example/GifSaver.cpp

ex)
auto animation = tvg::Animation::gen();
auto picture = animation->picture();
picture->load(EXAMPLE_DIR"/walker.json");
auto saver = tvg::Saver::gen();
saver->save(std::move(animation), EXAMPLE_DIR"/test.gif");
saver->sync();

New API:
Result Saver::save(std::unique_ptr<Animation> animation, const std::string& path, uint32_t quality = 100, uint32_t fps = 0);

Issue: https://github.com/thorvg/thorvg/issues/1712
2023-12-26 18:17:38 +09:00
Hermet Park
92b6f9dc48 examples: remove Async test
We have alternative test cases for it such as Lottie
2023-09-26 14:50:16 +09:00
Hermet Park
3437e4729f examples: remove Stress
we have a good stress test - Lottie
2023-08-21 19:49:05 +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
Hermet Park
739bb63f92 examples animation: adds a basic example. 2023-07-27 00:31:27 +09:00
Hermet Park
ca7a9068bd examples lottie: adds a basic example 2023-07-27 00:31:27 +09:00
Hermet Park
f36455048a examples: add SceneBlending 2023-06-20 11:30:18 +09:00
Martin Capitanio
a597d3bb49 API, sw_engine: add stroke-miterlimit example. 2023-06-13 10:42:20 +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
Hermet Park
d4dc625481 examples MaskMethods: add a new example
This is introduced for Masking Methods.
2023-06-03 15:50:48 +09:00
Martin Capitanio
2a56c43c84 infra: Avoid meson warning.
WARNING:: You should add the boolean check kwarg to the run_command call.
         It currently defaults to false,
         but it will default to true in future releases of meson.
         See also: https://github.com/mesonbuild/meson/issues/9300
2023-05-22 00:06:08 +09:00
Hermet Park
7e1a647a36 examples: added InvLumaMasking sample. 2023-05-20 20:11:58 +09:00
Vincent Torri
be2de28312 portability: fix usage of TVG_API
Rule of thumb on Windows:
  * for a DLL:
    * if the library is built, set TVG_API to __declspec(dllexport)
    * if the library is used, set TVG_API to __declspec(dllimport)
  * for a static library, set TVG_API to nothing

To set TVG_API for a static library, TVG_STATIC is defined when the stataic library is built.
Otherwise, TVG_API is correctly set for a DLL.
Also sun and intel compilers are handled

@issue: https://github.com/thorvg/thorvg/issues/1446
2023-05-16 18:55:33 +09:00
Hermet Park
69063d2405 infra: specify TVG_API for both static/dynamic linking.
The previous meson script was incomplete,
therefore this change requires it to be revised.

To enable static linking use the next meson option.
"-Ddefault_library=static"

Issue: https://github.com/thorvg/thorvg/issues/1234
2023-04-22 18:32:22 +09:00
Hermet Park
a0fbe7db41 example: add an example SceneClipper 2023-04-16 22:03:36 +09:00
Hermet Park
67b48ab772 examples: Added Texmap
added texture mapping example.

@Issues: https://github.com/Samsung/thorvg/issues/1241
2022-09-14 11:36:21 +09:00
Michal Maciola
a18f85cca8
example: added LumaMasking.cpp (#621)
Added an example LumaMasking.cpp that tests CompositeMethod::LumaMask
2021-12-30 15:56:25 +01:00
Hermet Park
906679cbeb infra: just changed naming. 2021-12-24 14:04:08 +09:00
Shinwoo Kim
d349f73222 example: add script to execute all
This patch will save your time to check example.

  ./all.sh [interval time between examples, default is 1 second]
2021-12-24 14:01:55 +09:00
Hermet Park
100d98d82e common: Introduced Accessor for traversing the scene-tree.
Basically, this Accessor is a utility to debug the Scene structure,
by traversing the scene-tree by users.

You can search specific nodes to read the property information,
figure out the structure of the scene tree and its size.

We actually don't recommend you to touch the property unless you really
know the each paint's position and role because it's not visible, difficult to
understand its anatomy.

Also, You must underatnd that modifying the nodes of the scene will be going
well with both the art-design structure and the prorgram logic.

In this first version, Accessor only supports for the Picture class.

@example:

auto picture = tvg::Picture::gen();
picture->load("test.svg");

//The callback function from lambda expression.
//This function will be called for every paint nodes of the tree.
auto f = [](const tvg::Paint* paint) -> bool
{
    if (paint->identifier() == Shape::identifier()) {
        //override properties?
        uint8_t r, g, b, a;
        paint->fillColor(&r, &g, &b, &a);
        paint->fill(r / 2, g / 2, b / 2, a);
    }

    //You can return false, to stop traversing immediately.
    return true;
};

auto accessor = tvg::Accessor::gen();

picture = accessor->access(move(picture), f);

...

@Issue: https://github.com/Samsung/thorvg/issues/693
2021-12-23 11:54:44 +09:00
Hermet Park
49294e9142 examples: remove boundary samples.
Removed these tests from the example since it's not so proper showcases
for user scenaro.
2021-11-22 17:40:06 +09:00
Hermet Park
823cc85238 examples: added image scale up/down samples. 2021-11-18 17:45:49 +09:00
Hermet Park
7152953df4 example boundary2: added image boundary check sample. 2021-11-18 10:41:00 +09:00
Hermet Park
b495f04ef4 examples tvg: added a new example to verify tvg resources.
These tvg resources might be updated before official release.
2021-09-08 13:29:04 +09:00
Hermet Park
db85313328 example: add a sample for checking rendering performance. 2021-07-27 13:30:06 +09:00
Hermet Park
bccb1d29e3 examples: split Tvg to TvgSaver, PictureTvg
We'd like to clearly split showcases TvgSaver & Picture.
2021-07-20 14:10:05 +09:00
Hermet Park
9f9d4b62a0 examples: sort file list alphabetical. 2021-07-20 13:42:10 +09:00
Michal Maciola
957ad5d017 example: PictureJpg.cpp
Created an example for testing jpg loading
2021-07-08 23:17:05 +09:00
Hermet Park
58fefeb05f examples tvg: clean up for tvg consistency.
no logical changes.
2021-06-11 12:58:15 +09:00
mmaciola
2c1f165f19
TVG Loader/Saver module: tvg loader example 2021-06-11 12:51:35 +09:00
Hermet Park
3a538340aa infra: disable capi in default.
capi is not mandatory option in v0.1.

we can manually toggle it on when it's necessary.
2021-04-30 19:15:05 +09:00
Hermet Park
6cc7dfdc56 examples: revise picture sample code. 2021-04-01 20:05:07 +09:00
Mateusz Palkowski
ac3e848cfe minor fixes 2021-04-01 19:38:30 +09:00
Mateusz Palkowski
1046ed2c40 Added png loading example 2021-04-01 19:38:30 +09:00
Patryk Kaczmarek
cd6fb4f483 gradients: paint linerar gradients properly with mask composition method
@Issues: 243

Change-Id: Ie26a0b903af94a46683348e3fb7d8b554576997c
2021-03-31 20:38:16 +09:00
Hermet Park
e4a28869d1
examples: revise StrokeGradient
renamed GradientStroke & repositioned visuals.
2021-03-22 13:52:43 +09:00
Patryk Kaczmarek
03d48159e3 examples: new AnimateMask example and svg images with masks
Change-Id: I609597a5ecb710e9af9939a3028eeef691b66188
2021-02-25 12:24:19 +09:00
Mira Grudzinska
20324dc48e example StrokeGradient
Example showing a gradient usage for a stroke.
2021-02-19 17:14:12 +09:00
Patryk Kaczmarek
905fd46ccf sw_engine composition: invert alpha masking
composition invert alpha masking

@Examples: added InvMasking

@Issues: 31

Change-Id: I2ee9d428d5749240ddf2e6adbb7677dccbe1926f
2021-02-02 11:47:30 +09:00
Patryk Kaczmarek
4dbdcbd057
common composition: support Masking method
New feature - CompositeMethod::MaskAlpha

Newly Support AlphaMask. but it's unstable.

@Issues: 31
2020-12-18 17:40:54 +09:00
JunsuChoi
e00f948705
raw_loader Loader: Introduce Raw image loader
Add RawLoader class that loads and display raw images,
and adds a Rasterizer for image data.
Image data can be loaded via picture.
Loaded image supports Composition, Transformation and Alpha blending.

New API
Result load(uint32_t* data, uint32_t width, uint32_t height, bool isCopy) noexcept;
2020-11-23 18:12:36 +09:00
Hermet Park
0399d84478 common paint: introduce opacity() method.
We introduced separate opacity interface to adjust alpha value by paint.
This opacity will affect to whole paint image if paint is a group of paints.

Also, this opacity is to multipy with fill/stroke alpha values.
This means if the opacity is valid, the paint might deal with a composition step,
which is very expensive due to additional rendering step.

One tip is, if you want to toggle on/off for a certian paint,
you can set opacity to 255 or 0.

@API Additions:

Result Paint::opacity(uint8_t o) noexcept;
uint8_t Paint::opacity() const noexcept;

@Examples: examples/Opacity

@Issues: 94
2020-10-26 19:23:54 +09:00
Hermet Park
c807010554 examples FillRule: added shape::fillRule() example
one shape shows Winding, the other one shows EvenOdd.
2020-10-22 13:50:04 +09:00
Hermet Park
24a0a2554d
examples: add stacking example
This example shows how to restack paints node
2020-10-08 15:57:01 +09:00
Hermet Park
433746f2bd examples: removed test prefix 2020-10-07 14:04:08 +09:00