Commit graph

13 commits

Author SHA1 Message Date
Timothy Flynn
93712b24bf Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
Andreas Kling
13d7c09125 Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
Matthew Olsson
236eeb6fb1 LibGfx: Add ability to get a bounding box from a Path 2020-10-10 23:28:41 +02:00
Matthew Olsson
335916d8db LibGfx: Templatize Point, Size, and Rect 2020-07-27 01:06:26 +02:00
Matthew Olsson
943e4f8bf1 LibWeb: Abstract common operations of graphical SVG elements 2020-07-26 14:53:43 +02:00
Matthew Olsson
1cffde7635 LibGfx: Add elliptical curves to Path 2020-07-26 14:53:43 +02:00
AnotherTest
6f15f23a40 LibGfx: Add Path::close_all_subpaths()
Unlike Path::close() which closes only the last subpath (if possible),
this closure mechanism closes _all_ available subpaths.
2020-05-09 23:25:39 +02:00
AnotherTest
88738aefa3 LibGfx: Revert #2154 and properly handle simple polygons
The existing scanline method works just fine, and only needs the points
to be available as floats.
This commit reverts the complex polygon mitigation, and instead fixes
the rasterization process to avoid generating complex polygons because
of precision issues.
2020-05-08 19:39:38 +02:00
AnotherTest
677568e3d4 LibGfx: Handle filling complex shapes better
This allows the painter to render filled complex shapes better, by
constructing a path graph for (interesting) intersecting lines and
omitting lines from the containing segments if they are detected
to take no part in defining the edges of a shape.

This approach would still fail if there are multiple logical shapes
that are confined to the collection of lines.
For instance, two polygons intersecting each other in a way that one
vertex of polygon A ends up inside polygon B.
we would detect that polygon A's edges are part of the shape
(technically correct) even though they are not a part of polygon B at
all.
2020-05-08 12:49:15 +02:00
AnotherTest
f54b41f748 LibGfx: Implement filling paths
There are some imperfections with intersecting edges (because the main
algorithm used is scanline, and that is not geared towards drawing
complex shapes), however, it behaves mostly fine for normal use :^)
2020-05-06 14:50:29 +02:00
AnotherTest
0a55679de4 LibWeb: Add canvas.quadraticCurveTo()
Also adds a test, and removes debug spam ™️
2020-05-05 09:21:07 +02:00
AnotherTest
9f3f98d4c0 LibGfx: Add Painter::draw_quadratic_bezier_curve()
Also adds a QuadraticBezierCurveTo mode to Gfx::Path
2020-05-05 09:21:07 +02:00
Andreas Kling
60c2e41079 LibGfx: Add Gfx::Path, a basic 2D path with <canvas> semantics
This will be used to implement painting of 2D paths. This first patch
adds support for line_to(), move_to() and close().

It will try to have the same semantics as the HTML <canvas> element.

To stroke a Path, simply pass it to Painter::stroke_path().
2020-04-16 21:04:46 +02:00