Commit graph

100 commits

Author SHA1 Message Date
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
Hermet Park
0e45fabb3d spec out tvg binary format
issue: https://github.com/thorvg/thorvg/issues/2721
2024-10-12 21:07:31 +09:00
Hermet Park
9bc900206b api: polish the thorvg API usages.
API Modification:
- SwCanvas::Colorspace -> ColorSpace

API Addition:
- ColorSpace::Unknown

issue: https://github.com/thorvg/thorvg/issues/1372
2024-10-12 15:38:03 +09:00
Hermet Park
eb1208414d example: unify Shape & MultiShapes 2024-10-11 17:16:59 +09:00
JunsuChoi
6cfc22d123 svg_loader: Support id attribute for tvg::Accessor
Supports access with tvg::Accessor using the value set in the id attribute of SVG
Please refer to examples/Accessor.cpp
2024-10-09 00:04:41 +09:00
Hermet Park
0da15d2e76 examples/lottie: updated resources 2024-10-08 11:46:53 +09:00
Hermet Park
145195baac infra: removed beta tag from WebGPU
Removed beta tag for dev convenience. Also, ensures that
ThorVG will officially release WebGPU in the next version (v1.0)
2024-10-07 21:08:52 +09:00
Hermet Park
a72ed0ddfa wg_engine: fixed resource leaks
issue: https://github.com/thorvg/thorvg/issues/2808
2024-10-04 14:20:51 +09:00
Mira Grudzinska
a80beff714 examples: fix mingw build error
M_PI was not declared error solved
2024-10-03 16:39:18 +09:00
Hermet Park
ad6f2070fe examples/tvg: updated samples 2024-10-01 12:17:32 +09:00
Hermet Park
4bb0a369e5 examples: fixed an incorrect buffer size.
adjusted the size according to the offsets.
2024-09-30 17:09:21 +09:00
Hermet Park
ba7761c105 examples: added SceneEffect
added a showcase with a gaussian blur effect
2024-09-29 15:04:22 +09:00
RuiwenTang
64df0791df example: MultiCanvas show case with GL backend
Change the MultiCanvas code to show how to render the content of
GlCanvas to a given off-screen framebuffer.

issue: https://github.com/thorvg/thorvg/issues/2746
2024-09-29 11:57:27 +09:00
Hermet Park
76fb3f3cd9 api: clean up
promoted offical c++ apis (v0.15)
 - enum class BlendMethod
 - enum class CanvasEngine::Wg
 - virtual Result Canvas::viewport(int32_t x, int32_t y, int32_t w, int32_t h);
 - class Text
 - Result Text::fill(uint8_t r, uint8_t g, uint8_t b)
 - Result Text::fill(std::unique_ptr<Fill> f)
 - static Result Text::unload(const std::string& path)
 - static Result Text::load(const std::string& path)
 - static Result Text::load(const char* name, const char* data, uint32_t size, const std::string& mimeType = "ttf", bool copy = false)
 - static std::unique_ptr<Text> Text::gen()
 - class WgCanvas
 - static std::unique_ptr<WgCanvas> WgCanvas::gen()
 - static const char* Initializer::version(uint32_t* major, uint32_t* minor, uint32_t* micro)
 - class LottieAnimation

promoted official c apis (v0.15)
 - Tvg_Blend_Method
 - Tvg_Result tvg_engine_version(uint32_t* major, uint32_t* minor, uint32_t* micro, const char** version)
 - Tvg_Result tvg_canvas_set_viewport(Tvg_Canvas* canvas, int32_t x, int32_t y, int32_t w, int32_t h)
 - Tvg_Result tvg_paint_set_blend_method(Tvg_Paint* paint, Tvg_Blend_Method method)
 - Tvg_Paint* tvg_text_new(void)
 - Tvg_Result tvg_text_set_fill_color(Tvg_Paint* paint, uint8_t r, uint8_t g, uint8_t b)
 - Tvg_Result tvg_text_set_gradient(Tvg_Paint* paint, Tvg_Gradient* gradient)
 - Tvg_Result tvg_font_load(const char* path)
 - Tvg_Result tvg_font_load_data(const char* name, const char* data, uint32_t size, const char *mimetype, bool copy)
 - Tvg_Result tvg_font_unload(const char* path)
 - Tvg_Animation* tvg_lottie_animation_new(void)

removed experimental apis
 - BlendMethod paint::blend() const
 - bool Shape::strokeTrim(float* begin, float* end) const
 - Tvg_Result tvg_paint_get_blend_method(const Tvg_Paint* paint, Tvg_Blend_Method* method)
 - Tvg_Result tvg_shape_get_stroke_trim(Tvg_Paint* paint, float* begin, float* end, bool* simultaneous)
 - tvg_text_set_linear_gradient(Paint* paint, Tvg_Gradient* gradient)
 - tvg_text_set_radial_gradient(Paint* paint, Tvg_Gradient* gradient)

issue: https://github.com/thorvg/thorvg/issues/1372
2024-09-23 21:53:50 +09:00
Hermet Park
03dbb7a8e1 examples: updated a lottie sample 2024-09-19 15:30:40 +09:00
Hermet Park
ece1537271 examples: replaced ClipPath with clip() 2024-09-19 14:46:05 +09:00
Hermet Park
ae6faf56c5 lottie/expressions: ++coverage
Allow direct key[0]/key[1] access for key.value in expression

issue: https://github.com/thorvg/thorvg/issues/2722
2024-09-17 21:13:59 +09:00
Hermet Park
0e06413749 Revert "examples: updated samples"
This reverts commit 1e72e8f3a3.
2024-09-15 15:24:36 +09:00
Hermet Park
1e72e8f3a3 examples: updated samples 2024-09-15 00:19:33 +09:00
Hermet Park
c562d63487 examples: updated lottie resources 2024-09-13 11:03:41 +09:00
Hermet Park
a746e1fcd6 renderer: blending refactoring++
- reordered the blending types to align with lottie spec.
- removed source over.
2024-09-09 21:18:13 +09:00
Sergii Liebodkin
e2e4fc6964
wg_engine: external device handles (web integration)
move instance, adapter and device creation from renderer to application
its necessary for web integration, because browser have its own mechanics to create hardware handles
this changes makes webgpu canvas more universal to use in case of system and web applications

issue: https://github.com/thorvg/thorvg/issues/2410
2024-09-06 13:08:58 +09:00
Hermet Park
d807ac91ea examples: ++svg samples 2024-09-05 23:52:22 +09:00
Hermet Park
ac384332fe examples: added image rotation 2024-08-22 13:01:53 +09:00
Mira Grudzinska
022f9fc897 examples: capi example ++
Animation is loaded from a memory instead from a file.
2024-08-20 18:46:29 +09:00
Hermet Park
5332876fe8 common: spec out TexMap
Spec out this incomplete experimental feature,
this is a still promising one, we will reintroduce
this officially after 1.0 release

size: -2kb

issue: https://github.com/thorvg/thorvg/issues/1372
2024-08-20 11:14:54 +09:00
Elliott Sales de Andrade
5f08b9ade4 build: Remove redundant comparisons
If a Meson option is typed as `boolean`, the `get_option` returns a
boolean, and comparing it with `true` is redundant. Meson also errors if
you try to compare across types, so it couldn't _not_ be a boolean.

Also, Meson is not C, so no need for parentheses around `if` conditions.
2024-08-19 17:42:40 +09:00
Mira Grudzinska
f79558eb62 API: deprecate the appendArc() api
@Issue: https://github.com/thorvg/thorvg/issues/2632
2024-08-16 13:30:58 +09:00
Hermet Park
407fc84796 common: spec out Scene Clipper
Scene Clipper is an unusual feature
that is too unstable and ambiguous in ThorVG.

Users can achieve the same functionality
with multiple composed shapes instead of scene clipping.

size: -2.5kb

issues:
- https://github.com/thorvg/thorvg/issues/1548
- https://github.com/thorvg/thorvg/issues/1549
- https://github.com/thorvg/thorvg/issues/1573
2024-08-13 10:21:54 +09:00
Hermet Park
92303e91b4 examples: added Interaction sample
The Interaction sample demonstrates
how to handle user input with ThorVG Animation.
2024-08-07 12:02:22 +09:00
Hermet Park
d62b913455 renderer/accessor: revise set() api for animation support
before:
unique_ptr<Picture> Accessor::set(unique_ptr<Picture> picture, function<bool(const Paint* paint)> func)

after:
Result Accessor::set(const Picture* picture, std::function<bool(const Paint* paint, void* data)> func, void* data)
2024-08-07 12:02:22 +09:00
Hermet Park
8e91711358 examples: added Lighten/Darken options in MaskingMethods 2024-08-07 11:04:38 +09:00
Hermet Park
adbf7d3a2f examples/lottie: updated a resource.
polished up for the animation smoothness.
2024-08-06 16:45:39 +09:00
Hermet Park
c257994d5c lottie/expressions: feature enhancement
added groupIndex() support
added property (ix) value support
2024-07-31 18:26:42 +09:00
Hermet Park
de72161087 example: merge Path & PathCopy 2024-07-21 15:05:07 +09:00
Hermet Park
db889e1835 renderer: quick skip rendering if the opacity is zero
This also resolves a corner case bug introduced by
lottie render pooling: f06127ab93
2024-07-21 15:05:07 +09:00