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
Matthias Clasen
bd0f92fa8b
Add another intersection testcase
...
This tests horizontal line/conic intersection,
which failed before the fix in the previous commit.
2021-12-04 22:58:23 -05:00
Matthias Clasen
c438527e49
xxx: work around bounding box problems
...
graphene_rect_intersect returns FALSE when you
intersect the bounding boxes of axis-aligned
lines, so we never find intersections with those.
Make things better by making the bounding boxes worse.
2021-12-04 22:58:23 -05:00
Matthias Clasen
dad4e1da22
Add curve intersection tests
...
These tests check that gsk_curve_intersect finds
the intersections we want.
2021-12-04 22:58:23 -05:00
Matthias Clasen
52394b1520
Add gsk_curve_intersect
...
Add a way to find the intersections of two curves.
This will be used in stroking.
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
Matthias Clasen
6d04869c85
Only test conic weights between 1/20 and 20
...
The rest just give us no end of numeric trouble.
2021-12-04 22:58:23 -05:00
Matthias Clasen
5781a8c66a
xxx: Link ottie tests against libottie
2021-12-04 22:58:23 -05:00
Matthias Clasen
65813c3f19
xxx: Link ottie tools against libottie
2021-12-04 22:58:23 -05:00
Benjamin Otte
33d5acf1db
Ottie: Add ottie-editor
2021-12-04 22:58:23 -05:00
Benjamin Otte
d0d62ee0d6
ottie: Add a snapshot testsuite test
...
The test takes a lottie file and a timestamp in seconds and produces a
rendernode at that timestamp.
It then serializes that node and compares it via diff(1) with a file
containing the expected output.
This is a lot stricter than it needs to be (because different node files
can generate the same output and updates to the rendering pipeline can
break everything) but I chose this method on purpose because it does a
good job at guarding against accidental changes in other parts of the
code.
It's also better than comparing image output because it avoids
antialiasing artifacts when using curves and things like that.
2021-12-04 22:58:23 -05:00
Benjamin Otte
e359e0b146
ottie: Add a command-line tool
...
Supports:
* Taking a screenie:
ottie image file.lottie image.png
* Recording a rendernode:
ottie node file.lottie render.node
* Encoding an image:
ottie video file.lottie video.webm
2021-12-04 22:58:23 -05:00
Benjamin Otte
4a633e4476
Ottie: Add
2021-12-04 22:58:23 -05:00
Benjamin Otte
78c2fca48e
path: Add gsk_path_builder_add_ellipse()
2021-12-04 22:58:23 -05:00
Benjamin Otte
9b93dcbbd8
path: Change semantics of gtk_path_builder_add_segment()
...
Allow start >= end to mean that the path continues at the beginning
after reaching the end until it reaches the point at @end.
2021-12-04 22:58:23 -05:00
Benjamin Otte
5acdc8358e
path: Add gsk_path_measure_is_closed ()
2021-12-04 22:58:23 -05:00
Benjamin Otte
9ecd508b86
path: Add gsk_path_measure_restrict_to_contour()
2021-12-04 22:58:23 -05:00
Matthias Clasen
452eb951d7
Add gsk_path_measure_get_{path,tolerance}
...
These are just nice apis to have and avoid having to carry
these around as extra arguments in many places.
This was showing up as inconvenience in writing tests
for the measure apis.
2021-12-04 22:58:23 -05:00
Benjamin Otte
a6e665c6f3
gtk-demo: Use dashes in path-fill demo
2021-12-04 22:58:23 -05:00
Matthias Clasen
19f2eddf46
Add gsk_path_get_stroke_bounds
...
A relatively cheap way to get bounds for the area
that would be affected by stroking a path.
2021-12-04 22:58:23 -05:00
Benjamin Otte
a79d427a4b
testsuite: Add tests for the dasher
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
75b96fa7cf
path: Deal with non-uniformness of progress parameter
...
The progress is non-uniform, so simple translation of progress doesn't work.
So check if larger and smaller values inch closer towards minimal distance.
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
Matthias Clasen
6c9206d46a
testsuite Add curve tangent tests
2021-12-04 22:58:23 -05:00
Benjamin Otte
918b07967c
testsuite: Add a test for the conic that got us segment()
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
a1f9a45f17
testsuite: Add a test for gsk_curve_decompose()
2021-12-04 22:58:23 -05:00
Benjamin Otte
57cf7e6fc2
testuite: Add tests for gsk_curve_get_tangent()
2021-12-04 22:58:23 -05:00
Matthias Clasen
5c817aef62
testuite: Add tests for gsk_curve_get_point()
...
Add a few tests for gsk_curve_get_point().
Since GskCurve is not public api, we add gskcurve.c
as source to the test binary.
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
a21b3c7337
testsuite: Add conics to the random paths
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
Benjamin Otte
faf0c8d1f9
path: Introduce gskpathop
...
A gskpathop is a pointer to a graphene_point_t* with the low bits used
to encode the GskPathOperation. It's an easy way to introduce API for
operations.
So far it's just used to replace GskStandardOperation.
2021-12-04 22:43:32 -05:00
Benjamin Otte
2f91089b71
WIP: css: Replace border rendering code with GskPath
...
The weight is wrong still, I need to compute the correct one to get real
45deg circle corners and not just roughly correct ones.
2021-12-04 22:43:32 -05:00
Benjamin Otte
b0a1b4f672
WIP: pathbuilder: Add gsk_path_builder_add_rounded_rect()
...
It works, but does not use a custom contour yet.
2021-12-04 22:43:32 -05:00
Benjamin Otte
599baee1c4
path: Add conic curves
...
So far this just adds the API, if you use it, you'll get lots of
g_warnings().
This will be fixed in future commits.
2021-12-04 22:43:32 -05:00
Benjamin Otte
51d645168f
path: Rename to gtk_path_builder_add_segment()
...
It's about bulding paths, not about measuring them.
2021-12-04 22:43:32 -05:00
Benjamin Otte
5991f4b6c9
path: Split contours into their own file
...
I'm not sure I want to keep all contours in one file, but for now that's
how it is.
2021-12-04 22:43:32 -05:00
Benjamin Otte
a41b9ebec7
path: Make all private contour APIs take a GskContour
...
... instead of a path, index tuple.
2021-12-04 22:43:32 -05:00
Matthias Clasen
50098ba75b
Add a nodeparser tests for fill and stroke nodes
2021-12-04 22:43:32 -05:00
Benjamin Otte
c804a3863e
stroke: Add support for dashes
...
... and hook it up in the node parser and for Cairo rendering.
2021-12-04 22:43:32 -05:00
Matthias Clasen
a94a8857cc
gsk: Implement parsing fill and stroke nodes
...
Make serialization and deserialization work for stroke and
fill nodes.
2021-12-04 22:43:31 -05:00