- Paint explicity allows a shape as a clipper
- Added clipper getter apis
API Updates
+ Shape* Paint::clip()
* Result Paint::clip(Paint* clipper) -> Result Paint::clip(Shape* clipper)
CAPI Updates
+ Tvg_Paint* tvg_paint_get_clip(const Tvg_Paint* paint)
* Tvg_Result tvg_paint_clip(Tvg_Paint* paint, Tvg_Paint* clipper)
-> Tvg_Result tvg_paint_set_clip(Tvg_Paint* paint, Tvg_Paint* clipper);
Please note that clipper type can be changed again to tvg::Path
in the upcoming update.
Simplified parameters and ensured proper backend engine
initialization by using reference checking through canvas
instances.
C++ API Modification:
- Result Initializer::init(uint32_t threads, CanvasEngine engine)
-> Result Initializer::init(uint32_t threads)
- Result Initializer::term(CanvasEngine engine)
-> Result Initializer::term()
C API Modification:
- Tvg_Result tvg_engine_init(Tvg_Engine engine_method, unsigned threads)
-> Tvg_Result tvg_engine_init(unsigned threads);
- Tvg_Result tvg_engine_term(Tvg_Engine engine_method)
-> Tvg_Result tvg_engine_term()
issue: https://github.com/thorvg/thorvg/issues/3116
The following is a redesign that extends the class internally.
The main goal is to preserve the characteristics of the pImpl idiom
for data encapsulation, while simultaneously reducing the memory
allocation overhead typically associated with pImpl.
The stragegy is here:
Rather than alloc the impl memory inside of the thorvg engine,
impl extends the API classes in order to consolidate the memory.
size has been decreased by -4kb with optimization=s
issue: https://github.com/thorvg/thorvg/issues/3214
ThorVG cap/join enums and lottie specs were not aligned.
Problem was observed for StrokeCap::Square and StrokeJoin::Bevel.
Note: this change breaks backward comatibility.
- modify the concept of AABB to apply only to transformed shapes.
- transform points before computing the bounding box min/max
to obtain a more compact shape region.
- trimmming memory by removing the cached matrix, about 36kb
of memory has been reduced per paint instance.
added 2 more APIs for user convenience to allow backtracking tree traversal.
API Additions:
- const Paint* Paint::scene() const
- const Tvg_Paint* tvg_paint_get_scene(const Tvg_Paint* paint)
We have improved the functionality to manage the memory pool safely,
by figuring out the current working threads. Users no longer need to
manually configure memory pool management, and the related APIs
have been removed.
API Removals:
- Result SwCanvas::mempool(MempoolPolicy policy)
- enum SwCanvas::MempoolPolicy
- Tvg_Result tvg_swcanvas_set_mempool(Tvg_Canvas* canvas, Tvg_Mempool_Policy policy)
- enum Tvg_Mempool_Policy
issue: https://github.com/thorvg/thorvg/issues/3116
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
The Tritone effect maps the scene's shadows, midtones, and highlights
to three specific colors, allowing for more complex and artistic color grading.
Applied Tritone Formula:
if (L < 0.5) Result = (1 - 2L) * Shadow + 2L * Midtone
else Result = (1 - 2(L - 0.5)) * Midtone + (2(L - 0.5)) * Highlight
Where the L is Luminance.
issue: https://github.com/thorvg/thorvg/issues/2718
The Tint effect in ThorVG is used to modify the overall color tone of a scene.
It works by blending a specified tint color with the existing colors of the scene.
This effect is useful for color grading, mood changes, or applying thematic filters
to vector graphics and animations.
Applied the equation is:
Result = (1 - L) * Black + L * White, where the L is Luminance.
issue: https://github.com/thorvg/thorvg/issues/2718
ThorVG pImpl idiom caused internal data to be scattered
across hierarchical classes. This refactoring consolidates
the data by inheriting pImpl internally, reducing memory
allocation counts and eliminating unnecessary strategy methods.
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
- 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
- prevent dangling instances in failure scenarios by utilizing a reference counter.
- update the test suite to treat null pointer arguments as invalid argument failures.
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
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
- refactored the Fill matrix to hold internal data statically.
- refactored for clean & neat the raster engine / svg loader logic.
API Modification:
- Matrix Fill::transform() const -> Matrix& Fill::transform() const
issue: https://github.com/thorvg/thorvg/issues/1372
Scene effects are typically applied to modify
the final appearance of a rendered scene,
such as adding a blur effect.
Each effect would have a different number of parameters
to control its visual properties. The Scene::push() interface
uses variadic arguments to accommodate various cases.
Users should refer to the SceneEffect API documentation
and pass the parameters exactly as required for the specific
effect type. For instance, GaussianBlur expects 3 parameters
which are:
- sigma(float)[greater than 0]
- direction(int)[both: 0 / horizontal: 1 / vertical: 2]
- border(int)[extend: 0 / wrap: 1]
- quality(int)[0 ~ 100]
and, scene->push(SceneEffect::GaussianBlur, 5.0f, 0, 0, 100);
New Experimental APIs:
- SceneEffect::ClearAll
- SceneEffect::GaussianBlur
- Result Scene::push(SceneEffect effect, ...);
Example:
- examples/SceneEffect
issue: https://github.com/thorvg/thorvg/issues/374
Separate clip function from the Composite()
clipping and composition can be used together.
This helps avoid the introduction of nested scenes
when composition and clipping overlap.
Deprecated:
- enum class CompositeMethod::ClipPath
- enum Tvg_Composite_Method::TVG_COMPOSITE_METHOD_CLIP_PATH
Experimental API:
- Result Paint::clip(std::unique_ptr<Paint> clipper)
- Tvg_Result tvg_paint_set_clip(Tvg_Paint* paint, Tvg_Paint* clipper)
Issue: https://github.com/thorvg/thorvg/issues/1496