Matthias Clasen
192bf4bbbe
path: Implement gsk_path_parse
...
Implement the SVG path syntax to read back the strings
that we generate when serializing paths. The tests for
this code are taken from librsvg.
This includes an elliptical arc implementation according
to the SVG spec. The code is mostly taken from librsvg,
but pretty directly follows the SVG spec implementation
notes. We don't export this, since the parametrization
is inconvenient. We do want an arc_to API, but
these are not the arcs we are looking for.
2023-07-31 16:51:04 +02:00
Matthias Clasen
bddffb08cc
path: Implement SVG arcs
...
This is elliptical arc implementation according to the SVG spec.
The code is mostly taken from librsvg, but pretty directly
follows the SVG spec implementation notes.
We don't export this, since the parametrization is inconvenient.
We do want an arc_to API, but these are not the arcs we are
looking for.
It will be used in parsing SVG path syntax.
2023-07-31 16:51:04 +02:00
Matthias Clasen
84dbd7c46f
stroke: Add miter limit
...
Add a miter limit to GskStroke. This will be needed to
fully implement line joins.
Also introduce the GSK_LINE_JOIN_MITER_CLIP value,
following SVG 2.0. cairo does not have it, so translate
it to plain miter when using cairo.
2023-07-31 16:51:04 +02:00
Matthias Clasen
4487cafd40
Documentation typo fixes
2023-07-31 16:51:04 +02:00
Benjamin Otte
2f930f93cc
testsuite: Add relative path functions
...
They're making the paths slightly weirder, but they test public API, so
woohoo!
2023-07-31 16:51:04 +02:00
Benjamin Otte
0a947d9a6a
pathbuilder: Add relative path commands
...
And gsk_path_builder_get_current_point().
They will be needed by the string parser.
2023-07-31 16:51:04 +02:00
Benjamin Otte
46f405ac7d
path: Add GSK_CIRCLE_POINT_INIT() to initialize points on the circle
...
This is just splitting out a commonly done operation into a macro.
2023-07-31 16:51:04 +02:00
Benjamin Otte
4f03537a28
pathbuilder: Redo semantics for starting curves
...
We now always have a "current point" which is either the last point an
operation was made to, or (0, 0) if no drawing operation has
been made yet.
Adding a contour of any kind to the builder will always update the
current point to that contour's end point.
2023-07-31 16:51:04 +02:00
Benjamin Otte
1621b53570
xxx: demo
2023-07-31 16:51:04 +02:00
Benjamin Otte
7e66dfe902
pathbuilder: Rename "builder" variables to "self"
...
This is a pure find/replace that is now possible after
the split in the previous commit.
2023-07-31 16:51:04 +02:00
Benjamin Otte
7bc6fabbf7
path: Split GskPathBuilder into its own file
...
... and add missing API docs.
2023-07-31 16:51:04 +02:00
Benjamin Otte
26c8702400
testsuite: Add a test using get_point() and get_closest_point()
2023-07-31 16:51:04 +02:00
Benjamin Otte
1b7c4420dc
testsuite: Add a test for get_point()
2023-07-31 16:51:04 +02:00
Benjamin Otte
ece3153b1f
testsuite: Update create_random_path()
...
1. Allow specifying the max number of contours
2. Be smarter about creating the paths:
With 10% chance, create a "weird" path like the empty one or only
points or things like that.
Otherwise create a bunch of contours, with 2/3 a standard contour,
with 1/3 a predetermined one.
2023-07-31 16:51:04 +02:00
Benjamin Otte
74dc039c7a
gtk-demo: Add cute maze demo
2023-07-31 16:51:04 +02:00
Benjamin Otte
3e1c3aca2a
testsuite: Add tests for gsk_path_measure_get_closest_point()
2023-07-31 16:51:04 +02:00
Benjamin Otte
51bc26b314
path: Add gsk_path_measure_get_closest_point()
...
... and gsk_path_measure_get_closest_point_full().
Those 2 functions allow finding the closest point on a path to a given
point.
2023-07-31 16:51:04 +02:00
Benjamin Otte
51a1adf312
spline: Use Skia's tolerance checks
...
This avoids measuring being too far off (it's still off, but it's less
than a percent now.
2023-07-31 16:51:04 +02:00
Benjamin Otte
d84132824f
testsuite: Add tests for gsk_path_measure_add_segment()
2023-07-31 16:51:03 +02:00
Benjamin Otte
ffecc89352
gtk-demo: Add a text-on-path demo
2023-07-31 16:51:03 +02:00
Benjamin Otte
77518895ea
demos: Add a simple demo filling a path
2023-07-31 16:51:03 +02:00
Benjamin Otte
9685a47693
path: Add gsk_path_measure_get_point()
...
Allows querying the coordinates and direction of any specific point on a
path.
2023-07-31 16:51:03 +02:00
Matthias Clasen
7f9825919c
path: Add gsk_path_add_circle()
...
Adds a circle contour, too.
2023-07-31 16:51:03 +02:00
Benjamin Otte
2795fc53c1
pathmeasure: Implement support for beziers
...
Instead of treating bezier curves as lines, we properly decompose them
into line segments now so that we can treat those as lines.
2023-07-31 16:51:03 +02:00
Benjamin Otte
20ba4a225c
path: Implement gsk_path_to_cairo() using foreach()
2023-07-31 16:51:03 +02:00
Benjamin Otte
eadbfc3433
path: Add gsk_path_foreach()
2023-07-31 16:51:03 +02:00
Benjamin Otte
b8ee48de63
path: Collect flags
...
We don't need them yet, but maybe later.
2023-07-31 16:51:03 +02:00
Benjamin Otte
25a5a8a85d
testsuite: Add path tests
2023-07-31 16:51:03 +02:00
Benjamin Otte
5e1170bdb2
pathmeasure: Add gsk_path_measure_add_segment()
...
This allows chunking paths, weeee.
2023-07-31 16:51:03 +02:00
Benjamin Otte
f6bf74e2c9
path: Add gsk_path_builder_add_path()
2023-07-31 16:51:03 +02:00
Benjamin Otte
fa51c2eb0e
gsk: Add GskPathMeasure
...
An object to do measuring operations on paths - determining their
length, cutting off subpaths, things like that.
2023-07-31 16:51:03 +02:00
Benjamin Otte
d34f1bbd6c
path: Change data structure for standard path
...
Instead of the Cairo method and imitating cairo_path_data_t, use the
Skia method and keep points and operations separate.
That way we get a points array that includes the starting point -
because it's always the end point of the previous operation.
2023-07-31 16:51:03 +02:00
Benjamin Otte
8fd55e9f89
snapshot: Add gtk_snapshot_push_stroke()
2023-07-31 16:51:03 +02:00
Benjamin Otte
be4beeb8f2
gsk: Add GskStrokeNode
2023-07-31 16:51:03 +02:00
Benjamin Otte
09288f621a
gsk: Add GskStroke
...
It's unused in this commit. This just prepares the new object.
2023-07-31 16:51:03 +02:00
Benjamin Otte
3ec3727575
snapshot: Add gtk_snapshot_push_fill()
2023-07-31 16:51:03 +02:00
Benjamin Otte
77e58d4463
rendernode: Implement fast-path for solid fills
...
They happen so often that it's worth avoiding the clip + paint path
there.
2023-07-31 16:51:03 +02:00
Benjamin Otte
bb58b504a6
gsk: Add GskFillNode
...
Take a rendernode as source and a GskPath and fill the region in the
path just like cairo_fill() would.
2023-07-31 16:51:03 +02:00
Benjamin Otte
f6bb568e91
gsk: Add GskPath
2023-07-31 16:51:03 +02:00
Benjamin Otte
efbb3ab535
xxx: benchmarking
2023-07-31 16:51:03 +02:00
Benjamin Otte
e00e6f3d5d
vulkan: Clear Cairo surfaces on upload
...
The memory isn't guaranteed to be all zeroes and we don't want glitches.
2023-07-31 16:51:03 +02:00
Benjamin Otte
e98ae233fc
vulkan: Fix a memleak
2023-07-31 16:51:03 +02:00
Benjamin Otte
2ad11e12d4
vulkan: Plug a memleak
...
Yay, we no longer leak swapchain images
2023-07-31 16:51:03 +02:00
Benjamin Otte
3f16f7e0d4
rendernode-tool: Add another magic format
...
Make .svg use the Cairo renderer to save to an SVG file.
It's useful when comparing rendering behavior and times with
web browsers (as long as one is aware that browsers build a full
DOM tree out of those SVGs).
2023-07-31 16:51:03 +02:00
Benjamin Otte
166777dd55
rendernode-tool: Move code
...
No functional changes yet.
2023-07-31 16:51:03 +02:00
Benjamin Otte
c8f385e3bc
vulkancontext: Do proper refcounting
...
- fix a memleak
- call unref() instead of new()
- remove idle handler on dispose
What was I doing when I wrote the pipeline cache code?
2023-07-31 16:51:03 +02:00
Benjamin Otte
89b4f12b38
vulkan: Plug a memleak
2023-07-31 16:51:03 +02:00
Benjamin Otte
ae509406f1
memorytexture: Add a check
...
Sophie Herold was running into this problem while coding, so let's help
people by catching it early.
2023-07-31 16:51:03 +02:00
Benjamin Otte
1aa7f18b23
vulkan: Remove unused variable
...
It's only used when printing debug stuff. Debug stuff is not that
important.
2023-07-31 16:51:03 +02:00
Benjamin Otte
cf39c80fe2
docs: Update for recent rendernode-tool changes
2023-07-31 16:51:03 +02:00