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.
Shapes with boundaries outside the rendering area are ignored as non-visible.
The issue arises when such a shape serves as a clipper.
The expected behavior is for the entire clipee to be cut out,
but previously, the clipee remained fully visible as if no clip was applied.
The fix identifies these clippers and skips rendering clipees.
Please note that we can skip rendering at the Paint update stage
if the clipper's viewport is outside the canvas.
This optimization can improve performance, but only for this specific case.
The downside of the approach is that it disrupts multi-processing for clipper updates.
As a result, that approach was discarded.
issue: https://github.com/thorvg/thorvg/issues/3003
issue: https://github.com/thorvg/thorvg/issues/2684
Co-Authored-By: Mira Grudzinska <mira@lottiefiles.com>
The only scenarios where 'check valid region' and
'check boundary' occur are when mathUpdateOutlineBBox()
returns true. This, in turn, happens only if mathClipBBox()
returns true. If that is the case, it means that just
before this return, exactly the same checks were performed.
The binary size recently increased due to the ASYNCIFY option, which was required for WebGPU initialization.
To prevent unnecessary binary size growth, ThorVG will no longer depend on asynchronous processes such as `emscripten_sleep` (ASYNCIFY or JSPI).
As a result, the combined WASM binary size has been significantly reduced to less than 1MB.
Size comparison: 1559KB → 998KB (-36%)
Following ThorVG API changes (#1372), updated the canvas handling:
- Replaced Canvas::clear() calls with Canvas::remove()
- Updated Canvas::draw() usage to handle buffer clearing
Basically rewrite the PathTrim code, correct the Line and Bezier split
function calling.
Also the trim situation where start is greater than end can be handled correctly.
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 the rendering composition target to better support features such as
alpha blending, blending, masking, post effects, and more.
This allows rasterizers to prepare the composition context with more precise control.
Additionally, resolved a crash in the software engine's post-effect process
caused by a buffer size mismatch during XY buffer flipping.
issue: https://github.com/thorvg/thorvg/issues/3009
issue: https://github.com/thorvg/thorvg/issues/2984
- 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
Since longjmp is not yet fully supported on Wasm (emscripten uses
JS to make the jumps and requires slow jumps), but also because
longjmp is hard to reason about, this patch replaces it with
return values. The logic stays exactly the same.
certain systems, may not support file I/O operations.
ThorVG should provide users with an option to configure
builds according to their requirements.
This ensures that file I/O calls are avoided,
preventing potential crashes.
Please use the meson '-Dfile=true/false' option for this.
Please note that "THORVG_FILE_IO_SUPPORT" might be expected
for your thorvg manual build.
issue: https://github.com/thorvg/thorvg/issues/3008
Support cross compile the GL backend code into WASM.
The code needs WebGL 2.0 API so, the compile flags contains `MAX_WEBGL_VERSION` and `FULL_ES3`
Also add binding code to initialize the WebGL context and GLCanvas.