Matthias Clasen
d33ed4f9ab
path: Add elliptical arcs
...
Add a new curve type for elliptical arcs
and use it for rounded rectangles and circles.
We use the 'E' command to represent elliptical
arcs in serialized paths.
2023-08-23 12:43:52 -04:00
Matthias Clasen
486674927a
Make sure stroke bounds are big enough
...
Our standard 'empty path' in gtk4-node-editor
was getting its pointy corners cut off.
2023-08-21 23:59:08 -04:00
Matthias Clasen
0c39890e0f
contour: Optimize bounds
...
Cache the bounds in the contour, and compute
the stroke bounds based on it as well.
2023-08-18 10:02:14 -04:00
Matthias Clasen
73853f1a6b
contour: Add an assertion
2023-08-16 16:18:38 -04:00
Matthias Clasen
125ea90894
Rename an internal function
...
We want the number of ops, not the number of points.
2023-08-16 15:54:46 -04:00
Matthias Clasen
45aa8e4e00
Fix GskStandardContour to have a 'good' size
...
We need the size of GskStandardContour to be
at least as aligned as graphene_point_t, or
things break in hard to debug ways.
2023-08-14 15:59:45 -04:00
Matthias Clasen
a85ab3585e
Revise gsk_path_point_get_tangent
...
Update the directions enum to allow all four
tangents to be obtained. Add an illustration
to the docs for clarity.
Update all callers.
2023-08-14 14:58:22 -04:00
Matthias Clasen
4b7e1b1233
Fix gsk_path_builder_add_segment
...
We were splitting the last segment, but did not
actually use the result of the split. Oops.
2023-08-13 09:40:19 -04:00
Matthias Clasen
b7544636d4
contour: Skip the move
...
When jumping between segments, we always
need to skip index 0, since thats the move.
This fixes the tangent checks in the
rectangle tests.
2023-08-09 15:12:58 -04:00
Matthias Clasen
6220baf230
get_closest_point: Prefer earlier points
...
Only switch to a later point if it is strictly
closer than the existing match. This fixes
start- vs endpoint confusion in the rectangle
tests.
2023-08-09 15:12:52 -04:00
Matthias Clasen
f707185248
Add gsk_path_builder_add_segment
...
With GskPathPoint, we can subset paths without
a measure object.
2023-08-09 07:01:01 -04:00
Matthias Clasen
ded30049db
path: Add gsk_path_get_start/end_point
...
These are useful to have, now that we are
relying more on GskPathPoint in our api.
2023-08-08 22:05:34 -04:00
Matthias Clasen
c35bb11c18
Simplify GskPathPoint
...
Use simple representation of just
{ contour index, segment index, t value }
2023-08-08 20:31:56 -04:00
Matthias Clasen
c37c29422a
Add gsk_path_get_stroke_bounds
...
This is a helper to compute the bounds for
stroke nodes. We keep it private for now.
2023-08-07 13:02:57 -04:00
Matthias Clasen
9b916b329a
pathpoint: Implement get_tangent fully
...
We were not taking the direction into account
at all.
2023-08-07 08:33:05 -04:00
Matthias Clasen
1b5dfcba7e
gsk: Add GskPath
...
This commit adds the basic infrastructure for paths.
The public APIs consists of GskPath, GskPathPoint and
GskPathBuilder.
GskPath is a data structure for paths that consists
of contours, which in turn might contain Bézier curves.
The Bezier data structure is inspired by Skia, with separate
arrays for points and operations. One advantage of this
arrangement is that start and end points are shared
between adjacent curves.
A GskPathPoint represents a point on a path, which can
be queried for various properties.
GskPathBuilder is an auxiliary builder object for paths.
2023-08-06 20:48:09 -04:00