Deep shader refactoring for the following purposes:
* used pre-calculated gradient texture instead of per-pixel gradient map computation
* used HW wrap samples for fill spread setting
* unified gradient shader types
* used single shader module for composition instead of signle module per composition type
* used single shader module for blending for each of fill type (solid, gradient, image) instaed of signle module per blend type
* much easier add new composition and blend equations
* get rided std::string uasge
* shaders code is more readable
For rounded rectangles the roundness value should
be determined using to the formula:
r = min(r, max(size.x, size.y)/2)
rather than the previous method:
r = min(size.x/2, size.y/2, r)
* bind groups creation in real time removed - performance boost
* blend and composition shaders decomposed - performance boost
* shader modules and pipeline layouts generalized - less memory usage
* shared single stencil buffer used - less memory usage
* bind groups usage simplified
* general context API simplified and generalized
* all rendering logic moved into new composition class
* ready for hardware MSAA (in next steps)
* ready for direct mask applience (in next steps)
For Bezier curves, we typically use 't' as a parameter
within the 0-1 range, while 'at' is used for the parameter
scaled by the curve's length. In one of the functions,
an incorrect name was used, which could be confusing.
No logical changes.
The epsilon value currently used for the precision
of Beziers calculations is sufficient for comparing
curve lengths. However, for the parameter t, which
ranges from 0 to 1, an accuracy of 1% can introduce
errors.
The solution is to increase the precision for the t
parameter while keeping the rest of the calculations
at the previously used epsilon value.
@Issue: https://github.com/thorvg/thorvg/issues/2619
In case of modern systems, size is not a big problem,
so we turn the optimization option to default
for better performance.
FPS: ~20% enhanced
Size: ~25% increased
Note that this doesn't affect to the web player.
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.
This utility method allows access to a specific paint instance
by its unique identifier.
Experimental API:
- const Paint* Picture::paint(uint32_t id)
- const Tvg_Paint* tvg_picture_get_paint(Tvg_Paint* paint, uint32_t id)
This function computes a unique identifier value based on the provided string.
You can use this to assign a unique ID to the Paint object.
Experimental APIs:
- uint32_t Accessorr::id(const char* name)
- uint32_t tvg_accessor_id(const char* name)
Lighten is applied, where multiple masks intersect,
the highest transparency value is used.
Darken is applied, where multiple masks intersect,
the lowest transparency value is used.
Experimental API:
- CompositeMethod::LightenMask
- CompositeMethod::DarkenMask
issue: https://github.com/thorvg/thorvg/issues/2608
For a linear gradient defined by identical start and end
points, and for a radial gradient with a radius of 0,
the rendered shape should have the color of the last
specified color stop.
The documentation has been updated accordingly.
@Issue: https://github.com/thorvg/thorvg/issues/2582
The logic of interpretation of trimming start and
end values has been moved to the sw_engine,
so the values provided by the user are not modified.
No logical changes in the interpretation alg.
For pairs of trim's start/end values where the distance
between begin and end is >= 1, the entire stroke should
be drawn, but instead, nothing or only part is drawn. Fixed.
Stroke trim docs fixed.
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