- Implements support for zero size blur in drop shadow effects for both GL and WebGPU engines.
When the blur sigma parameter is zero, the implementation now skips the blur processing entirely
and uses the original image as the shadow source. Improving performance and avoiding
unnecessary computations
- EffectDropShadow example changed to reproduce zero sigma shadow
https://github.com/thorvg/thorvg/issues/3602
Set the scene to use Composition mode so that it generates
a pre-composition image, and then normal blend with
destination.
see also: https://github.com/thorvg/thorvg/pull/3621
implement effect duplication functionality
to enable proper Scene duplication with effects.
issue: https://github.com/thorvg/thorvg/issues/3631
Co-Authored-By: Hermet Park <hermet@lottiefiles.com>
At the moment, we use the value GL_INVALID_VALUE
to mark an invalid handle for FBO, which is not correct.
It is more correct to use the value 0,
which signals that the buffer was not created.
Canvas initialization processes have also been adjusted.
The stroke bounding box in ThorVG was previously only approximated,
as the stroke transformation was mistakenly omitted. This has now
been enhanced.
The stroke join/corner is still not taken into account in the
bounding box computation...
- Hue: Creates a result color with the luminance and saturation
of the base color and the hue of the blend color.
- Color: Creates a result color with the luminance of the base color
and the hue and saturation of the blend color. This preserves the gray
levels in the image and is useful for coloring monochrome images and
for tinting color images.
- Luminosity: reates a result color with the hue and saturation of the base color
and the luminance of the blend color. This mode creates the inverse effect of
Color mode.
- Saturation: Creates a result color with the luminance and hue of
the base color and the saturation of the blend color. Painting with this mode
in an area with no (0) saturation (gray) causes no change.
- HardMix: Adds the bottom & top. If the resulting sum for a channel is 255 or
greater, it receives a value of 255; if less than 255, a value of 0.
issue: https://github.com/thorvg/thorvg/issues/2701
1. new tesseletor and stroker are used: less vertexes generated
In general, the previous implementation was based on the path-outline-mesh approach.
It has now been changed to a path-mesh approach, so we skip the path-outline transformation.
For shape fills, a BW-tesselator now used, and all submeshes (moveTo) are stored in a single buffer.
For strokes, all intermediate operations such as trimming and dash use path-path logic instead of outline-outline logic.
In addition, the new stroker generates fewer polygons for joints, especially for Rounds
2. render all sub-shapes by single draw call
https://github.com/thorvg/thorvg/issues/3557https://github.com/thorvg/thorvg/issues/3288https://github.com/thorvg/thorvg/issues/3273
- Introduced RGB, RGBA, and HSL structures
- Migrated hsl2Rgb() from SVG loader to common module
This is a refactoring for upcoming hsl color functionlaities.
The composition mode enables intermediate blending. When a scene
uses Composition mode, it generates an intermediate buffer to
render the scene image first. This image can then be blended
with the canvas afterward.
Please avoid to use this, unless you really need to composite
the precomposite scene. This feature is relatively expensive
at performance.
C++ API:
+BlendMethod::Composition
C API:
+Tvg_Blend_Method::TVG_BLEND_METHOD_COMPOSITION
- Use RenderPath common interfaces instead of
direct array manipulations.
- Replace multiple scalar operations with Point utility
operations where applicable.
Move stroke dasher to the common code space to create an abillity
to use it on the cross API renderers (wg and gl). Stroke dasher is
a path-to-path operation, same as path trim, so can be placed to
the common space.
Now RenderShape can generate dashed path by itself. Dashing mechanics
fully hiden from the user but can be used in gl and wg renderers.
issue: https://github.com/thorvg/thorvg/issues/3557
Co-Authored-By: Hermet Park <hermet@lottiefiles.com>
Previously, only single-level <use> references were supported.
If a <use> node pointed to another element that itself contained
a <use> node, the reference wasn’t resolved.
This has been fixed by replacing the array of postponed elements
with a list. The list is traversed, and nodes aren’t cloned while
they or any of their children remain unresolved. In such cases,
the target element also gets added to the list, enabling recursive
resolution of nested href references.
issue: https://github.com/thorvg/thorvg/issues/3615
- shadow rendering was skipped when the blur value was 0.
it now correctly renders shadows without blur.
- this also fixes the distance offset scalability.
issue: https://github.com/thorvg/thorvg/issues/3602
skip interpolation when intensity is 1.0.
since intensity adjustment is optional and
computationally expensive, avoiding it in this case
is worthwhile.
- minor optimization of the unpremultiply logic
- exception handling for the unpremultipy logic for anti-aliasing quality
- appropriate alpha pre/unpre multiplication is applied
- clean code++
- updated doc blending equation
issue: https://github.com/thorvg/thorvg/issues/1944
Clarify the FillRule usage by associating it
explicitly with color/gradient fills.
C++ API
* Result Shape::fill(FillRule r)
-> Result Shape::fillRule(FillRule r)
issue: https://github.com/thorvg/thorvg/issues/3116
- introduced a blending factor to control the mix between the original color and the tritone effect.
- improved Lottie compliance with this enhancement.
- implemented the spec by all engines
CAPI:
* Tvg_Result tvg_scene_push_effect_tritone(Tvg_Paint* scene, int shadow_r, int shadow_g, int shadow_b, int midtone_r, int midtone_g, int midtone_b, int highlight_r, int highlight_g, int highlight_b);
-> TVG_API Tvg_Result tvg_scene_push_effect_tritone(Tvg_Paint* scene, int shadow_r, int shadow_g, int shadow_b, int midtone_r, int midtone_g, int midtone_b, int highlight_r, int highlight_g, int highlight_b, int blend);
- corrected the reversed black/white intensity multiplication.
- made a minor adjustment to the luma equation.
- updated and aligned the API documentation accordingly.
+ Tvg_Result tvg_scene_reset_effects(Tvg_Paint* scene)
+ Tvg_Result tvg_scene_push_effect_gaussian_blur(Tvg_Paint* scene, double sigma, int direction, int border, int quality)
+ Tvg_Result tvg_scene_push_effect_drop_shadow(Tvg_Paint* scene, int r, int g, int b, int a, double angle, double distance, double sigma, int quality)
+ Tvg_Result tvg_scene_push_effect_fill(Tvg_Paint* scene, int r, int g, int b, int a)
+ Tvg_Result tvg_scene_push_effect_tint(Tvg_Paint* scene, int black_r, int black_g, int black_b, int white_r, int white_g, int white_b, double intensity)
+ Tvg_Result tvg_scene_push_effect_tritone(Tvg_Paint* scene, int shadow_r, int shadow_g, int shadow_b, int midtone_r, int midtone_g, int midtone_b, int highlight_r, int highlight_g, int highlight_b)
issue: https://github.com/thorvg/thorvg/issues/3580
- clear resources on the main thread to safely remove resources associated with dirty regions.
- skip redundant condition checks for unsafe disabled add calls.