Commit Graph

67874 Commits

Author SHA1 Message Date
Matthias Clasen
7da5e494e4 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.
2020-12-19 18:34:42 +01:00
Matthias Clasen
0d5d6e8b3e Documentation typo fixes 2020-12-19 18:34:42 +01:00
Benjamin Otte
77f351c4be testsuite: Add relative path functions
They're making the paths slightly weirder, but they test public API, so
woohoo!
2020-12-19 18:34:42 +01:00
Benjamin Otte
b4982b6cf3 pathbuilder: Add relative path commands
And gsk_path_builder_get_current_point().

They will be needed by the string parser.
2020-12-19 18:34:42 +01:00
Benjamin Otte
8eadf59676 path: Add GSK_CIRCLE_POINT_INIT() to initialize points on the circle
This is just splitting out a commonly done operation into a macro.
2020-12-19 18:34:42 +01:00
Benjamin Otte
1b46896164 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.
2020-12-19 18:34:42 +01:00
Benjamin Otte
e8aef57587 xxx: demo 2020-12-19 18:34:42 +01:00
Benjamin Otte
3b94c3cb97 path: Split GskPathBuilder into its own file
... and add missing API docs.
2020-12-19 18:34:42 +01:00
Benjamin Otte
fe1dcc086a testsuite: Add a test using get_point() and get_closest_point() 2020-12-19 18:34:42 +01:00
Benjamin Otte
b4700fae93 testsuite: Add a test for get_point() 2020-12-19 18:34:42 +01:00
Benjamin Otte
e6763419f1 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.
2020-12-19 18:34:33 +01:00
Benjamin Otte
d33fdb276e gtk-demo: Add cute maze demo 2020-12-19 06:41:22 +01:00
Benjamin Otte
5b8acfb3cd testsuite: Add tests for gsk_path_measure_get_closest_point() 2020-12-19 06:41:22 +01:00
Benjamin Otte
afa8cfa44c 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.
2020-12-19 06:41:22 +01:00
Benjamin Otte
af380898d7 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.
2020-12-19 06:41:22 +01:00
Benjamin Otte
d4b393b0bf testsuite: Add tests for gsk_path_measure_add_segment() 2020-12-19 06:41:22 +01:00
Benjamin Otte
b33778c582 gtk-demo: Add a text-on-path demo 2020-12-19 06:41:22 +01:00
Benjamin Otte
5cf05db437 xxx: path_fill demo 2020-12-19 06:41:22 +01:00
Benjamin Otte
a300002431 path: Add gsk_path_measure_get_point()
Allows querying the coordinates and direction of any specific point on a
path.
2020-12-19 06:41:21 +01:00
Matthias Clasen
86617e0eb7 path: Add gsk_path_add_circle()
Adds a circle contour, too.
2020-12-19 06:41:21 +01:00
Benjamin Otte
f607314bb4 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.
2020-12-19 06:41:21 +01:00
Benjamin Otte
1d06b2508d path: Implement gsk_path_to_cairo() using foreach() 2020-12-19 06:41:21 +01:00
Benjamin Otte
66f1774c56 path: Add gsk_path_foreach() 2020-12-19 06:41:21 +01:00
Benjamin Otte
8b4648233f path: Collect flags
We don't need them yet, but maybe later.
2020-12-19 06:41:21 +01:00
Benjamin Otte
5002d3e9d7 testsuite: Add path tests 2020-12-19 06:41:21 +01:00
Benjamin Otte
57a2b23025 pathmeasure: Add gsk_path_measure_add_segment()
This allows chunking paths, weeee.
2020-12-19 06:41:21 +01:00
Benjamin Otte
9c316dd7e4 path: Add gsk_path_builder_add_path() 2020-12-19 06:41:21 +01:00
Benjamin Otte
836b78e543 gsk: Add GskPathMeasure
An object to do measuring operations on paths - determining their
length, cutting off subpaths, things like that.
2020-12-19 06:41:21 +01:00
Benjamin Otte
b4c2756a3c 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.
2020-12-19 06:41:21 +01:00
Benjamin Otte
6f74445e1d popover: Use fill and stroke nodes instead of Cairo
... to render the arrow.

The arrow should really be turned into a real thing - maybe an icon?
2020-12-19 06:41:21 +01:00
Benjamin Otte
a49ca1209e snapshot: Add gtk_snapshot_push_stroke() 2020-12-19 06:41:21 +01:00
Benjamin Otte
45992b2672 gsk: Add GskStrokeNode 2020-12-19 06:41:21 +01:00
Benjamin Otte
5244b51457 gsk: Add GskStroke
It's unused in this commit. This just prepares the new object.
2020-12-19 06:41:21 +01:00
Benjamin Otte
42e60fce8b demos: Add a simple demo filling a path 2020-12-19 06:41:21 +01:00
Benjamin Otte
f15c9d134e snapshot: Add gtk_snapshot_push_fill() 2020-12-19 06:41:21 +01:00
Benjamin Otte
c3166d8a49 gsk: Add GskFillNode
Take a rendernode as source and a GskPath and fill the region in the
path just like cairo_fill() would.
2020-12-19 06:41:21 +01:00
Benjamin Otte
6f453d6229 gsk: Add GskPath 2020-12-19 06:41:21 +01:00
Benjamin Otte
1285a23f4d listview: Use the correct scroll policy
Use the horizontal policy for horizontal decisions, not the vertical
one.

This broke in 0011ce949c.
2020-12-19 06:41:21 +01:00
Benjamin Otte
7fbaa41281 docs: Put render nodes in their own sections 2020-12-19 06:41:21 +01:00
Benjamin Otte
8374a8cefa roundedbox: Remove unused API 2020-12-19 06:41:21 +01:00
Benjamin Otte
501e8c56af picture: Fix copy/paste error in docs 2020-12-19 06:41:21 +01:00
Benjamin Otte
d8dec82bdd video: When autoplaying, start playing once the video is prepared
This fixe video sources with longer loading times not automatically
playing.
2020-12-19 06:41:21 +01:00
Benjamin Otte
a17042963e gtk-demo: Don't put the search bar in the scroll area
1. That's a bad idea UI wise as you can't see the search after you
   scrolled.

2. That's a bad idea code-wise because Listviews need to be put into
   a ScrolledWindow or they won't scroll.
2020-12-19 06:41:21 +01:00
Matthias Clasen
db08bccb11 Merge branch 'cursor-aspect-ratio' into 'master'
Cursor aspect ratio fixes for gtk 4

Closes #3441

See merge request GNOME/gtk!2966
2020-12-16 23:40:26 +00:00
Sebastian Keller
02f0681344 settings: Change gtk-cursor-aspect-ratio from float to double
Float properties can not be read from keyfiles. This was causing changes
to this property in settings.ini to be ignored. Fix this by changing it
to a double.

Technically this change could be considered an API break, but there are
no users of this property as float yet and it is early enough to expect
there to never be any.

Also document this change in the 3 to 4 migration guide since in gtk 3
this setting will be kept a float.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3441
2020-12-16 22:35:36 +01:00
Emmanuele Bassi
62dbadd536 Merge branch 'fix-macos-compilation' into 'master'
macos: fix typo that breaks compilation

See merge request GNOME/gtk!2962
2020-12-16 20:18:27 +00:00
Matthias Clasen
0588db8a69 Merge branch 'wip/carlosg/for-master' into 'master'
gdk/x11: Transform XI_Motion based scroll into discrete

Closes #3459

See merge request GNOME/gtk!2959
2020-12-16 19:56:16 +00:00
Emmanuele Bassi
58b1a13453 Merge branch 'ricotz/for-master' into 'master'
gdk: Use correct parameter name to fix g-ir-scanner warning

See merge request GNOME/gtk!2963
2020-12-16 19:46:51 +00:00
Rico Tzschichholz
df70dbbae4 gdk: Use correct parameter name to fix g-ir-scanner warning
../gdk/gdktoplevellayout.c:217: Warning: Gdk: gdk_toplevel_layout_get_maximized:
  unknown parameter 'maximized' in documentation comment, should be 'maximize'
2020-12-16 20:19:05 +01:00
Tom Schoonjans
81c55b06d2 macos: fix typo that breaks compilation 2020-12-16 19:16:19 +00:00