Matthias Clasen
c816eee4d1
curve: Add more line-curve intersection tests
2022-04-06 23:47:35 -04:00
Matthias Clasen
436fe18084
curve: Add another intersection test
2022-04-06 23:47:35 -04:00
Matthias Clasen
3ba2659860
curve: Specify tolerance for intersections
...
We had 0.1 hardcoded in a bunch of places.
2022-04-06 23:47:35 -04:00
Matthias Clasen
ffc5fdb9de
Add a debug key for paths
...
Not used yet.
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
ba405bfbf1
Add a bounding box type
...
graphene_rect_t does not quite work for this purpose.
2022-04-06 23:47:35 -04:00
Matthias Clasen
4b6223e07d
curve: Handle self-intersection
2022-04-06 23:47:35 -04:00
Matthias Clasen
8637ea8fb8
curve: Small improvement
2022-04-06 23:47:35 -04:00
Matthias Clasen
ab8a32bc76
curve: Refine line-line intersection
...
For collinear line segments, return up to 2 intersections
for the endpoints of the intersection (which is also a
line segment in this case).
Tests included.
2022-04-06 23:47:35 -04:00
Matthias Clasen
6aa38e6b39
curve: Fix line-curve intersections
2022-04-06 23:47:35 -04:00
Matthias Clasen
46bef9b667
curve test: Fix the split test
...
We were misinterpreting the return value of
gsk_path_measure_get_closest_point.
2022-04-06 23:47:35 -04:00
Matthias Clasen
86862d56bd
curve: Skip a failing test
...
We don't have a good error bound for approximating
conics. Until that changes, skip this test.
2022-04-06 23:47:35 -04:00
Matthias Clasen
1e5c025a1e
curve: Add another intersection test
2022-04-06 23:47:35 -04:00
Matthias Clasen
60f87f2a7d
path: Fix a typo
2022-04-06 23:47:35 -04:00
Matthias Clasen
001903aeef
contour: Add some docs
2022-04-06 23:47:35 -04:00
Matthias Clasen
3b04f5a963
Allow showing points in curve2 test
...
This is useful for debugging intersections.
2022-04-06 23:47:35 -04:00
Matthias Clasen
de29a01682
gsk: Use stroke bounds in the stroke node
...
We can use gsk_path_get_stroke_bounds to get a
better estimate for the bounds of the stroke node.
2022-04-06 23:47:35 -04:00
Matthias Clasen
bd3b88b276
gtk-demo: Use gsk_path_builder_add_layout
...
We have an api now to hide the cairo use.
2022-04-06 23:47:35 -04:00
Matthias Clasen
e7a9030fb5
gsk: Add gsk_path_builder_add_layout
...
This api makes it easy to turn text into a path that
can be further manipulated. The implementation currently
goes via cairo.
2022-04-06 23:47:35 -04:00
Matthias Clasen
98aca9e2cd
curve2: Show osculating circles
2022-04-06 23:47:35 -04:00
Matthias Clasen
6e8b23d485
Add gsk_path_measure_get_curvature
2022-04-06 23:47:35 -04:00
Matthias Clasen
05678d44ca
Add an interactive path test
...
This one is for interactive exploring of svg paths.
You can enter an SVG path in the entry and hit Enter
to see how GSK renders it. If you click the button
in the headerbar, you can see what GTK thinks the
closest point, tangent and distance are wrt. to the
mouse position, and the bounding box of the path.
There's also stroke parameters to play with.
2022-04-06 23:47:35 -04:00
Matthias Clasen
7b4bc08254
stroke: Make gsk_stroke_to_cairo public
...
It comes in handy, and does no harm.
2022-04-06 23:47:35 -04:00
Matthias Clasen
3b81a9e529
gtk-demo: Add a curve editor demo
2022-04-06 23:47:35 -04:00
Matthias Clasen
6a0901c40e
Implement offsetting
...
Implement offsetting of paths by reusing the
infrastructure of the stroker.
2022-04-06 23:47:33 -04:00
Matthias Clasen
a7b3a0c472
Add gsk_path_offset
...
Add a function that takes a path, and offsets it
by some distance, applying line-join parameters
as needed.
This commit just adds the api, the implementation
will be in the following commit.
2022-04-06 23:47:08 -04:00
Matthias Clasen
645eddf838
stroker: Implement arcs
...
Implement arced joins as specified in SVG2.
2022-04-06 23:47:08 -04:00
Matthias Clasen
ada1cc7dc5
Add GSK_LINE_JOIN_ARCS
...
Implementation will follow.
2022-04-06 23:47:08 -04:00
Matthias Clasen
042a3a1344
Add another stroker test
...
Check that the outlines of random paths look as
expected. We currently have to exclude paths where
points get too close to each other.
2022-04-06 23:47:08 -04:00
Matthias Clasen
2542d913bc
Add basic tests for strokes
...
Add tests to check that any point on a path is
always at most half the line-width away from the
stroke path with that line-width.
2022-04-06 23:47:08 -04:00
Matthias Clasen
fc619b9783
Implement stroking
...
Implement gsk_contour_default_add_stroke, which takes a contour
and stroke parameters, and adds contours to a path builder for
the outline that would be produced by stroking the path with these
parameters.
The current implementation does not try to handle short segments
in the vicinity of sharp joins in any special way, so there can
be some artifacts in that situation.
2022-04-06 23:47:06 -04:00
Matthias Clasen
3c56f326fc
Special-case circles for strokes
...
The outline of a circle is just two circles.
2021-12-04 22:58:23 -05:00
Matthias Clasen
4c81600fc9
Special-case rects for strokes
...
In many cases, the outline of a rectangle is just
two rectangles.
2021-12-04 22:58:23 -05:00
Matthias Clasen
68661b7291
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.
2021-12-04 22:58:23 -05: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
759bf152d3
Add a test for gsk_curve_offset
...
The stroker relies on offsetting.
This only tests a few very simple cases.
2021-12-04 22:58:23 -05:00
Matthias Clasen
021bca4629
Add a test for gsk_curve_reverse
...
The stroker relies on this working.
2021-12-04 22:58:23 -05:00
Matthias Clasen
f91995db06
Add a test for tangents of degenerate curves
...
The stroker relies on these to work.
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
afd398112b
Add conic decomposition tests
...
We don't have good error bounds here, unfortunately.
2021-12-04 22:58:23 -05:00
Matthias Clasen
98591b383b
path: support conic->curve in foreach
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
c80d5f89d8
Add a performance test for curve eval
...
All curve types are equally fast here.
2021-12-04 22:58:23 -05:00
Matthias Clasen
8dd4f022c1
Add a performance test for curve intersection
...
This shows how much more expensive curve
intersections are.
2021-12-04 22:58:23 -05:00
Matthias Clasen
ee42889790
Add curve split tests
2021-12-04 22:58:23 -05:00