- 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.
The API allows now values <= 0 for dashes and gaps. Negative values
are treated as zero. The exception is when all provided values
are <= 0, in which case the dash is ignored.
This fixes the issue when dash = 0 was provided for strokes with round
or butt caps - the dot was not drawn, even though it should have been.
docs: the strokeDash API behavior's clarification for odd numbers
of values in dashPattern and refinement of the accepted values.
Added drawing exceptions when target is not properly ready.
Now, Canvas::update() Canvas::draw() will return InsufficientCondition
if the target has not been set beforehand.
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
- 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)
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
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
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
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.
The current Paint::bounds(transform=true) returns the coordinates
of the paint in its local coordinates after transformation.
However, it did not convert the origin to the world coordinate.
This is problematic when the user wants to determine
the paint's position and size with the origin being the canvas.
Specifically, this matters that when the paint is belonged
to a certain scene.
Now, the bounds() method returns the coordinates
of the paint's bounding box with the corrected world space.
User can figure out the actual boundary within the painted result.
Remark that, this may break the functional behavior compatibility.
Adds the ability to load some composite glyphs and prevents an error when a composite glyph is used.
Implementation based on ttf glyf table documentation: https://learn.microsoft.com/en-us/typography/opentype/spec/glyf
There are still some missing features like scaling, parent glyph point based positioning etc. I think this is a topic for future work. Howerever, it looks like implemented features are enough for utf-8 latin subset in major fonts.
issue: #2599