- 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>
- 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.
- clear resources on the main thread to safely remove resources associated with dirty regions.
- skip redundant condition checks for unsafe disabled add calls.
added new functionality for bezier curves:
1. generate bezier curve as an arc
2. estimate the number of points for optimal tessellation
3. check that bezier curve is close to a straight line
This functionality is useful for gl/wg renderers
A potential memory violation issue was present when accessing image
buffers, especially when the image was offset outside the visible
screen region.
This issue was accidentally discovered while testing particle
effects. It is now properly handled with cleaner and safer code.
This change ensures at the api level that if the focal
point lies outside the end circle, it is projected onto
the edge of the end circle.
Additionally, if the start circle does not fully fit
inside the end circle (after possible repositioning), its
radius is reduced accordingly.
The modification aligns with the SVG 1.1 standard (for fr = 0).
Cases with fr > 0 are not covered by the SVG 1.1, and edge
cases have been handled here to avoid numerical issues.
Note:
This update replaces previous behavior where gl handled
the SVG 2.0 standard.
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.
This adds support for a static scene mode,
allowing a scene to be treated as a static image.
In this mode, partial rendering for the inner
drawable components is skipped. This is especially
useful for scenes designed to be fully updated as a whole,
such as those used in fully dynamic Lottie contents.
issue: https://github.com/thorvg/thorvg/issues/1747
Partial Rendering refers to a rendering technique where
only a portion of the scene or screen is updated, rather
than redrawing the entire output. It is commonly used as
a performance optimization strategy, focusing on redrawing
only the regions that have changed, often called dirty regions.
This introduces RenderDirtyRegion, which assists
in collecting a compact dirty region from render tasks.
To efficient data-processing, this divide the screen region
with a designated size of partition and handles the partitl rendering
computation with a divide-conquer metholodgy.
Each backend can utilize this class to support efficient partial rendering.
This is implemented using a Line Sweep and Subdivision Merging O(NlogN).
The basic per-frame workflow is as follows:
0. RenderDirtyRegion::init() //set the screen size to properly partition the regions
1. RenderDirtyRegion::prepare() //Call this in Renderer::preRender().
2. RenderDirtyRegion::add() //Add all dirty paints for the frame before rendering.
3. RenderDirtyRegion::commit() //Generate the partial rendering region list before rendering.
4. RenderDirtyRegion::partition() //Get a certian partition
5. RenderDirtyRegion::get() //Retrieve the current dirty region list of a partition and use it when drawing paints.
6. RenderDirtyRegion::clear() //Reset the state.
RenderMethod introduced for 2 utilities for paritial renderings
1. RenderMethod::damage() //add a force dirty region, especially useful for scene effects
2. RenderMethod::partial() //toggle the partial rendering feature
issue: https://github.com/thorvg/thorvg/issues/1747
Implemented support for clipping shapes and images using a render region
bounding box at render time. This allows partial drawing of content,
laying the groundwork for upcoming partial rendering functionality.
for fast access of the drawing region from the linear rle data,
we introduced the binary search for begin/end of rle instead of
additional y index buffer.
There is a reason for not using a y-index buffer:
the shapes in the RLE are not single, continuous shapes
but multiple shapes scattered across the space.
which means that we need a double-associated data structure
per shapes for y indexing, and this data preparation wouldn't be
cheaper enough than realtime binary search especially animated data.
issue: https://github.com/thorvg/thorvg/issues/1747