Commit graph

154 commits

Author SHA1 Message Date
Hermet Park
7b79f37dd2 api: ++description
issue: https://github.com/thorvg/thorvg/issues/2494
2024-09-30 12:45:29 +09:00
Josh Soref
e3c66db301 common: fix 178+ spelling errors 2024-09-30 12:41:38 +09:00
Hermet Park
b6597fc1ef apis: promotes to official apis.
C++
- GlCanvas::gen()

CAPI
- TVG_COMPOSITE_METHOD_INVERSE_LUMA_MASK
2024-06-27 14:42:27 +09:00
Hermet Park
8259bb9d4e doc: removed useless information for easier maintainence.
That basic information is addressed in the Results section.
We can only add information that pertains to a specific scenario.
2024-06-27 14:42:27 +09:00
Hermet Park
4b01c0ef52 renderer/canvas: ++exceptional handling.
do not allow change the target if the condition is not satisfied.
2024-06-27 14:42:27 +09:00
Mira Grudzinska
0a53090a87 docs: descriptions++ 2024-06-27 14:42:27 +09:00
Mira Grudzinska
08d310111e capi: text c-api binding
@Issue: https://github.com/thorvg/thorvg/issues/2374
2024-06-24 14:55:02 +09:00
Mira Grudzinska
4c546f843f capi: remove the incorrectly named API
There was a typo in the name (tvg_canvas_est_viewport),
which made it seem like it was missing. The correctly
named API has already been added, so this one can be
removed.
2024-06-24 14:51:51 +09:00
Mira Grudzinska
733f0996d8 docs: resolve doxygen warnings 2024-06-24 14:43:48 +09:00
Hermet Park
d5f41c85d3 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-24 14:42:46 +09:00
Mira Grudzinska
61de65e10b common: clarification of returned types
The functions setting stroke's features always
returned a true. Returnig a boolen was a remnant
from a previous implementation. Since now they
never return false, they can be void functions.
The APIs description has been corrected.
2024-06-24 14:42:12 +09:00
Mira Grudzinska
710fa22d50 capi: bindings for strokeTrim
Example Capi.cpp modyfied.
2024-06-24 14:41:15 +09:00
Jinny You
c983a84be1 wasm: Support viewport API
wasm binding for viewport API in web.

see: #2276
2024-06-24 14:35:02 +09:00
Xu Xingliang
7437436fe9 capi: fix compile warning
Fix warning during build with lvgl https://github.com/lvgl/lvgl/pull/6081/

error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
2024-06-24 14:33:57 +09:00
Abdelrahman Ashraf
3a2183dfa7 fix: 🐛 missing binding for tvg_canvas_set_viewport c api 2024-06-24 14:32:03 +09:00
Hermet Park
87c7902411 wasm: code clean up
binary reduction by -188
2024-06-24 14:29:58 +09:00
Hermet Park
a93c348207 renderer/canvas: tweak the viewport behavior.
reset the viewport context when target buffer is reset.
2024-06-24 14:29:42 +09:00
Hermet Park
c9d2fee233 capi: support canvas viewport api
New Experimental API:
- Tvg_Result tvg_canvas_set_viewport(Tvg_Canvas* canvas, int32_t x, int32_t y, int32_t w, int32_t h);
2024-06-24 14:21:03 +09:00
Hermet Park
827a00b076 animation/lottie: improved the precision of frame values.
Refined the logic for updating frame numbers
to ensure greater accuracy in value precision.

issue: https://github.com/thorvg/thorvg/issues/2266
2024-06-24 14:12:00 +09:00
Jinny You
911d14535d bindings/capi: Fix incompatible parameter
C API doesn't support default parameter, removed it.

Issue: #2228
2024-06-24 12:29:59 +09:00
Hermet Park
b615348df1 doc: adds the api version history 2024-06-24 12:29:36 +09:00
Mira Grudzinska
548a201b93 build: add missing ifdef
The thorvg_lottie.h file wasn’t accessible
if the lottie loader was not activated,
causing a compilation error.
2024-06-24 12:18:10 +09:00
Jinny You
2a8b80f058 lottie/common: Fix typo in API documentation comment 2024-06-24 12:12:49 +09:00
Jinny You
e9bd05bad5 bindings/capi: Support lottie segment and marker
new experimental apis for animation segment and lottie marker.

APIs:
- TVG_API Tvg_Result tvg_animation_set_segment(Tvg_Animation* animation, float begin, float end)
- TVG_API Tvg_Result tvg_animation_get_segment(Tvg_Animation* animation, float* begin, float* end = nullptr)
- TVG_API Tvg_Result tvg_lottie_animation_set_marker(Tvg_Animation* animation, const char* marker)
- TVG_API Tvg_Result tvg_lottie_animation_get_marker_cnt(Tvg_Animation* animation, uint32_t* cnt)
- TVG_API Tvg_Result tvg_lottie_animation_get_marker(Tvg_Animation* animation, uint32_t idx, const char** name)
2024-06-24 12:03:24 +09:00
Hermet Park
ca7aec5fff lottie: rectify the frame updates.
Currently, tvg ignores the frame value if the difference
is less than 0.001. In most cases, updating the frames
when the change is less than 1ms is just an unnecessary
burden on the system.

Instead, this ensures that the perfect last frame is reached.

issue: https://github.com/thorvg/thorvg/issues/2147
2024-06-24 11:58:48 +09:00
Hermet Park
10d6aa1bba wasm: update the gif conversion function
re-implement the gif conversion function with the correct approach.
The input data is not reusable as it undergoes modifications during parsing.

To address this, the function now creates a backup of the original data for use in GIF conversion.

This also resolves issues where the GIF viewport was incorrectly matched.

This implementation may be revisited upon
the availability of Animation::duplicate().
2024-04-07 15:15:56 +09:00
Hermet Park
94b3971a55 wasm: optimize TVG saving Logic
Optimized the saving logic for TVG.

Copying the picture is unnecessary;
the logic now directly utilizes the currently held picture.
2024-04-06 12:48:30 +09:00
Hermet Park
04b5525db4 api: Promote experimental Animation APIs to official status.
These APIs have been thoroughly tested and verified.

New API:
- Result Animation::frame(float no)
- Picture* Animation::picture() const
- float Animation::curFrame() const
- float Animation::totalFrame() const
- float Animation::duration() const
- static Animation::std::unique_ptr<Animation> gen()

New CAPI:
- Tvg_Animation* tvg_animation_new()
- Tvg_Result tvg_animation_set_frame(Tvg_Animation* animation, float no)
- Tvg_Paint* tvg_animation_get_picture(Tvg_Animation* animation)
- Tvg_Result tvg_animation_get_frame(Tvg_Animation* animation, float* no)
- Tvg_Result tvg_animation_get_total_frame(Tvg_Animation* animation, float* cnt)
- Tvg_Result tvg_animation_get_duration(Tvg_Animation* animation, float* duration)
- Tvg_Result tvg_animation_del(Tvg_Animation* animation)

issue: https://github.com/thorvg/thorvg/issues/2067
2024-04-06 12:08:23 +09:00
Jinny You
984eb2eff9 lottie: Support the slot reverting feature
Implemented the ability to revert Lottie slots by calling override with nullptr.
This functionality allows for the complete reversal of applied slots.

usage:
- `animation->override(nullptr)`

Co-Authored-By: Hermet Park <hermet@lottiefiles.com>
2024-04-06 12:08:23 +09:00
Hermet Park
3c5e9e1e7c capi: Add two additional ColorSpace options to align with C++ APIs.
APIs:
- Tvg_Colorspace::TVG_COLORSPACE_ABGR8888S
- Tvg_Colorspace::TVG_COLORSPACE_ARGB8888S

Issue: https://github.com/thorvg/thorvg/issues/2053
2024-04-06 12:08:21 +09:00
Jinny You
725dc0d18e lottie/api: specify clear result for override API
In case the given JSON is invalid, it's more closed to `Result::InvalidArguments`.
2024-04-06 12:08:21 +09:00
Hermet Park
fa393f1c52 renderer/loader: revamping the caching mechanism.
The previous loader cache mechanism encountered a problem
when the user changed the content of the cached data.

In such cases, a new request would not be processed
because the renderer would use the previously cached content.

So far, the TVG cache mechanism utilizes a pointer hash key
for the fastest hashing mechanism available.
One limitation is that it assumes the address is unique for the data.

To resolve this, we modified the caching policy.
Now, the renderer will not cache copied data;
it will only cache the given data when it is deemed shareable.

issue: https://github.com/thorvg/thorvg/issues/2020
2024-04-06 12:08:21 +09:00
Jinny You
6bfd11a80c capi: added missing lottie header
Currently, the Lottie Animation API is not working due to the missing header.
2024-04-06 12:08:21 +09:00
Hermet Park
0f83850da6 binding/capi: support lottie extensions
these experimental apis are allowed to use
when the lottie loader is enabled.

APIs:
- Tvg_Animation* tvg_lottie_animation_new()
- Tvg_Result tvg_lottie_animation_override(Tvg_Animation* animation, const char* slot)
2024-04-06 12:08:21 +09:00
Jinny You
959f45313e wasm: Revise saver methods 2024-01-03 14:15:23 +09:00
Jinny You
92288c8291 updated copyright date (#1866) 2024-01-02 20:34:12 +09:00
Jinny You
87722991f7 wasm: Revise the wasm binding for lottie-player
- removed and replaced `tvgWasm`
2024-01-02 20:34:11 +09:00
Hermet Park
750e4d6261 wasm: Set a GIF background color.
Use a white background by default.
2023-12-26 18:30:42 +09:00
Hermet Park
a37649cd1f doc: make it up missing parameter information. 2023-12-26 18:21:01 +09:00
Hermet Park
3efb659e48 capi: udpated the doc.
BETA_API -> Experimental API
2023-12-26 18:19:46 +09:00
Hermet Park
f5e6fce5c1 gif: corrected the wrong aspect ratio scaling. 2023-12-26 18:18:33 +09:00
Hermet Park
875b623c95 binding/wasm: updated save features
- removed the compression option
- added an animation save function.
2023-12-26 18:17:41 +09:00
Hermet Park
2c382e3d9b doc: keep the style clean & neat 2023-12-26 18:17:41 +09:00
Hermet Park
40ff8592e5 binding/wasm: updated save features
- removed the compression option
- added an animation save function.
2023-12-26 18:17:41 +09:00
Jinny You
059a950d42 docs: Remove all warnings from doxygen 2023-12-26 18:17:41 +09:00
Hermet Park
22c36b7069 wasm: fix a regression bug.
The Animation::frame() method has been modified.
It will now return InsufficientCondition,
if the frame value is the same as the previous one.

In addition to this change, we have also updated its usage accordingly.
2023-12-26 18:05:58 +09:00
Hermet Park
0832a188fe 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-12-26 17:51:53 +09:00
Hermet Park
1b15233aeb api: enhance the API usage.
Allow users to omit the default type casting for added convenience.
2023-12-26 17:50:36 +09:00
Sergii Liebodkin
da72a57f8a capi: introduce missing blend functions in capi bindings 2023-12-26 17:50:22 +09:00
Hermet Park
2b7c47f2b5
doc/capi: updated 2023-09-26 19:06:57 +09:00