mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 11:17:35 +00:00
LibGfx: Implement new antialiased filled path rasterizer
This is an implementation of the scanline edge-flag algorithm for antialiased path filling described here: https://mlab.taik.fi/~kkallio/antialiasing/EdgeFlagAA.pdf The initial implementation does not try to implement every possible optimization in favour of keeping things simple. However, it does support: - Both evenodd and nonzero fill rules - Applying paint styles/gradients - A range of samples per pixel (8, 16, 32) - Very nice antialiasing :^) This replaces the previous path filling code, that only really applied antialiasing in the x-axis. There's some very nice improvements around the web with this change, especially for small icons. Strokes are still a bit wonky, as they don't yet use this rasterizer, but I think it should be possible to convert them to do so.
This commit is contained in:
parent
e4adaa2d20
commit
48fa8f97d3
6 changed files with 536 additions and 324 deletions
|
@ -207,19 +207,6 @@ void AntiAliasingPainter::draw_line(FloatPoint actual_from, FloatPoint actual_to
|
|||
draw_anti_aliased_line<FixmeEnableHacksForBetterPathPainting::No>(actual_from, actual_to, color, thickness, style, alternate_color, line_length_mode);
|
||||
}
|
||||
|
||||
// FIXME: In the fill_paths() m_transform.translation() throws away any other transforms
|
||||
// this currently does not matter -- but may in future.
|
||||
|
||||
void AntiAliasingPainter::fill_path(Path const& path, Color color, Painter::WindingRule rule)
|
||||
{
|
||||
m_underlying_painter.antialiased_fill_path(path, color, rule, m_transform.translation());
|
||||
}
|
||||
|
||||
void AntiAliasingPainter::fill_path(Path const& path, PaintStyle const& paint_style, Painter::WindingRule rule)
|
||||
{
|
||||
m_underlying_painter.antialiased_fill_path(path, paint_style, rule, m_transform.translation());
|
||||
}
|
||||
|
||||
void AntiAliasingPainter::stroke_path(Path const& path, Color color, float thickness)
|
||||
{
|
||||
FloatPoint cursor;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue