Commit graph

135 commits

Author SHA1 Message Date
RuiwenTang
3c5034e145 gl_engine: dynamic load GL functions with glad 2025-02-07 13:00:35 +09:00
Hermet Park
4f0f2e4c08 example: removed interaction sample
LottieTweening is replaced with it.
2025-02-06 19:09:27 +09:00
Hermet Park
be0949339c example: added lottie tweening sample 2025-02-06 19:09:27 +09:00
Popolon
02be99185e include <cstring> in examples/Example.h 2025-02-03 11:23:34 +09:00
Hermet Park
97f85d44cb example/interaction: chores++ 2025-01-22 13:22:24 +09:00
Hermet Park
fdd760a34f api: revised the animation segment specification
Changed the unit of the segment from a normalized value to frame numbers,
ensuring alignment with other frame control interfaces.

Note that This change may break backward compatibility.

issue: https://github.com/thorvg/thorvg/issues/3116
2025-01-22 13:03:48 +09:00
Hermet Park
48c8094d19 api: path api revision for v1.0
Unify the Path commands & pts getters.

C++ API modiciation:
- uint32_t Shape::pathCommands(const PathCommand** cmds) const
- uint32_t Shape::pathCoords(const PathCommand** cmds) const
 -> Result Shape::path(const PathCommand** cmds, uint32_t* cmdsCnt, const Point** pts, uint32_t* ptsCnt)

C API modification:
- Tvg_Result tvg_shape_get_path_coords(const Tvg_Paint* paint, const Tvg_Point** pts, uint32_t* cnt)
- Tvg_Result tvg_shape_get_path_commands(const Tvg_Paint* paint, const Tvg_Path_Commands** cmds, uint32_t* cnt)
 -> Tvg_Result tvg_shape_get_path(const Tvg_Paint* paint, const Tvg_Path_Command** cmds, uint32_t* cmdsCnt, const Tvg_Point** pts, uint32_t* ptsCnt)

issue: https://github.com/thorvg/thorvg/issues/3116
2025-01-14 11:47:28 +09:00
Hermet Park
f5aa347a70 api: renamed api for consistency
API modification:
- Shape::fillColor() -> Shape::fill()

issue: https://github.com/thorvg/thorvg/issues/3116
2025-01-13 16:53:14 +09:00
Hermet Park
bc1ad7104d example: corrected reveresed arguments 2025-01-13 12:14:15 +09:00
Jinny You
2a6e3ca40a examples: add slot transform overriding samples 2025-01-07 16:03:37 +09:00
Hermet Park
3d999ca1db examples: revise the blending sample
Note that scene blending doesn't work properly
2025-01-07 12:16:07 +09:00
Hermet Park
a12accbc93 updated copyright 2025-01-03 14:32:31 +09:00
Hermet Park
12b3747d08 examples: updates svg resources 2024-12-31 14:02:26 +09:00
Jinny You
596de01b12 gl_engine: revise target API for context managing
Issue: #3024
2024-12-31 12:07:52 +09:00
Hermet Park
0e9bc74603 api: renamed FillRule::Winding to NonZero
aligned the name with the web standard.
2024-12-27 21:16:27 +09:00
Hermet Park
0437d482bd example: updated with a stroknig clipper 2024-12-19 20:37:28 +09:00
Hermet Park
8ec2eee6e3 example: added Tritone Scene Effect 2024-12-17 17:55:34 +09:00
Hermet Park
8e8611b608 examples: added tint scene effect
also, merged gausiaan, fill altogether in SceneEffects
2024-12-17 12:16:44 +09:00
Hermet Park
79cbc0ebbc infra: --meson deprecated usages
meson.source_root -> meson.project_source_root()
meson.build_root -> meson.project_build_root()
2024-12-13 01:20:25 +09:00
Hermet Park
666dcbcb38 examples: add Fill SceneEffect sample 2024-12-12 18:50:33 +09:00
Hermet Park
6761c5c2a0 API: Replace the Canvas::clear() API with Canvas::remove() & draw()
Added a `clear` parameter to Canvas::draw(), allowing users to decide
whether to clear the target buffer before drawing.

To remove the paints from a canvas, please use Canvas::remove()

C++ API Removals:
- Result Canvas::clear(bool paints, bool buffer)

C++ API Modifications:
- Result Canvas::draw()
 -> Result Canvas::draw(bool clear)

C API Removals:
- Tvg_Result tvg_canvas_clear(bool paints, bool buffer)

C API Modifications:
- Tvg_Result tvg_canvas_draw(Tvg_Canvas* canvas)
 -> Tvg_Result tvg_canvas_draw(Tvg_Canvas* canvas, bool clear)

issue: https://github.com/thorvg/thorvg/issues/1372
2024-12-10 11:59:46 +09:00
Hermet Park
a2d2b3f07c example: update EffectGaussianBlur 2024-12-04 22:31:37 +09:00
Hermet Park
0ebbc614be api: 1.0 specification revision
- Enhanced Scene management to provide users with more control.
- Scenes now support adding specific scenes at defined positions and removing them as needed.
- Ensure safe access to Canvas, Scene paints() by adding const specifiers.
- Removed virtual specifier for the canvas primitive apis.
- Introduced a nested scene in the canvas to remove logic duplication.

C++ API Modification:
- Result Scene::push(Paint* paint)
 -> Result Scene::push(Paint* target, Paint* at = nullptr)
- Result Scene::clear(bool free = true)
 -> Result Scene::remove(Paint* paint = nullptr)
- Result Canvas::push(Paint* paint)
 -> Result Canvas::push(Paint* target, Paint* at = nullptr)
- list<Paint*>& Scene::paints()
 -> const list<Paint*>& Scene::paints() const
- list<Paint*>& Canvas::paints()
 -> const list<Paint*>& Canvas::paints() const

C++ API Addition:
- Result Canvas::remove(Paint* paint = nullptr);

C API Modifications:
- Tvg_Result tvg_scene_clear(Tvg_Paint* scene, bool free)
 -> Tvg_Result tvg_scene_remove(Tvg_Paint* scene, Tvg_Paint* paint)

C API Addition:
- Tvg_Result tvg_scene_push_at(Tvg_Paint* scene, Tvg_Paint* target, Tvg_Paint* at)
- Tvg_Result tvg_canvas_push_at(Tvg_Canvas* canvas, Tvg_Paint* target, Tvg_Paint* at)
- Tvg_Result tvg_canvas_remove(Tvg_Canvas* canvas, Tvg_Paint* paint)

issue: https://github.com/thorvg/thorvg/issues/2957
issue: https://github.com/thorvg/thorvg/issues/1372
2024-12-04 11:44:58 +09:00
Sergii Liebodkin
cf05128a96 wg_engine: revision of device creation policy
make valid device and instance as mandatory paramter for webgpu renderer
2024-11-29 18:48:01 +09:00
Hermet Park
0f409a654a renderer: reserved colorspace option in target api
API Modification:
- Result WgCanvas::target(void* device, void* instance, void* target, uint32_t w, uint32_t h, int type = 0)
 -> Result WgCanvas::target(void* device, void* instance, void* target, uint32_t w, uint32_t h, ColorSpace cs, int type = 0)
- Tvg_Result tvg_wgcanvas_set_target(Tvg_Canvas* canvas, void* device, void* instance, void* target, uint32_t w, uint32_t h, int type)
 -> Tvg_Result tvg_wgcanvas_set_target(Tvg_Canvas* canvas, void* device, void* instance, void* target, uint32_t w, uint32_t h, Tvg_Colorspace cs, int type)
2024-11-26 12:04:30 +09:00
Hermet Park
97058badbf example: ++lottie extension 2024-11-26 01:11:03 +09:00
Hermet Park
036d1e7cac example: ++gl, wgpu safety
Free the canvas in the reverse order of their creation.
2024-11-25 11:10:25 +09:00
Sergii Liebodkin
077a0481c4 wg_engine: reset context in examples
Fix examples termination process: reset context while window releasing before webgpu instance released
Issue https://github.com/thorvg/thorvg/issues/2745
2024-11-22 18:34:46 +09:00
Sergii Liebodkin
d0bc4bc4f5 wg_engine: multicanvas support (multicanvas example)
Updated multicanvas example
Issue https://github.com/thorvg/thorvg/issues/2745
2024-11-22 12:34:26 +09:00
Sergii Liebodkin
3805f26aff wg_engine: multicanvas support
Added multicanas support
Issue https://github.com/thorvg/thorvg/issues/2745
2024-11-22 12:34:26 +09:00
Hermet Park
57fcada8cc example: updated lottie samples 2024-11-22 11:17:07 +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
Jinny You
931d0748bb lottie/slot: Fix incorrect image slot schema
Issue: #2964
2024-11-18 19:01:10 +09:00
Hermet Park
8107582c8b example/lottie_extension: added overriden default slot sample 2024-11-18 16:59:17 +09:00
Jinny You
4ec7ce65bc examples/slot: added example for image slot overriding 2024-11-15 18:26:32 +09: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
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
Hermet Park
1528ae3729 examples: updated lottie extension
Added default slot overriding case
2024-11-09 17:28:56 +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
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
1d943ecdf2 example: added DropShadow sample
- renamed SceneEffect to EffectGaussianBlur
2024-11-06 00:56:11 +09:00
Hermet Park
6d03def994 examples: updated svg resources 2024-11-04 16:22:10 +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
Hermet Park
4bfa7ce913 example/lottie: added solid fill slot overriding 2024-11-01 12:40:38 +09:00
Hermet Park
62a4e7e6dd example: ++corection 2024-11-01 11:49:30 +09:00
Mira Grudzinska
422674b4c9 api: add focal parameters to the radial apis
API modification:
- Result RadialGradient::radial(float cx, float cy, float radius)
- Result RadialGradient::radial(float cx, float cy, float r, float fx, float fy, float fr)
- Result RadialGradient::radial(float* cx, float* cy, float* radius)
- Result RadialGradient::radial(float* cx, float* cy, float* r, float* fx = nullptr, float* fy = nullptr, float* fr = nullptr)

@Issue: https://github.com/thorvg/thorvg/issues/2860
2024-10-23 11:10:14 +09:00
Hermet Park
98700ed2d2 example: ++scene effect 2024-10-22 15:32:09 +09:00
Mira Grudzinska
f94e419d2d example: include mask extension in personal_character.json 2024-10-18 18:04:31 +09:00
Hermet Park
0a16152d75 api: renamed the composite with mask.
Since we've separated ClipPath and Masking,
Masking now has a distinct and independent purpose.

API Modification:
 - enum class CompositeMethod -> enum class MaskMethod
 - Result Paint::composite(std::unique_ptr<Paint> target, CompositeMethod method) -> Result Paint::mask(std::unique_ptr<Paint> target, MaskMethod method)
 - CompositeMethod Paint::mask(const Paint** target) const -> MaskMethod Paint::mask(const Paint** target) const

issue: https://github.com/thorvg/thorvg/issues/1372
2024-10-16 14:41:26 +09:00
Hermet Park
65916857e2 api: polish the thorvg API usages
Use ColorSpace to support various types of raw bitmaps.

API Modifications:
- Result Picture::load(uint32_t* data, uint32_t w, uint32_t h, bool premultiplied, bool copy = false) -> Result Picture::load(uint32_t* data, uint32_t w, uint32_t h, ColorSpace cs, bool copy = false)
- Tvg_Result tvg_picture_load_raw(Tvg_Paint* paint, uint32_t *data, uint32_t w, uint32_t h, bool premultiplied, bool copy) -> Tvg_Result tvg_picture_load_raw(Tvg_Paint* paint, uint32_t *data, uint32_t w, uint32_t h, Tvg_Colorspace cs, bool copy)

issue: https://github.com/thorvg/thorvg/issues/1372
2024-10-13 11:15:57 +09:00