Commit graph

3345 commits

Author SHA1 Message Date
lpogic
a67f30de65 renderer: Fix paint transformation on scene change
issue: https://github.com/thorvg/thorvg/issues/2958
2024-11-20 15:43:58 +09:00
Hermet Park
96e8d3d7a2 api: revise the gl target() api.
API modification:
- Result GlCanvas::target(int32_t id, uint32_t w, uint32_t h)
 -> Result GlCanvas::target(int32_t id, uint32_t w, uint32_t h, ColorSpace cs)
- Tvg_Result tvg_glcanvas_set_target(Tvg_Canvas* canvas, int32_t id, uint32_t w, uint32_t h)
 -> Tvg_Result tvg_glcanvas_set_target(Tvg_Canvas* canvas, int32_t id, uint32_t w, uint32_t h, Tvg_Colorspace cs)

issue: https://github.com/thorvg/thorvg/issues/1372
2024-11-20 14:55:40 +09:00
Hermet Park
0b4f2a49fe common: improved instance memory handling
- prevent dangling instances in failure scenarios by utilizing a reference counter.
- update the test suite to treat null pointer arguments as invalid argument failures.
2024-11-20 01:53:25 +09:00
Hermet Park
df8fc1949c test: ++paint reference counting 2024-11-20 01:53:25 +09:00
Hermet Park
16b985799a capi: introduced paint reference counting
New APIs:
 - uint8_t tvg_paint_ref(Tvg_Paint* paint)
 - uint8_t tvg_paint_unref(Tvg_Paint* paint, bool free)
 - uint8_t tvg_paint_get_ref(const Tvg_Paint* paint)

issue: https://github.com/thorvg/thorvg/issues/1372 https://github.com/thorvg/thorvg/issues/2598
2024-11-20 01:53:25 +09:00
Hermet Park
22d94ea629 renderer: introduced paint reference counting
The reference count of the Paint object allows
easy & safe shared ownership and control over its lifetime
among users and the engine.

New APIs:
- uint8_t Paint::ref()
- uint8_t Paint::unref(bool free = true)
- uint8_t Paint::refCnt() const

issue: https://github.com/thorvg/thorvg/issues/1372 https://github.com/thorvg/thorvg/issues/2598
2024-11-20 01:53:25 +09:00
Mira Grudzinska
511495f6d8 svg_loader: handle currentColor inside gradient
@Issue: https://github.com/thorvg/thorvg/issues/2960
2024-11-20 01:46:19 +09:00
Hermet Park
b7888c2ff3 lottie: --minor memory leak 2024-11-19 01:55:38 +09:00
Hermet Park
b66ce727ff lottie: Fixed a regression bug
Reverted commit db800c8d45,
which introduced another regression that omitted support
for multiple image asset references.

Updated the data of active images in the pooler
within the override() function to resolve the issue.
2024-11-19 01:55:38 +09:00
Hermet Park
66d4bab696 lottie: ++slot overriding
Keep trying overriding even if the given sid is invalid.

issue: https://github.com/thorvg/thorvg/issues/2969
2024-11-18 19:52:47 +09:00
Mira Grudzinska
a0f1c2d99d infra: prevent warning on windows
"conversion from 'float' to 'int8_t', possible loss of data"
2024-11-18 19:03:30 +09:00
Jinny You
931d0748bb lottie/slot: Fix incorrect image slot schema
Issue: #2964
2024-11-18 19:01:10 +09:00
Hermet Park
db800c8d45 lottie: fixed a memory leak
A regression bug by efe7440fa0

To address this, removed the non-essential image pooling mechanism.

issue: https://github.com/thorvg/thorvg/issues/2959
2024-11-18 18:51:15 +09:00
Hermet Park
8107582c8b example/lottie_extension: added overriden default slot sample 2024-11-18 16:59:17 +09:00
Hermet Park
0b0488df82 lottie: corrected an omission in overriding the default slot
issue: https://github.com/thorvg/thorvg/issues/2953
2024-11-18 16:59:17 +09:00
Jinny You
a85470b5d5 wasm: Enhance gif saving without data copy
Removed data copy for gif saving.

Binding function `save` has changed:
- bool save(string data, string mimetype)
2024-11-18 14:55:14 +09:00
Hermet Park
a5dc165fa8 sw_engine: ++exceptional handling
issue: https://github.com/thorvg/thorvg/pull/2955
2024-11-18 12:45:35 +09:00
Jinny You
4ec7ce65bc examples/slot: added example for image slot overriding 2024-11-15 18:26:32 +09:00
Jinny You
efe7440fa0 lottie/slot: Support image overriding 2024-11-15 17:56:42 +09:00
Sergii Liebodkin
0d5c3914e3 wg_engine: fix radial fill anti-aliased drawing
Use anisotropy filter for gradient fills
https://github.com/thorvg/thorvg/issues/2931
2024-11-12 16:35:04 +02:00
SergeyLebedkin
4b6f2172be wg_engineL fix test build scripts and ambiguous declarations
Issue https://github.com/thorvg/thorvg/issues/2938
2024-11-12 22:49:17 +09:00
Mira Grudzinska
c49cb49e5c lottie: fix text range opacity 2024-11-12 22:25:47 +09:00
RuiwenTang
b9cbd74fc6 gl_engine: Fix repeated clip drawing causes performance degradation
The clips need to be cleared every time when shape update.
Otherwise, the increasing number of clips will hurt the performance.
2024-11-11 22:08:04 +09:00
Hermet Park
6b2f18ffa2 capi: unified the separate linear and gradient fill APIs
API Removal:
- Tvg_Result tvg_shape_set_stroke_linear_gradient(Tvg_Paint* paint, Tvg_Gradient* grad)
- Tvg_Result tvg_shape_set_stroke_radial_gradient(Tvg_Paint* paint, Tvg_Gradient* grad)
- Tvg_Result tvg_shape_set_shape_linear_gradient(Tvg_Paint* paint, Tvg_Gradient* grad)
- Tvg_Result tvg_shape_set_shape_radial_gradient(Tvg_Paint* paint, Tvg_Gradient* grad)

API Addition:
- Tvg_Result tvg_shape_set_stroke_gradient(Tvg_Paint* paint, Tvg_Gradient* grad)
- Tvg_Result tvg_shape_set_shape_gradient(Tvg_Paint* paint, Tvg_Gradient* grad)
2024-11-10 13:48:25 +09:00
Mira Grudzinska
88a19b06f9 lottie: maxAmount support in the text range selector
@issue: #2178
2024-11-10 13:16:57 +09:00
Mira Grudzinska
84c7551c9b lottie: smoothness support in the text range selector
@issue: #2178
2024-11-10 13:16:57 +09:00
Mira Grudzinska
4ee73be95b lottie: text range selector++
Change in the algorithm for selecting characters included
in the range selector. This is the first step towards adding
support for maxAmount, smoothness, and easing.

@Issue: https://github.com/thorvg/thorvg/issues/2178
2024-11-10 13:16:57 +09:00
Hermet Park
1528ae3729 examples: updated lottie extension
Added default slot overriding case
2024-11-09 17:28:56 +09:00
Hermet Park
d8fa8f364c lottie: improve slots to properly override solid fill opacity 2024-11-09 17:28:56 +09:00
Hermet Park
f84b2331da lottie: support default slot overriding
issue: https://github.com/thorvg/thorvg/issues/2915
2024-11-09 17:28:52 +09:00
Hermet Park
ed01ef717e api: revise the spec
Remove the requirement for unique_ptr in the function prototypes.
This change will simplify the API usage, making it more streamlined
and user-friendly. However, memory management will now be the
responsibility of the user.

C++ API Modification:
- Result Paint::mask(std::unique_ptr<Paint> target, MaskMethod method) -> Result Paint::mask(Paint* target, MaskMethod method)
- Result Paint::clip(std::unique_ptr<Paint> clipper) -> Result Paint::clip(Paint* clipper)
- virtual Result Canvas::push(std::unique_ptr<Paint> paint) -> virtual Result Canvas::push(Paint* paint)
- std::unique_ptr<LinearGradient> LinearGradient::gen() -> LinearGradient* LinearGradient::gen()
- std::unique_ptr<RadialGradient> RadialGradient::gen() -> RadialGradient* RadialGradient::gen()
- Result Shape::strokeFill(std::unique_ptr<Fill> f) -> Result Shape::strokeFill(Fill* f)
- Result Shape::fill(std::unique_ptr<Fill> f) -> Result Shape::fill(Fill* f)
- std::unique_ptr<Shape> Shape::gen() -> Shape* Shape::gen()
- std::unique_ptr<Picture> Picture::gen() -> Result Picture::push(Paint* paint)
- std::unique_ptr<Scene> Scene::gen() -> Scene* Scene::gen()
- Result Text::fill(std::unique_ptr<Fill> f) -> Result Text::fill(Fill* f)
- std::unique_ptr<Text> Text::gen() -> Text* Text::gen()
- std::unique_ptr<SwCanvas> SwCanvas::gen() -> SwCanvas* SwCanvas::gen()
- std::unique_ptr<GlCanvas> GlCanvas::gen() -> GlCanvas* GlCanvas::gen()
- std::unique_ptr<Animation> Animation::gen() -> Animation* Animation::gen()
- Result Saver::background(std::unique_ptr<Paint> paint) -> Result Saver::background(Paint* paint)
- Result Saver::save(std::unique_ptr<Paint> paint, const char* filename, uint32_t quality = 100) -> Result Saver::save(Paint* paint, const char* filename, uint32_t quality = 100)
- std::unique_ptr<Saver> Saver::gen() -> Saver* Saver::gen()
- std::unique_ptr<Accessor> Accessor::gen() -> Accessor* Accessor::gen()

C++ API removal:
- template<typename T = tvg::Paint> std::unique_ptr<T> cast(Paint* paint)
- template<typename T = tvg::Paint> std::unique_ptr<T> cast(Paint* paint)

issue: https://github.com/thorvg/thorvg/issues
2024-11-09 12:29:15 +09:00
RuiwenTang
0bb419c0b0 gl_engine: Support new radial gradient data struct and calculation
Change the shader and uniform struct to support new radial gradient.
The mathematical calculation comes from https://skia.org/docs/dev/design/conical/
2024-11-08 19:15:48 +09:00
Sergii Liebodkin
627f358f49 wg_engine: support gradient focal point
Implemented gradien focal points
Issue https://github.com/thorvg/thorvg/issues/2728
Issue https://github.com/thorvg/thorvg/issues/2936
2024-11-08 18:47:38 +09:00
RuiwenTang
95d99ee74b gl_engine: Fix memory leak in the IndexBuffer object
The CPU buffer cache in the IndexBuffer object needs to be cleared, otherwise it will cause memory leaks and reduce performance per frame
2024-11-08 18:38:15 +09:00
Hermet Park
4aaa0dafc4 common: code refactoring
replaced internal string usage with char*
2024-11-08 15:26:04 +09:00
Hermet Park
9b9a0308c8 sw_engine: hotfix range broken
hotfix for release. need to review the logic again
2024-11-08 00:47:46 +09:00
Hermet Park
2b32c24712 lottie: corrected drop-shadow handling
opacity value type should be float with range 0 ~ 256
2024-11-08 00:47:46 +09:00
Hermet Park
9a134fcb90 api: revise the apis for v1.0
replaced std::string with char* in API parameters.

API Modification:
- Result Picture::load(const std::string& path) -> Result Picture::load(const char* filename)
- Result Picture::load(const char* data, uint32_t size, const std::string& mimeType, const std::string& rpath = "", bool copy = false) -> Result Picture::load(const char* data, uint32_t size, const char* mimeType, const char* rpath = "", bool copy = false)
- Result Text::load(const std::string& path) -> Result Text::load(const char* filename)
- Result Text::load(const char* name, const char* data, uint32_t size, const std::string& mimeType = "ttf", bool copy = false) -> Result Text::load(const char* name, const char* data, uint32_t size, const char* mimeType = "ttf", bool copy = false)
- Result Text::unload(const std::string& path) -> Result Text::unload(const char* filename)
- Result Saver::save(std::unique_ptr<Paint> paint, const std::string& path, uint32_t quality = 100) -> Result Saver::save(std::unique_ptr<Paint> paint, const char* filename, uint32_t quality = 100)
- Result Saver::save(std::unique_ptr<Animation> animation, const std::string& path, uint32_t quality = 100, uint32_t fps = 0) -> Result Saver::save(std::unique_ptr<Animation> animation, const char* filename, uint32_t quality = 100, uint32_t fps = 0)

issue: https://github.com/thorvg/thorvg/issues/1372
2024-11-06 21:32:45 +09:00
Hermet Park
50a7f3957b capi: support gl, webgpu canvas APIs
New APIs:
 - Tvg_Canvas* tvg_glcanvas_create(void)
 - Tvg_Result tvg_glcanvas_set_target(Tvg_Canvas* canvas, int32_t id, uint32_t w, uint32_t h)
 - Tvg_Canvas* tvg_wgcanvas_create(void)
 - Tvg_Result tvg_wgcanvas_set_target(Tvg_Canvas* canvas, void* instance, void* surface, uint32_t w, uint32_t h, void* device)

issue: https://github.com/thorvg/thorvg/issues/2855
2024-11-06 17:17:12 +09:00
Hermet Park
f68d053ddb capi: clean up code 2024-11-06 17:17:12 +09:00
Sergii Liebodkin
52356b023d wg_engine: fix scene blending
In a case of scenes without masking white clear color used, instead of black color

Issue https://github.com/thorvg/thorvg/issues/2592
Issue https://github.com/thorvg/thorvg/issues/2921
2024-11-06 01:11:15 +09:00
Hermet Park
2ad6753680 lottie: support drop shadow effect
issue: https://github.com/thorvg/thorvg/issues/2153
issue: https://github.com/thorvg/thorvg/issues/2718
2024-11-06 00:56:11 +09:00
Hermet Park
1d943ecdf2 example: added DropShadow sample
- renamed SceneEffect to EffectGaussianBlur
2024-11-06 00:56:11 +09:00
Hermet Park
e0365142a7 renderer: support SceneEffect DropShadow
Apply a drop shadow effect with a Gaussian Blur filter.

API Addition:
 - enum class SceneEffect::DropShadow

Parameters:
 - color_R(int)[0 - 255]
 - color_G(int)[0 - 255]
 - color_B(int)[0 - 255]
 - opacity(int)[0 - 255]
 - angle(float)[0 - 360]
 - distance(float)
 - blur_sigma(float)[> 0]
 - quality(int)[0 - 100]

issue: https://github.com/thorvg/thorvg/issues/2718
2024-11-06 00:56:11 +09:00
Sergii Liebodkin
93ebd388c7 wg_engine: implement dash offset
Introduced dash offset param for stroke dashes
Issue https://github.com/thorvg/thorvg/issues/2592
2024-11-05 12:05:49 +09:00
Sergii Liebodkin
505ebe9fe6 wg_engine: fix close command logic
On a close path command creates a new object started form the closed point
issue: https://github.com/thorvg/thorvg/pull/2923
2024-11-05 11:55:38 +09:00
Hermet Park
6d03def994 examples: updated svg resources 2024-11-04 16:22:10 +09:00
Hermet Park
85b83563d6 lottie: clean up code 2024-11-04 13:09:16 +09:00
Hermet Park
78acf02dbc
Update README.md 2024-11-04 11:47:20 +09:00
Hermet Park
87761dc7c7 lottie/slot: revise gradient fill support
Revise gradient fill data parsing by adding support
for the color stop count (p) parameter in slot data.

issue: https://github.com/thorvg/thorvg/issues/2795
2024-11-04 11:43:36 +09:00