Matthias Clasen
aa8ba37a0f
curve: Cosmetics
2022-04-06 23:47:35 -04:00
Matthias Clasen
e88cf34642
curve: Add gsk_curve_print for debugging
2022-04-06 23:47:35 -04:00
Matthias Clasen
5eb79b3b01
curve: Move some curve apis to gskcurve.c
...
Some of this will be reused elsewhere, so move
it out of gskpathstroke.c.
2022-04-06 23:47:35 -04:00
Matthias Clasen
cf793f94ac
curve: Use GskBoundingBox
2022-04-06 23:47:35 -04:00
Matthias Clasen
8637ea8fb8
curve: Small improvement
2022-04-06 23:47:35 -04:00
Matthias Clasen
b6a2a8b0fc
Add gsk_curve_get_curvature
...
This will be used in the stroker.
2021-12-04 22:58:23 -05:00
Matthias Clasen
d08802a2c3
Add gsk_curve_get_normal
...
Its easy but thats no reason not to have this api.
2021-12-04 22:58:23 -05:00
Matthias Clasen
ad145e201b
curve: Handle degenerate cases
...
Nothing prevents control points from being identical,
and if that happens, some of our constructions involving
tangents and normals break down. Handle these cases in
get_{start,end}_tangent and offset, for the case of
cubics.
2021-12-04 22:58:23 -05:00
Matthias Clasen
0bef169b32
Add gsk_curve_reverse
...
This will be used in stroking.
2021-12-04 22:58:23 -05:00
Matthias Clasen
5f40db5043
Add gsk_curve_offset
...
This method creates an offset curve from an existing
curve by just moving the control points laterally.
This will be used in stroking.
2021-12-04 22:58:23 -05:00
Matthias Clasen
319e75c73f
Add gsk_curve_decompose_curve
...
This is mainly useful for decomposing a conic into
cubics. The criterion here for terminating the
subdivision is very improvised.
2021-12-04 22:58:23 -05:00
Matthias Clasen
3efd6c9a12
Add gsk_curve_get_bounds
...
Add getters for bounding boxes of curves.
2021-12-04 22:58:23 -05:00
Benjamin Otte
f9d794d315
path: Add a foreach function that dashes a path
2021-12-04 22:58:23 -05:00
Benjamin Otte
a5763a3de1
path: Always decompose conics into at least 2 segments
...
Conics are evil in that their parameter skews towards the center, and if
it's a very flat conic (weight almost equal to 0), then we'd approximate
it with a single segment and not subdivide, which would cause the
parameter to be wildly off around 0.25 or 0.75.
And that would cause offset calculations to fail.
2021-12-04 22:58:23 -05:00
Benjamin Otte
2f3aae002d
path: Add gsk_curve_segment()
...
Using split() twice with scaled t values does not work with conics.
2021-12-04 22:58:23 -05:00
Benjamin Otte
b7c83ce45c
curve: Split eval() into get_point() and get_tangent()
...
That's more in line with the get_start/end_point/tangent() functions.
Plus, those calls are independent and we usually want one or the other.
2021-12-04 22:58:23 -05:00
Matthias Clasen
8b13ea22be
Add gsk_curve_get_{start,end}_tangent
...
Add a way to get the tangents at the start and end of the curve.
This will be used in stroking.
2021-12-04 22:58:23 -05:00
Benjamin Otte
eb04db32e0
path: Add GskCurve
...
GskCurve is an abstraction for path operations. It's essentially a
collection of vfuncs per GskPathOperation.
GskStandardContour has been ported to use it where appropriate.
2021-12-04 22:58:23 -05:00