1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 04:37:44 +00:00

LibGfx: Add Path::stroke_to_fill(thickness)

This function generates a new path, which can be filled to rasterize
a stroke of the original path (at whatever thickness you like). It
does this by convolving a circular pen with the path, so right now
only supports round line caps.

Since filled paths now have good antialiasing, doing this results in
good stroked paths for "free". It also (for free) fixes stroked lines
with an opacity < 1, nice line joins, and is possible to fill with a
paint style (e.g. a gradient or an image).

Algorithm from: https://keithp.com/~keithp/talks/cairo2003.pdf
This commit is contained in:
MacDue 2023-06-05 21:34:23 +01:00 committed by Jelle Raaijmakers
parent c50ce2030d
commit 95a07bd4e5
2 changed files with 162 additions and 0 deletions

View file

@ -248,6 +248,8 @@ public:
DeprecatedString to_deprecated_string() const;
Path stroke_to_fill(float thickness) const;
private:
void invalidate_split_lines()
{