Matthias Clasen
7bc69c852f
API: Add gsk_path_stroke
...
Add the plumbing that will let us do special-case stroking
for rectangles, circles and other special contours.
There is no implementation yet.
2023-07-02 01:26:03 -04:00
Matthias Clasen
934bc7ea4f
API: Add GSK_LINE_JOIN_ARCS
...
This is from SVG 2.
2023-07-02 01:26:03 -04:00
Matthias Clasen
f098e590f8
API: Add gsk_path_measure_get_curvature
...
We have this information available, and it can
be used for some neat demos, so add an api for it.
2023-07-02 01:26:03 -04:00
Matthias Clasen
1624ba6aca
Add a test for gsk_curve_offset
...
The stroker relies on offsetting.
This only tests a few very simple cases.
2023-07-02 01:26:03 -04:00
Matthias Clasen
639380003f
curve: 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.
2023-07-02 01:26:03 -04:00
Matthias Clasen
7c3d570ee9
Add a test for tangents of degenerate curves
...
The stroker relies on these to work.
2023-07-02 01:25:32 -04:00
Matthias Clasen
75db137ba9
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.
2023-07-02 01:25:32 -04:00
Matthias Clasen
3fa741e8a7
Add a performance test for curve eval
...
All curve types are equally fast here.
2023-07-02 01:25:32 -04:00
Matthias Clasen
8b9a153238
Add a performance test for curve intersection
...
This shows how much more expensive curve
intersections are.
2023-07-02 01:25:32 -04:00
Matthias Clasen
2365380075
Add curve split tests
2023-07-02 01:25:32 -04:00
Matthias Clasen
bdd8c87f9c
Add special-case curve tests
2023-07-02 01:25:32 -04:00
Matthias Clasen
af6ae3fd74
Add curve match tests
...
Add tests that check that the curve api agrees on
values for a quadratic and its equivalent cubic
and conic curves.
2023-07-02 01:25:32 -04:00
Matthias Clasen
caf0c222d9
Add curve intersection and bounds tests
...
These tests check that gsk_curve_intersect finds
the intersections we want and get_bounds returns
propert bounding boxes.
2023-07-02 01:25:32 -04:00
Matthias Clasen
c33f74ff04
curve: Add gsk_curve_intersect
...
Add a way to find the intersections of two curves.
We can handle some curve-line intersections directly,
the general case is handled via bisecting.
This will be used in stroking and path ops.
2023-07-02 01:25:32 -04:00
Matthias Clasen
3dcb59b5e6
curve: Add gsk_curve_print
...
Useful for debugging.
2023-07-02 01:25:32 -04:00
Matthias Clasen
759432498c
curve: Add gsk_curve_get_curvature
...
This will be used in the stroker.
2023-07-02 01:25:32 -04:00
Matthias Clasen
a88128cf6b
curve: Add gsk_curve_get_normal
...
Its easy but thats no reason not to have this api.
2023-07-02 01:25:32 -04:00
Matthias Clasen
fc7226b784
curve: Add gsk_curve_get_bounds
...
Add getters for bounding boxes of curves.
Bounding boxes are needed to implement intersection
via bisecting.
2023-07-02 01:25:32 -04:00
Matthias Clasen
db430ccc4e
curve: Add some curve utilities
...
Internal apis:
- gsk_curve_get_curvature_points
- gsk_curve_get_cusps
These apis will be used in the stroker
and in path ops.
2023-07-02 01:25:32 -04:00
Matthias Clasen
e77dfa4263
Add a bounding box type
...
graphene_rect_t does not quite work for this purpose.
2023-07-02 01:25:32 -04:00
Matthias Clasen
63168337eb
tools: Add gtk4-path-tool
...
This comes in handy for testing, among other things.
For now, this supports decomposing, transforming,
reversing, restricting, rendering and preview.
2023-07-02 01:23:41 -04:00
Matthias Clasen
0dec52dcbc
Add decomposition tests
...
We don't have good error bounds for conics,
unfortunately. But we can test that we decompose
into the right curves.
2023-07-02 01:23:41 -04:00
Matthias Clasen
eb404e1c93
path: Allow limiting curve types in foreach
...
This is useful if your rendering system can't
handle certain kinds of curves, such as conics.
2023-07-02 01:23:41 -04:00
Matthias Clasen
7cb56f549f
curve: 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.
But it also allows for other use cases, such as
raising the degree of quadratics to cubics.
2023-07-02 01:23:41 -04:00
Matthias Clasen
e41783e4ee
API: Add gsk_path_transform
...
This is an obvious operation to want for paths.
2023-07-02 01:23:41 -04:00
Matthias Clasen
7760ee9115
API: Add gsk_path_reverse
...
This is a natural operation, and useful for debugging things.
2023-07-02 01:23:41 -04:00
Matthias Clasen
0c81f25e27
Add a test for gsk_curve_reverse
...
The stroker relies on this working.
2023-07-02 01:23:41 -04:00
Matthias Clasen
85081bdc66
curve: Add gsk_curve_reverse
...
This is a useful operation that will be used,
among other places, in stroking.
2023-07-02 01:23:41 -04:00
Matthias Clasen
8f3aad1edf
Update affected tests
...
We preserve quadratics in the SVG path roundtrip
tests now.
2023-07-02 01:23:19 -04:00
Matthias Clasen
49eb20c024
Add quadratic curves
...
API-wise, this adds
- GSK_PATH_QUAD
- GSK_PATH_FOREACH_ALLOW_QUAD
- gsk_path_builder_quad_to and _rel_quad_to
2023-07-02 01:23:19 -04:00
Matthias Clasen
ec117d548e
Rename curve to cubic
...
This is to make room in the api for quadratic curves.
In detail:
- Replace GSK_PATH_CURVE by _CUBIC
- Rename gsk_path_builder_curve_to to _cubic_to
- Replace GSK_PATH_FOREACH_ALLOW_CURVE with _CUBIC
- Replace GskCurveCurve with GskCubicCurve
2023-07-02 01:23:19 -04:00
Matthias Clasen
bbdc30ffee
gsk: Use stroke bounds for the stroke node
...
We have the right api to use.
2023-07-02 01:00:41 -04:00
Matthias Clasen
001aaf44d2
Private header cleanup
...
These includes break using the private headers
in internal tests, so fix them up to work for
that case.
2023-07-01 21:47:41 -04:00
Matthias Clasen
802d539b05
path_text demo: Fixup
...
We don't want any filtering by curve type here.
2023-07-01 18:58:42 -04:00
Matthias Clasen
001ac59a6b
pathmeasure: Drop some unused apis
...
We are not convinced that it is a good idea
to expose the concept of contours, and these
apis are entirely unused, so drop them.
2023-07-01 16:04:29 -04:00
Matthias Clasen
1a85ba7451
curve: Explicitly initialize memory
...
Unitialized memory warnings aren't fun.
2023-06-30 07:48:31 -04:00
Matthias Clasen
750088f01c
Be less demanding in the get_point test
...
When looking for discontinuities, there
is no need to check for epsilons. As we
move close to the end of one contour / the
beginning of the next, the path length distance
between the two points will get arbitrarily
small, so we can just check that the distance
between the points is more than twice that.
This makes spurious failures of the /path/get_point
test go away.
2023-06-30 07:47:58 -04:00
Matthias Clasen
db2a167ea2
Plug a memory leak in the path tests
2023-06-30 07:47:52 -04:00
Matthias Clasen
cdca291962
Only test conic weights between 1/20 and 20
...
The rest just give us no end of numeric trouble.
2023-06-30 07:47:44 -04:00
Matthias Clasen
ba5f7d77f8
pathbuilder: Avoid trouble with sincos
...
The Windows builds seem to have problem with
this handling of sincos(), so do it the same
way we do it elsewere, by defining _sincos().
2023-06-30 07:47:44 -04:00
Matthias Clasen
17726a4330
Make gsk_stroke_to_cairo public
...
It comes in handy, and does no harm.
2023-06-30 07:47:44 -04:00
Matthias Clasen
b47cbd74c0
Add comment for conic curves
2023-06-30 07:47:04 -04:00
Matthias Clasen
84e8f3db83
Docs: Fix a typo
2023-06-30 07:47:04 -04:00
Matthias Clasen
ae22094fb7
Documentation fixes
...
gi-docgen can't handle an indent > 2 in continuation lines.
2023-06-30 07:45:12 -04:00
Matthias Clasen
c3061916bc
curve: Match skia more precisely
...
Close reading of sources revealed that we
were not actually using the same conditions
as skia here, causing our measurements to
come out slightly different.
With this change, we are in almost perfect
agreement with skia.
2023-06-30 07:44:21 -04:00
Matthias Clasen
87346d3151
curve: Cosmetic
2023-06-30 07:44:13 -04:00
Matthias Clasen
0f38573008
tests: Less degenerate, please
...
We were inadvertendly using 95% degenerate paths,
instead of 5%. Oops.
2023-06-30 07:42:52 -04:00
Matthias Clasen
555aa8e409
contour: Reimplement get_winding
...
Follow the usual implementation more closely,
and drop reporting a separate 'on_edge' bit.
This was wrong in some cases, and we don't
need it. See the testcase in this commit
for a case where 'on_edge' was wrongly
deciding that a point is inside.
2023-06-30 07:42:52 -04:00
Matthias Clasen
efd2f41c54
Add a test for a bad case
...
This is narrowing down what goes wrong in the
segment test: We have an unevenly parameterized
cubic. This case gave me a lot of trouble.
2023-06-30 07:42:52 -04:00
Matthias Clasen
670058eec7
tests: Handle internal tests better
...
We have a better way of testing private API now,
by linking statically.
2023-06-30 07:42:52 -04:00