Commit Graph

67399 Commits

Author SHA1 Message Date
Matthias Clasen
c77d126bf4 Maintain smoothness harder
When removing a point, we need to ensure that
the neighboring point is still smooth.
2020-11-21 22:50:30 -05:00
Matthias Clasen
12ac1dfdbe Maintain symmetry
When turning on symmetry, we need to actually make
the point symmetric.
2020-11-21 22:50:30 -05:00
Matthias Clasen
17ef4a77fe Redo the data structure
Change things around a bit and keep an array of
points. Each point comes with its two neighboring
control points, and each Bezier segment is made up
from points from two neighboring points.
This is much closer to what the ui shows.
2020-11-21 22:50:30 -05:00
Matthias Clasen
0f1122880a Remove leftover code
We are setting smoothness in the menu now,
so we should not be toggling it on right-click
anymore.
2020-11-21 20:00:00 -05:00
Matthias Clasen
4994ea43f9 Reshuffle code 2020-11-21 14:53:59 -05:00
Matthias Clasen
401ff4137c Make symmetric point state
This matches what Inkscape does.
2020-11-21 12:52:18 -05:00
Matthias Clasen
e60057d1a6 Add a helper function
Add a point_is_visible function and use it in
several places. This fixes cases where it was
possible to interact with invisible control points.
2020-11-21 12:43:28 -05:00
Matthias Clasen
c59fd4940b Add hover for points 2020-11-21 12:11:21 -05:00
Matthias Clasen
64b0b117b3 Cosmetics 2020-11-21 11:51:28 -05:00
Matthias Clasen
95867222b8 Implement adding points 2020-11-21 10:36:27 -05:00
Matthias Clasen
4f5d05634a Implement removing points 2020-11-21 09:26:53 -05:00
Matthias Clasen
8a9a067b4b Be more lenient with clicks
Allow clicks to be slightly outside the radius
of the drawn circles, to make clicking easier.
2020-11-21 09:26:40 -05:00
Matthias Clasen
3ef88ba4cf Use graphene point distance function
No need to roll our own.
2020-11-21 09:24:17 -05:00
Matthias Clasen
01abd68455 Add more api
Add curve_editor_get_path.
2020-11-21 08:47:43 -05:00
Matthias Clasen
267c1a277c Rename to CurveEditor
And start separating the widget from the demo
with an api.
2020-11-21 08:47:34 -05:00
Matthias Clasen
ca4d610bf2 Add operations
Allow setting the type of segments to move, line or
curve, from the context menu, and do the necessary
adjustments to maintain smoothness, in particular
between curve and line segments.
2020-11-21 08:47:33 -05:00
Matthias Clasen
8993756a84 Use a context menu
Move the toggling of smoothness to a context menu
on each point. This menu will carry more items in
the future.
2020-11-20 13:30:08 -05:00
Matthias Clasen
4c23a9fa6e Tweak editing some more 2020-11-20 11:11:23 -05:00
Matthias Clasen
93d2b8ba63 Change dragging of non-smooth point
Always move control points along. Feels more natural.
2020-11-20 09:52:12 -05:00
Matthias Clasen
6f45aaf9f4 curve: Introduce the concept of symmetric
Keep the distance of control points equal (ie symmetric)
when dragging control points, unless you hold Control
when initiating the drag.
2020-11-20 09:35:42 -05:00
Matthias Clasen
da503ea4b5 curve: Restructure data a bit
Introduce a separate PointData struct that is going
to hold per-segment information.
2020-11-20 08:45:38 -05:00
Matthias Clasen
8ce6690205 More curve editing
Make right-click on curve points toggle between
smooth and corner.
2020-11-20 00:55:51 -05:00
Matthias Clasen
0d8e052123 Play with paths
Add a simple demo for editing a poly-Bezier curve.
2020-11-19 23:38:20 -05:00
Benjamin Otte
4b04c859b6 gtk-demo: Add a text-on-path demo 2020-11-19 22:41:37 +01:00
Benjamin Otte
39093d5935 xxx: path_fill demo 2020-11-19 22:41:37 +01:00
Benjamin Otte
3abe33fc1d path: Add gsk_path_measure_get_point()
Allows querying the coordinates and direction of any specific point on a
path.
2020-11-19 22:41:37 +01:00
Benjamin Otte
6e7df513ab path: Add gsk_path_add_circle()
Adds a circle contour, too.
2020-11-19 22:41:37 +01:00
Benjamin Otte
3cf4bbc9d1 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-11-19 22:41:37 +01:00
Benjamin Otte
eb63c33ce9 path: Implement gsk_path_to_cairo() using foreach() 2020-11-19 22:41:37 +01:00
Benjamin Otte
4aca0358b4 path: Add gsk_path_foreach() 2020-11-19 22:41:37 +01:00
Benjamin Otte
cf930d93e1 path: Collect flags
We don't need them yet, but maybe later.
2020-11-19 22:41:37 +01:00
Benjamin Otte
6f009aa6d7 testsuite: Add path tests 2020-11-19 22:41:37 +01:00
Benjamin Otte
9211e49dd2 pathmeasure: Add gsk_path_measure_add_segment()
This allows chunking paths, weeee.
2020-11-19 22:41:37 +01:00
Benjamin Otte
c7a061bfba path: Add gsk_path_builder_add_path() 2020-11-19 22:41:37 +01:00
Benjamin Otte
099cac301d gsk: Add GskPathMeasure
An object to do measuring operations on paths - determining their
length, cutting off subpaths, things like that.
2020-11-19 22:41:37 +01:00
Benjamin Otte
8924a0df00 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-11-19 22:41:37 +01:00
Benjamin Otte
0eb30556e9 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-11-19 22:41:37 +01:00
Benjamin Otte
cd5822dd4c snapshot: Add gtk_snapshot_push_stroke() 2020-11-19 22:41:37 +01:00
Benjamin Otte
f155d7f8d3 gsk: Add GskStrokeNode 2020-11-19 22:41:37 +01:00
Benjamin Otte
c81e4a4fa6 demos: Add a simple demo filling a path 2020-11-19 22:41:36 +01:00
Benjamin Otte
7d4ac10fc3 snapshot: Add gtk_snapshot_push_fill() 2020-11-18 09:04:48 +01:00
Benjamin Otte
ecab2c0e24 gsk: Add GskFillNode
Take a rendernode as source and a GskPath and fill the region in the
path just like cairo_fill() would.
2020-11-18 09:04:48 +01:00
Benjamin Otte
396197340d gsk: Add GskPath 2020-11-18 09:04:48 +01:00
Matthias Clasen
b3243132a0 Merge branch 'wip/chergert/gdk-macos-for-master' into 'master'
macos: fix rendering artifacts with hover transitions

See merge request GNOME/gtk!2862
2020-11-18 03:04:01 +00:00
Christian Hergert
dd7f52c59a macos: fix rendering artifacts with hover transitions
Using an image surface seems to fix some rendering artifacts when
performing cross-fade CSS transitions.
2020-11-17 18:20:55 -08:00
Matthias Clasen
9128ad105b Merge branch 'wip/carlosg/for-master' into 'master'
gdk/wayland: Update to gtk_shell1 version 3

See merge request GNOME/gtk!2860
2020-11-18 00:13:17 +00:00
Carlos Garnacho
745cbc6c91 gdk/wayland: Update to gtk_shell1 version 3
Bring in line with gtk3, in terms of startup notification and
activation support.
2020-11-18 00:41:46 +01:00
Matthias Clasen
b635736ac2 Merge branch 'wip/chergert/gdk-macos-for-master' into 'master'
node-editor: fix length of text during save

See merge request GNOME/gtk!2859
2020-11-17 22:49:05 +00:00
Matthias Clasen
ba081bf119 Merge branch 'fix-doc-packtype' into 'master'
doc: Adapt GtkPackType documentation to GTK4 changes

See merge request GNOME/gtk!2858
2020-11-17 22:46:43 +00:00
Christian Hergert
3003f37e9d node-editor: fix length of text during save
The length parameter for g_file_replace_contents() is a gsize, so -1 is
unsuitable here. Just use strlen() directly.
2020-11-17 14:34:11 -08:00