Matthias Clasen
e293f10fa1
Add gsk_curve_get_curvature
...
This will be used in the stroker.
2020-12-26 23:56:26 -05:00
Matthias Clasen
3a4c3c3d8c
Add gsk_curve_get_normal
...
Its easy but thats no reason not to have this api.
2020-12-26 23:56:26 -05:00
Matthias Clasen
944735071e
Add a test for gsk_curve_offset
...
The stroker relies on offsetting.
This only tests a few very simple cases.
2020-12-26 23:56:26 -05:00
Matthias Clasen
91356de96a
Add a test for gsk_curve_reverse
...
The stroker relies on this working.
2020-12-26 23:56:26 -05:00
Matthias Clasen
3f29c50800
Add a test for tangents of degenerate curves
...
The stroker relies on these to work.
2020-12-26 23:56:26 -05:00
Matthias Clasen
59b1f9e7b1
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.
2020-12-26 23:56:26 -05:00
Matthias Clasen
dd3cf83a35
Add gsk_curve_reverse
...
This will be used in stroking.
2020-12-26 23:56:26 -05:00
Matthias Clasen
7f8a9e5543
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.
2020-12-26 23:56:26 -05:00
Matthias Clasen
8523c6cb2d
Add conic decomposition tests
...
We don't have good error bounds here, unfortunately.
2020-12-26 23:56:26 -05:00
Matthias Clasen
49b25424c5
path: support conic->curve in foreach
2020-12-26 23:56:26 -05:00
Matthias Clasen
db2046cb67
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.
2020-12-26 23:56:26 -05:00
Matthias Clasen
61264165ff
Add a performance test for curve eval
...
All curve types are equally fast here.
2020-12-26 23:56:26 -05:00
Matthias Clasen
7b3d283fc0
Add a performance test for curve intersection
...
This shows how much more expensive curve
intersections are.
2020-12-26 23:56:26 -05:00
Matthias Clasen
44ffed0283
Add curve split tests
2020-12-26 23:56:26 -05:00
Matthias Clasen
e91ec1f26f
Add another intersection testcase
...
This tests horizontal line/conic intersection,
which failed before the fix in the previous commit.
2020-12-26 23:56:26 -05:00
Matthias Clasen
eace55daa6
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.
2020-12-26 23:56:26 -05:00
Matthias Clasen
097e58558b
Add curve intersection tests
...
These tests check that gsk_curve_intersect finds
the intersections we want.
2020-12-26 23:56:26 -05:00
Matthias Clasen
f0acb0f073
Add gsk_curve_intersect
...
Add a way to find the intersections of two curves.
This will be used in stroking.
2020-12-26 23:56:25 -05:00
Matthias Clasen
b779ba19ca
Add gsk_curve_get_bounds
...
Add getters for bounding boxes of curves.
2020-12-26 23:56:25 -05:00
Matthias Clasen
aa0f1ce956
Only test conic weights between 1/20 and 20
...
The rest just give us no end of numeric trouble.
2020-12-26 23:56:25 -05:00
Benjamin Otte
e9d01c1a63
Ottie: Add ottie-editor
2020-12-27 01:12:11 +01:00
Benjamin Otte
e235392894
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.
2020-12-27 01:12:11 +01:00
Benjamin Otte
73904f3034
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
2020-12-27 01:12:11 +01:00
Benjamin Otte
c2ed71af7a
Ottie: Add
2020-12-27 01:12:11 +01:00
Benjamin Otte
aa2f6345c8
path: Add gsk_path_builder_add_ellipse()
2020-12-27 00:31:18 +01:00
Benjamin Otte
cef1bc9098
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.
2020-12-27 00:31:18 +01:00
Benjamin Otte
828ccc51d9
path: Add gsk_path_measure_is_closed ()
2020-12-27 00:31:18 +01:00
Benjamin Otte
8397d10c20
path: Add gsk_path_measure_restrict_to_contour()
2020-12-27 00:31:18 +01:00
Matthias Clasen
78d06e58d0
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.
2020-12-27 00:31:18 +01:00
Benjamin Otte
a5e13cc96b
xxx path)_fill
2020-12-27 00:31:18 +01:00
Matthias Clasen
776dc54c8a
Add gsk_path_get_stroke_bounds
...
A relatively cheap way to get bounds for the area
that would be affected by stroking a path.
2020-12-27 00:31:18 +01:00
Benjamin Otte
ee6879fba8
testsuite: Add tests for the dasher
2020-12-27 00:31:18 +01:00
Benjamin Otte
14f9395476
path: Add a foreach function that dashes a path
2020-12-27 00:31:18 +01:00
Benjamin Otte
1349cf2454
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.
2020-12-27 00:31:18 +01:00
Benjamin Otte
d47ebd388c
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.
2020-12-27 00:31:18 +01:00
Matthias Clasen
61214221b3
testsuite Add curve tangent tests
2020-12-27 00:31:18 +01:00
Benjamin Otte
7eb4ed8f86
testsuite: Add a test for the conic that got us segment()
2020-12-27 00:31:18 +01:00
Benjamin Otte
92b472fec1
path: Add gsk_curve_segment()
...
Using split() twice with scaled t values does not work with conics.
2020-12-27 00:31:18 +01:00
Benjamin Otte
7a6b008479
testsuite: Add a test for gsk_curve_decompose()
2020-12-27 00:31:18 +01:00
Benjamin Otte
d8c26172a5
testuite: Add tests for gsk_curve_get_tangent()
2020-12-27 00:31:18 +01:00
Matthias Clasen
da835321a5
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.
2020-12-27 00:31:18 +01:00
Benjamin Otte
30635d1cac
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.
2020-12-27 00:31:18 +01:00
Matthias Clasen
a60b72ba58
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.
2020-12-27 00:31:18 +01:00
Benjamin Otte
36347892d8
testsuite: Add conics to the random paths
2020-12-27 00:31:18 +01:00
Benjamin Otte
924f0bc2c5
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.
2020-12-27 00:31:18 +01:00
Benjamin Otte
23c5318de1
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.
2020-12-27 00:31:18 +01:00
Benjamin Otte
678405bd22
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.
2020-12-27 00:31:18 +01:00
Benjamin Otte
946b76881b
WIP: pathbuilder: Add gsk_path_builder_add_rounded_rect()
...
It works, but does not use a custom contour yet.
2020-12-27 00:31:18 +01:00
Benjamin Otte
061683344f
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.
2020-12-27 00:31:18 +01:00
Benjamin Otte
af9a85616d
path: Rename to gtk_path_builder_add_segment()
...
It's about bulding paths, not about measuring them.
2020-12-27 00:31:18 +01:00