Compare commits

...

128 Commits

Author SHA1 Message Date
Matthias Clasen 0f0fe317a3 gtk-demo: Add a spinbutton to the path walk
Let the user pick how many arrows to show,
to explore performance implications.
2023-08-17 12:43:46 -04:00
Matthias Clasen 348391cd0e Add the randomized segment test
This produces bad split examples quickly.
2023-08-17 06:37:03 -04:00
Matthias Clasen 334b1215d0 Add a test for bad lengths with splits 2023-08-17 06:37:03 -04:00
Benjamin Otte 48b47cd518 demos: Add a text-on-path demo 2023-08-17 06:37:03 -04:00
Matthias Clasen ce692d391c Make the map demo more interesting
Add path walking to it.
2023-08-17 06:37:03 -04:00
Matthias Clasen 1d6724c075 path: Add length<>point api 2023-08-17 06:37:03 -04:00
Matthias Clasen bba5dd047e contour: Add length<>point api 2023-08-17 06:37:03 -04:00
Matthias Clasen 7eef8b514c curve: Add length computation
Add api to go t<>length.
2023-08-17 06:37:03 -04:00
Matthias Clasen d56b6062cf curve: Add a get_derivative vfunc 2023-08-16 21:56:28 -04:00
Matthias Clasen 08c064d79a Merge branch 'matthiasc/for-main' into 'main'
Rename an internal function

See merge request GNOME/gtk!6301
2023-08-16 20:40:12 +00:00
Matthias Clasen 73853f1a6b contour: Add an assertion 2023-08-16 16:18:38 -04:00
Matthias Clasen 8634d67cff Some fixes for gsk_path_builder_add_segment
We must be careful with single-point contours
that contain just a move. These never occur in
practice, but our randomized tests produce them
regularly.
2023-08-16 16:15:26 -04:00
Matthias Clasen 125ea90894 Rename an internal function
We want the number of ops, not the number of points.
2023-08-16 15:54:46 -04:00
Matthias Clasen ffba5a3f42 Merge branch 'matthiasc/for-main' into 'main'
build: Drop some unused variables

See merge request GNOME/gtk!6297
2023-08-16 19:28:12 +00:00
Matthias Clasen 60df21213b Merge branch 'dboles/popover-css-nodes' into 'main'
Popover: Fix & add to CSS nodes documentation

See merge request GNOME/gtk!6300
2023-08-16 19:16:12 +00:00
Sabri Ünal 14ba577acb Update Turkish translation 2023-08-16 18:31:30 +00:00
Benjamin Otte 7d5ef1117e Merge branch 'color-matrix' into 'main'
Color matrix node fixes & clarifications

See merge request GNOME/gtk!6290
2023-08-16 17:07:35 +00:00
Daniel Boles af0e2bff94 Popover: Fix & add to CSS nodes documentation
* The `.background` class gets put on `popover`, not `content`
* Use backticks to style node and class names with monospace
* Link to GtkPopoverMenu
* Add to PopoverMenu a bit outlining how items and sections look in CSS.
2023-08-16 17:11:45 +01:00
Matthias Clasen 7d65f81d7f Merge branch 'path-world-resource' into 'main'
Fix MSVC build (turn world map path into a resource)

See merge request GNOME/gtk!6296
2023-08-16 13:51:32 +00:00
Matthias Clasen b08ecfcf9e build: Drop some unused variables
We are not using gtk_private_packages at all,
so drop it.
2023-08-16 09:43:34 -04:00
Matthias Clasen e2cd362f24 Merge branch 'fg_color_docs' into 'main'
gsk: Update docs for gtk_snapshot_append_layout

See merge request GNOME/gtk!6295
2023-08-16 12:52:43 +00:00
Yuri Chornoivan 1a1b6fe66b Update Ukrainian translation 2023-08-16 11:37:47 +00:00
Sergey Bugaev 122176a3a1 gtk-demo: Turn world map path into a resource
The C string literal way way too long for MSVC.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
2023-08-16 14:35:35 +03:00
Matthias Clasen 5beccc8208 Merge branch 'fix-pc-files' into 'main'
meson: Add wayland-client to gtk4-wayland requires

See merge request GNOME/gtk!6293
2023-08-16 11:29:39 +00:00
Matthias Clasen 6715a3267a Merge branch 'remove-out-caller-allocates-from-pod-types' into 'main'
introspection: Remove 'caller-allocates' from POD types

See merge request GNOME/gtk!6294
2023-08-16 11:29:25 +00:00
Alexandros Theodotou 313078b77c gsk: Update docs for gtk_snapshot_append_layout
Mention how to get the current theme's foreground color.
2023-08-16 20:09:15 +09:00
Sergey Bugaev 246a7cfeab rendernode, snapshot: Slightly expand color matrix docs
Based on reverse engineering the color node and contrary to my
expectations, the matrix/offset is expressed in, and applied to,
unpremultiplied colors. The colors are being explicitly
unpremultiplied, transformed according to the matrix/offset, and
premultiplied back (see color_matrix.glsl). The matrix is getting
transposed.

Also, copy the same blurb to the corresponding GtkSnapshot function.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
2023-08-16 13:55:04 +03:00
Sergey Bugaev 082fdfdb24 snapshot: Fix merging color matrix nodes
The code was appliying the matrices in the wrong order: we have to apply
the inner node's matrix first, and the outer one second. Due to the
matrices being implicitly transposed, the matrix multiplication was done
in the right order, yet the wrong matrix was being mutliplied by the
wrong offset vector.

To make the code a little easier to follow, create explicit variables
for the resulting matrix and offset (instead of reusing matrix2 and
offset2), and fix & expand the comment to document how matrix
transposition factors into this.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
2023-08-16 13:54:54 +03:00
Philip Chimento 823cb714ec introspection: Remove 'caller-allocates' from POD types
The (out caller-allocates) and (out callee-allocates) annotations are
meant for structured or pointer types. Plain old data types are just
regular out parameters and don't need the annotation about who allocates
them.

See glib!2005, gjs#570
2023-08-15 22:30:27 -07:00
Ekaterine Papava cc93347fe6 Update Georgian translation 2023-08-16 03:36:32 +00:00
Xavier Claessens d6a07cd617 meson: Add x11_dep to gtk4-x11 requires 2023-08-15 21:17:39 -04:00
Fran Dieguez 858bd9f84c Update Galician translation 2023-08-15 23:40:15 +00:00
Matthias Clasen be7e5c866f Merge branch 'matthiasc/for-main' into 'main'
gsk: Add more details to the docs

See merge request GNOME/gtk!6292
2023-08-15 19:27:59 +00:00
Matthias Clasen 93a90bafc3 Add some statistics to the map demo 2023-08-15 13:55:46 -04:00
Xavier Claessens 090e01b383 meson: Add wayland-client to gtk4-wayland requires 2023-08-15 13:35:46 -04:00
Matthias Clasen 03a511aab4 path-tool: Make info show statistics
It is somewhat interesting to know how many
contours, lines, etc. a path consists of.
2023-08-15 13:33:23 -04:00
Matthias Clasen 5cf9a09c07 gsk: Add more details to the docs 2023-08-15 12:38:24 -04:00
Matthias Clasen 9558c70683 Merge branch 'dboles/signal-factory-typos' into 'main'
SignalListItemFactory: small doc grammar+sense fix

See merge request GNOME/gtk!6291
2023-08-15 14:36:35 +00:00
Daniel Boles 57d98a12fa SignalListItemFactory: small doc grammar+sense fix
* "to to" => "to"
* "a object" => "an object"
* "its new prop is about to be unset" => "its prop is about to be unset"
2023-08-15 10:47:30 +01:00
Danial Behzadi 3dd40049a9 Update Persian translation 2023-08-14 22:35:12 +00:00
Matthias Clasen 225e626ada Merge branch 'matthiasc/for-main' into 'main'
Fix GskStandardContour to have a 'good' size

See merge request GNOME/gtk!6289
2023-08-14 20:28:46 +00:00
Matthias Clasen 081f504ae4 Tweak the directions illustration
Still not 100% happy with it, but it is better.
2023-08-14 16:09:27 -04:00
Matthias Clasen 45aa8e4e00 Fix GskStandardContour to have a 'good' size
We need the size of GskStandardContour to be
at least as aligned as graphene_point_t, or
things break in hard to debug ways.
2023-08-14 15:59:45 -04:00
Matthias Clasen 87430be658 Fix up a testcase
I had gotten the path direction enum mixed up here.
2023-08-14 15:59:45 -04:00
Matthias Clasen 012c16ccd6 Merge branch 'matthiasc/for-main' into 'main'
gtk-demo: Clean up path walk demo

See merge request GNOME/gtk!6288
2023-08-14 19:20:57 +00:00
Matthias Clasen de0cef5d4d Merge branch 'path-convenience' into 'main'
pathpoint: Add gsk_path_get_rotation

See merge request GNOME/gtk!6284
2023-08-14 19:20:40 +00:00
Matthias Clasen e807a84967 gtk-demo: Clean up path walk demo 2023-08-14 15:19:42 -04:00
Matthias Clasen b5e105d4f4 snapshot: Add more path api
Add convenience methods to fill or stroke
a path with a color.
2023-08-14 14:58:22 -04:00
Matthias Clasen a85ab3585e Revise gsk_path_point_get_tangent
Update the directions enum to allow all four
tangents to be obtained. Add an illustration
to the docs for clarity.

Update all callers.
2023-08-14 14:58:22 -04:00
Matthias Clasen a1d40c5236 Add gsk_path_point_get_rotation
This returns the tangent in the form of an angle.
2023-08-14 14:58:22 -04:00
Matthias Clasen 95ea6b2615 Merge branch 'path-point-api-revision2' into 'main'
pathpoint: Revise argument order

See merge request GNOME/gtk!6287
2023-08-14 18:53:23 +00:00
Ekaterine Papava 82d8bc9403 Update Georgian translation 2023-08-14 18:34:10 +00:00
Matthias Clasen 536d432444 Merge branch 'path-map-demo' into 'main'
demos: Add a map demo

See merge request GNOME/gtk!6285
2023-08-14 17:49:26 +00:00
Yuri Chornoivan 3b8c26a116 Update Ukrainian translation 2023-08-14 17:30:53 +00:00
Matthias Clasen 6ace4b60d8 pathpoint: Revise argument order
In order for introspection and documentation to
not be confused, we need to have the GskPathPoint
be the first argument.

Update all callers.
2023-08-14 13:20:34 -04:00
Matthias Clasen 7601b89561 Merge branch 'fix-4986' into 'main'
Fix native filechooser on macOS

Closes #4986

See merge request GNOME/gtk!6272
2023-08-14 16:26:15 +00:00
Matthias Clasen 0cdd2e7008 Merge branch 'color-dialog-button-activate' into 'main'
Make new-style dialog buttons activatable

See merge request GNOME/gtk!6255
2023-08-14 16:26:13 +00:00
Piotr Drąg 595152bdba Update POTFILES.in 2023-08-14 15:16:29 +02:00
Benjamin Otte 90f0733673 demos: Add a map demo
For now, this just shows a world map.

Once we have measures, we can make this
a little more interesting.
2023-08-14 08:41:16 -04:00
Matthias Clasen 625e83e1de Merge branch 'wip/alice/menu-button' into 'main'
menubutton: Fix focus on the internal gizmo

Closes #6025

See merge request GNOME/gtk!6283
2023-08-14 11:19:21 +00:00
Matthias Clasen daac04be82 Merge branch 'bilelmoussaoui/gi' into 'main'
gi: Add missing since annotation

See merge request GNOME/gtk!6282
2023-08-14 11:15:28 +00:00
Matthias Clasen 8ec9bba892 Merge branch 'dboles/inspector-object-tree-flash' into 'main'
inspector/object-tree: Fix ! flash @ select widget

Closes #6022

See merge request GNOME/gtk!6279
2023-08-14 11:14:49 +00:00
Alice Mikhaylenko b63e365fd2 menubutton: Fix focus on the internal gizmo
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/6025
2023-08-14 14:24:06 +04:00
Daniel Boles 859a25b0e7 Inspector: Fix ! flash on select widget @ obj tree
Widgets are flashed by the window when it receives Tree::object-selected
- but we were emitting said signal from select_object(), i.e. if we were
made to select by an external caller. We should also emit it if the user
interactively selects an item, so the window receives+flashes the widget

fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/6022
2023-08-14 10:48:26 +01:00
Bilal Elmoussaoui f5d47a4658 gi: Add missing since annotation 2023-08-14 08:41:12 +00:00
Matthias Clasen fa6645f157 Merge branch 'fix-add-segment' into 'main'
Fix gsk_path_builder_add_segment

See merge request GNOME/gtk!6280
2023-08-14 01:01:37 +00:00
Joshua Lee 69b6067c5e fontdialogbutton: Make activatable 2023-08-14 01:26:23 +01:00
Joshua Lee e645f59748 colordialogbutton: Make activatable 2023-08-14 01:26:20 +01:00
Efstathios Iosifidis 2929686c1d Update Greek translation 2023-08-13 21:18:23 +00:00
Andika Triwidada c83256e080 Update Indonesian translation 2023-08-13 13:42:39 +00:00
Matthias Clasen 4b7e1b1233 Fix gsk_path_builder_add_segment
We were splitting the last segment, but did not
actually use the result of the split. Oops.
2023-08-13 09:40:19 -04:00
Matthias Clasen 95a8821614 text: Track user changes better
Make all the action signal handlers call
begin/end_change(), so we can rely on
change_count being >0 to check later if
an action is user-initiated or programmatic.

Fixes: #6018
2023-08-13 09:31:42 -04:00
Benjamin Otte 73500f9ebb Merge branch 'wip/otte/for-main' into 'main'
treeviewcolumn: Set ascending class for ascending order

Closes #6002

See merge request GNOME/gtk!6277
2023-08-13 03:54:19 +00:00
Matthias Clasen eae38756c2 Merge branch 'matthiasc/for-main' into 'main'
path-tool: Make the docs match

See merge request GNOME/gtk!6278
2023-08-12 23:51:21 +00:00
Matthias Clasen 8bf7187b89 path-tool: Make the docs match
We've removed various things from the tool,
and forgot to keep the docs up-to-date.
2023-08-12 19:29:27 -04:00
Matthias Clasen e7fb8842b5 Merge branch 'path-for-merge-8' into 'main'
Add gtk-path-tool

See merge request GNOME/gtk!6263
2023-08-12 21:39:15 +00:00
Matthias Clasen aaac0cb4a1 Merge branch 'bilelmoussaoui/linkify' into 'main'
docs: Drop uneeded ` in gi-docgen links

See merge request GNOME/gtk!6276
2023-08-12 21:23:13 +00:00
Benjamin Otte 67a4279d3f rendernode: Put typedef into gsktypes.h
Makes includes simpler for headers that want to use GskRenderNode.
2023-08-12 23:13:47 +02:00
Benjamin Otte dd4b8a4c89 gl: Pass swizzle array directly
There's no need to pass pointers to arrays, as arrays are already
pointers.
2023-08-12 23:13:23 +02:00
Benjamin Otte 4cc5a54da3 viewport: Fix leak
Fixes #6002
2023-08-12 23:13:23 +02:00
Benjamin Otte 07add0144e columnview: Fix refcounting woes
The new code did not deal with the GtkScrollInfo properly.

Related: #6002
2023-08-12 23:13:23 +02:00
Benjamin Otte d1c7376b05 gdkcontext: Make has_unpack_subimage() do the version check
Makes the code look simpler when we actually use that function.
2023-08-12 23:13:23 +02:00
Benjamin Otte a71388d2d6 treeviewcolumn: Set ascending class for ascending order
The alternative button order confused the code and so the "ascending"
class was set for descending order by default, not when alternate order
is set.
2023-08-12 23:13:23 +02:00
Matthias Clasen 62176a3bd0 tools: Add gtk4-path-tool
This comes in handy for testing, among other things.

For now, this supports decomposing, reversing, rendering,
info and preview.
2023-08-12 16:34:19 -04:00
Bilal Elmoussaoui 8475a29836 docs: Drop uneeded ` in gi-docgen links
Causes the rust docs to fail parsing those as links
2023-08-12 22:26:25 +02:00
Matthias Clasen 44bc5a139c Add rounded rects to the tests 2023-08-12 16:09:31 -04:00
Matthias Clasen 11f48f3c5b Add gsk_path_builder_add_rounded_rect
For now, this is using gsk_path_builder_svg_arc_to
to approximate elliptical arcs.
2023-08-12 15:34:54 -04:00
Matthias Clasen fa4ad1590d Merge branch 'matthiasc/for-main' into 'main'
path: Some documentation improvements

See merge request GNOME/gtk!6273
2023-08-11 16:42:25 +00:00
Matthias Clasen 47ddc742fc path: Some documentation improvements
Among other things, add a quick summary of
SVG path syntax, and add a few illustrations.
2023-08-11 12:09:12 -04:00
Matthias Clasen 31d994837b Merge branch 'path-tests-3' into 'main'
path builder: Fix add_cairo_path

Closes #6011

See merge request GNOME/gtk!6270
2023-08-11 12:44:00 +00:00
Matthias Clasen 83d692e2d3 path: Add tests for gsk_path_builder_add methods
Check that they all end the current contour.

Fixes: #6011
2023-08-11 07:24:19 -04:00
Qiu Wenbo 2a96dde115 macos: use NSPopUpButton for filter selection in native filechooser
On macOS 14, NSComboBox can't popup the dropdown list of filters. That
makes native filechooser on macOS completed broken. And NSComboBox is
more complex since it is a widget focused on edit capability.
NSPopUpButton is more suitable for plain selectable dropdown list.

Fixes: 4986

Signed-off-by: Qiu Wenbo <qiuwenbo@kylinos.com.cn>
2023-08-11 16:19:48 +08:00
Qiu Wenbo f55b3c68ad filefilter: fix UTI type conversion on macOS
GContentType on macOS switched to UTI since glib 2.51. We should not assume it as MIME type anymore.

Fixes: #4986

Signed-off-by: Qiu Wenbo <qiuwenbo@kylinos.com.cn>
2023-08-11 16:19:38 +08:00
Matthias Clasen f2835bb48b pathbuilder: Treat current point consistently
Arrange that none of the 'add' methods change
the current point.
2023-08-10 22:56:47 -04:00
Fran Dieguez 857c22db32 Update Galician translation 2023-08-11 00:35:58 +00:00
Matthias Clasen fff1645060 path builder: Fix add_cairo_path
We were forgetting to end the current contour.
2023-08-10 16:08:32 -04:00
Matthias Clasen 4f0c3c81fb Merge branch 'matthiasc/for-main' into 'main'
Matthiasc/for main

See merge request GNOME/gtk!6269
2023-08-10 04:28:26 +00:00
Matthias Clasen 421365cfc3 Add more path point tests 2023-08-09 23:55:08 -04:00
Matthias Clasen 59c5b41f3d Cosmetics 2023-08-09 23:48:50 -04:00
Matthias Clasen 267367355f Merge branch 'path-fill-tests2' into 'main'
Add more path fill tests

See merge request GNOME/gtk!6268
2023-08-10 03:10:14 +00:00
Matthias Clasen 0aa3356499 Add more path fill tests
These also used to live with measure tests.
2023-08-09 22:47:13 -04:00
Matthias Clasen 14a3b35333 Merge branch 'path-fill-tests' into 'main'
Add path fill tests

See merge request GNOME/gtk!6267
2023-08-10 02:21:34 +00:00
Matthias Clasen 77def95659 Add path fill tests
These used to live with the measure tests, but
path_in_fill no longer involves a measure.
2023-08-09 21:50:29 -04:00
Matthias Clasen 4e91cd1155 Merge branch 'matthiasc/for-main' into 'main'
pathpoint: Use the right type

See merge request GNOME/gtk!6266
2023-08-09 20:37:14 +00:00
Matthias Clasen 2d923d362f Merge branch 'bilelmoussaoui/gi-gsk' into 'main'
gsk/gi: new Path api fixes

See merge request GNOME/gtk!6265
2023-08-09 19:40:53 +00:00
Matthias Clasen b7544636d4 contour: Skip the move
When jumping between segments, we always
need to skip index 0, since thats the move.

This fixes the tangent checks in the
rectangle tests.
2023-08-09 15:12:58 -04:00
Matthias Clasen 6220baf230 get_closest_point: Prefer earlier points
Only switch to a later point if it is strictly
closer than the existing match. This fixes
start- vs endpoint confusion in the rectangle
tests.
2023-08-09 15:12:52 -04:00
Matthias Clasen 917307a6a4 pathpoint: Use the right type 2023-08-09 14:37:14 -04:00
Matthias Clasen 5f49b7b492 Merge branch 'matthiasc/for-main' into 'main'
pathpoint: Clarify docs

See merge request GNOME/gtk!6262
2023-08-09 18:36:05 +00:00
Bilal Elmoussaoui b03abea402 gsk: Don't change the GskRenderNodeType order
As we use their values to check that a node can be downcasted to a node
type in the Rust bindings
such change would break existing code
2023-08-09 20:26:46 +02:00
Bilal Elmoussaoui d4fcc883cb gsk/gi: Add missing since annotations & docs 2023-08-09 20:26:46 +02:00
Daniel Boles ca2a2697d6 Merge branch 'dboles/for-main' into 'main'
docs: Add/fix some links; avoid pluralisation

See merge request GNOME/gtk!6261
2023-08-09 16:57:19 +00:00
Matthias Clasen 68c6f63e90 pathpoint: Clarify docs
Add a paragraph explaining the situation
for comparing the start- and endpoint of
a closed path.
2023-08-09 11:30:26 -04:00
Daniel Boles 0e89fed8ed docs: Add/fix some links; avoid pluralisation
Appending `s` breaks the [type@NS.Object] notation, so fix that in
ListHeader. Add links to ListItem and Overlay, and avoid appending `s`
after `backtick`s just for consistency with the [type@NS.Object] issue.
2023-08-09 15:35:12 +01:00
Benjamin Otte 4d726543d0 Merge branch 'path-for-merge-6' into 'main'
Simplify GskPathPoint

See merge request GNOME/gtk!6260
2023-08-09 14:24:33 +00:00
Matthias Clasen 2bcc998e90 Add tests for gsk_path_builder_add_segment
Test at least some of the special cases:
- start and end point on the same contour
- start and end point on the same segment
- end before start
2023-08-09 07:01:01 -04:00
Matthias Clasen f707185248 Add gsk_path_builder_add_segment
With GskPathPoint, we can subset paths without
a measure object.
2023-08-09 07:01:01 -04:00
Matthias Clasen ded30049db path: Add gsk_path_get_start/end_point
These are useful to have, now that we are
relying more on GskPathPoint in our api.
2023-08-08 22:05:34 -04:00
Matthias Clasen 5c55e9d11e Add gsk_path_point_equal/compare
These just make sense to have.
2023-08-08 22:05:34 -04:00
Matthias Clasen c35bb11c18 Simplify GskPathPoint
Use simple representation of just
{ contour index, segment index, t value }
2023-08-08 20:31:56 -04:00
Matthias Clasen cc19781d27 Merge branch 'cpdb-fix' into 'main'
print: Update printerprivate header location for cpdb backend

See merge request GNOME/gtk!6259
2023-08-08 23:01:12 +00:00
Jeremy Bícha 08d08678e8 print: Update printerprivate header location for cpdb backend
This fixes the print-cpdb build option
2023-08-08 17:55:54 -04:00
Matthias Clasen 11b632a691 Merge branch 'timezone' into 'main'
test-calendar: Update timezone name

See merge request GNOME/gtk!6258
2023-08-08 19:31:31 +00:00
Jeremy Bícha 4881ef251e test-calendar: Update timezone name
Debian no longer provides the MET timezone
but instead provides geographical region and city name
2023-08-08 15:01:42 -04:00
Luca Bacci 5b39abd1a4 Merge branch 'fix-server-side-decorations' into 'main'
win32: Fix minimize and maximize buttons missing on ssd

Closes #5142

See merge request GNOME/gtk!6052
2023-08-08 15:17:09 +00:00
Daniel Mustieles f0089097dd Update Spanish translation 2023-08-08 10:41:17 +00:00
Fran Dieguez d603925ab2 Update Galician translation 2023-08-08 00:05:18 +00:00
dgsasha 5240d8cdf5 win32: Fix minimize and maximize buttons missing on ssd
Completely fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5142
2023-06-10 23:08:21 -04:00
100 changed files with 12133 additions and 5373 deletions
+9
View File
@@ -336,6 +336,8 @@
<file>panes.c</file>
<file>password_entry.c</file>
<file>path_fill.c</file>
<file>path_walk.c</file>
<file>path_text.c</file>
<file>peg_solitaire.c</file>
<file>pickers.c</file>
<file>printing.c</file>
@@ -421,6 +423,13 @@
<gresource prefix="/fontrendering">
<file>fontrendering.ui</file>
</gresource>
<gresource prefix="/path_walk">
<file>path_walk.ui</file>
<file compressed="true">path_world.txt</file>
</gresource>
<gresource prefix="/path_text">
<file>path_text.ui</file>
</gresource>
<gresource prefix="/org/gtk/Demo4">
<file>icons/16x16/actions/application-exit.png</file>
<file>icons/16x16/actions/document-new.png</file>
+2
View File
@@ -73,6 +73,8 @@ demos = files([
'panes.c',
'password_entry.c',
'path_fill.c',
'path_walk.c',
'path_text.c',
'peg_solitaire.c',
'pickers.c',
'printing.c',
+568
View File
@@ -0,0 +1,568 @@
/* Path/Text
*
* This demo shows how to use GskPath to transform a path along another path.
*/
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#define GTK_TYPE_PATH_WIDGET (gtk_path_widget_get_type ())
G_DECLARE_FINAL_TYPE (GtkPathWidget, gtk_path_widget, GTK, PATH_WIDGET, GtkWidget)
#define POINT_SIZE 8
enum {
PROP_0,
PROP_TEXT,
PROP_EDITABLE,
N_PROPS
};
struct _GtkPathWidget
{
GtkWidget parent_instance;
char *text;
gboolean editable;
graphene_point_t points[4];
guint active_point;
GskPath *line_path;
GskPath *text_path;
GdkPaintable *background;
};
struct _GtkPathWidgetClass
{
GtkWidgetClass parent_class;
};
static GParamSpec *properties[N_PROPS] = { NULL, };
G_DEFINE_TYPE (GtkPathWidget, gtk_path_widget, GTK_TYPE_WIDGET)
static GskPath *
create_path_from_text (GtkWidget *widget,
const char *text,
graphene_point_t *out_offset)
{
PangoLayout *layout;
PangoFontDescription *desc;
GskPathBuilder *builder;
GskPath *result;
layout = gtk_widget_create_pango_layout (widget, text);
desc = pango_font_description_from_string ("sans bold 36");
pango_layout_set_font_description (layout, desc);
pango_font_description_free (desc);
builder = gsk_path_builder_new ();
gsk_path_builder_add_layout (builder, layout);
result = gsk_path_builder_free_to_path (builder);
if (out_offset)
graphene_point_init (out_offset, 0, - pango_layout_get_baseline (layout) / (double) PANGO_SCALE);
g_object_unref (layout);
return result;
}
typedef struct
{
GskPath *path;
GskPathBuilder *builder;
graphene_point_t offset;
double scale;
} GtkPathTransform;
static void
gtk_path_transform_point (GskPath *path,
const graphene_point_t *pt,
const graphene_point_t *offset,
float scale,
graphene_point_t *res)
{
graphene_vec2_t tangent;
GskPathPoint point;
if (gsk_path_get_point (path, (pt->x + offset->x) * scale, &point))
{
gsk_path_point_get_position (&point, path, res);
gsk_path_point_get_tangent (&point, path, GSK_PATH_TO_END, &tangent);
res->x -= (pt->y + offset->y) * scale * graphene_vec2_get_y (&tangent);
res->y += (pt->y + offset->y) * scale * graphene_vec2_get_x (&tangent);
}
}
static gboolean
gtk_path_transform_op (GskPathOperation op,
const graphene_point_t *pts,
gsize n_pts,
gpointer data)
{
GtkPathTransform *transform = data;
switch (op)
{
case GSK_PATH_MOVE:
{
graphene_point_t res;
gtk_path_transform_point (transform->path, &pts[0], &transform->offset, transform->scale, &res);
gsk_path_builder_move_to (transform->builder, res.x, res.y);
}
break;
case GSK_PATH_LINE:
{
graphene_point_t res;
gtk_path_transform_point (transform->path, &pts[1], &transform->offset, transform->scale, &res);
gsk_path_builder_line_to (transform->builder, res.x, res.y);
}
break;
case GSK_PATH_QUAD:
{
graphene_point_t res[2];
gtk_path_transform_point (transform->path, &pts[1], &transform->offset, transform->scale, &res[0]);
gtk_path_transform_point (transform->path, &pts[2], &transform->offset, transform->scale, &res[1]);
gsk_path_builder_quad_to (transform->builder, res[0].x, res[0].y, res[1].x, res[1].y);
}
break;
case GSK_PATH_CUBIC:
{
graphene_point_t res[3];
gtk_path_transform_point (transform->path, &pts[1], &transform->offset, transform->scale, &res[0]);
gtk_path_transform_point (transform->path, &pts[2], &transform->offset, transform->scale, &res[1]);
gtk_path_transform_point (transform->path, &pts[3], &transform->offset, transform->scale, &res[2]);
gsk_path_builder_cubic_to (transform->builder, res[0].x, res[0].y, res[1].x, res[1].y, res[2].x, res[2].y);
}
break;
case GSK_PATH_CLOSE:
gsk_path_builder_close (transform->builder);
break;
default:
g_assert_not_reached();
return FALSE;
}
return TRUE;
}
static GskPath *
gtk_path_transform (GskPath *line_path,
GskPath *path,
const graphene_point_t *offset)
{
GtkPathTransform transform = { line_path, gsk_path_builder_new (), *offset };
graphene_rect_t bounds;
gsk_path_get_bounds (path, &bounds);
if (bounds.origin.x + bounds.size.width > 0)
transform.scale = gsk_path_get_length (line_path) / (bounds.origin.x + bounds.size.width);
else
transform.scale = 1.0f;
gsk_path_foreach (path, -1, gtk_path_transform_op, &transform);
return gsk_path_builder_free_to_path (transform.builder);
}
static void
gtk_path_widget_clear_text_path (GtkPathWidget *self)
{
g_clear_pointer (&self->text_path, gsk_path_unref);
}
static void
gtk_path_widget_clear_paths (GtkPathWidget *self)
{
gtk_path_widget_clear_text_path (self);
g_clear_pointer (&self->line_path, gsk_path_unref);
}
static void
gtk_path_widget_create_text_path (GtkPathWidget *self)
{
GskPath *path;
graphene_point_t offset;
gtk_path_widget_clear_text_path (self);
path = create_path_from_text (GTK_WIDGET (self), self->text, &offset);
self->text_path = gtk_path_transform (self->line_path, path, &offset);
gsk_path_unref (path);
}
static void
gtk_path_widget_create_paths (GtkPathWidget *self)
{
double width = gtk_widget_get_width (GTK_WIDGET (self));
double height = gtk_widget_get_height (GTK_WIDGET (self));
GskPathBuilder *builder;
gtk_path_widget_clear_paths (self);
if (width <= 0 || height <= 0)
return;
builder = gsk_path_builder_new ();
gsk_path_builder_move_to (builder,
self->points[0].x * width, self->points[0].y * height);
gsk_path_builder_cubic_to (builder,
self->points[1].x * width, self->points[1].y * height,
self->points[2].x * width, self->points[2].y * height,
self->points[3].x * width, self->points[3].y * height);
self->line_path = gsk_path_builder_free_to_path (builder);
gtk_path_widget_create_text_path (self);
}
static void
gtk_path_widget_allocate (GtkWidget *widget,
int width,
int height,
int baseline)
{
GtkPathWidget *self = GTK_PATH_WIDGET (widget);
GTK_WIDGET_CLASS (gtk_path_widget_parent_class)->size_allocate (widget, width, height, baseline);
gtk_path_widget_create_paths (self);
}
static void
gtk_path_widget_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot)
{
GtkPathWidget *self = GTK_PATH_WIDGET (widget);
double width = gtk_widget_get_width (widget);
double height = gtk_widget_get_height (widget);
GskPath *path;
GskStroke *stroke;
gsize i;
/* frosted glass the background */
gtk_snapshot_push_blur (snapshot, 100);
gdk_paintable_snapshot (self->background, snapshot, width, height);
gtk_snapshot_append_color (snapshot, &(GdkRGBA) { 1, 1, 1, 0.6 }, &GRAPHENE_RECT_INIT (0, 0, width, height));
gtk_snapshot_pop (snapshot);
/* draw the text */
if (self->text_path)
{
gtk_snapshot_push_fill (snapshot, self->text_path, GSK_FILL_RULE_WINDING);
gdk_paintable_snapshot (self->background, snapshot, width, height);
/* ... with an emboss effect */
stroke = gsk_stroke_new (2.0);
gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT(1, 1));
gtk_snapshot_push_stroke (snapshot, self->text_path, stroke);
gtk_snapshot_append_color (snapshot, &(GdkRGBA) { 0, 0, 0, 0.2 }, &GRAPHENE_RECT_INIT (0, 0, width, height));
gsk_stroke_free (stroke);
gtk_snapshot_pop (snapshot);
gtk_snapshot_pop (snapshot);
}
if (self->editable && self->line_path)
{
GskPathBuilder *builder;
/* draw the control line */
stroke = gsk_stroke_new (1.0);
gtk_snapshot_push_stroke (snapshot, self->line_path, stroke);
gsk_stroke_free (stroke);
gtk_snapshot_append_color (snapshot, &(GdkRGBA) { 0, 0, 0, 1 }, &GRAPHENE_RECT_INIT (0, 0, width, height));
gtk_snapshot_pop (snapshot);
/* draw the points */
builder = gsk_path_builder_new ();
for (i = 0; i < 4; i++)
{
gsk_path_builder_add_circle (builder, &GRAPHENE_POINT_INIT (self->points[i].x * width, self->points[i].y * height), POINT_SIZE);
}
path = gsk_path_builder_free_to_path (builder);
gtk_snapshot_push_fill (snapshot, path, GSK_FILL_RULE_WINDING);
gtk_snapshot_append_color (snapshot, &(GdkRGBA) { 1, 1, 1, 1 }, &GRAPHENE_RECT_INIT (0, 0, width, height));
gtk_snapshot_pop (snapshot);
stroke = gsk_stroke_new (1.0);
gtk_snapshot_push_stroke (snapshot, path, stroke);
gsk_stroke_free (stroke);
gtk_snapshot_append_color (snapshot, &(GdkRGBA) { 0, 0, 0, 1 }, &GRAPHENE_RECT_INIT (0, 0, width, height));
gtk_snapshot_pop (snapshot);
gsk_path_unref (path);
}
}
static void
gtk_path_widget_set_text (GtkPathWidget *self,
const char *text)
{
if (g_strcmp0 (self->text, text) == 0)
return;
g_free (self->text);
self->text = g_strdup (text);
gtk_path_widget_create_paths (self);
gtk_widget_queue_draw (GTK_WIDGET (self));
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_TEXT]);
}
static void
gtk_path_widget_set_editable (GtkPathWidget *self,
gboolean editable)
{
if (self->editable == editable)
return;
self->editable = editable;
gtk_widget_queue_draw (GTK_WIDGET (self));
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_EDITABLE]);
}
static void
gtk_path_widget_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
GtkPathWidget *self = GTK_PATH_WIDGET (object);
switch (prop_id)
{
case PROP_TEXT:
gtk_path_widget_set_text (self, g_value_get_string (value));
break;
case PROP_EDITABLE:
gtk_path_widget_set_editable (self, g_value_get_boolean (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gtk_path_widget_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
GtkPathWidget *self = GTK_PATH_WIDGET (object);
switch (prop_id)
{
case PROP_TEXT:
g_value_set_string (value, self->text);
break;
case PROP_EDITABLE:
g_value_set_boolean (value, self->editable);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gtk_path_widget_dispose (GObject *object)
{
GtkPathWidget *self = GTK_PATH_WIDGET (object);
gtk_path_widget_clear_paths (self);
G_OBJECT_CLASS (gtk_path_widget_parent_class)->dispose (object);
}
static void
gtk_path_widget_class_init (GtkPathWidgetClass *klass)
{
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->dispose = gtk_path_widget_dispose;
object_class->set_property = gtk_path_widget_set_property;
object_class->get_property = gtk_path_widget_get_property;
widget_class->size_allocate = gtk_path_widget_allocate;
widget_class->snapshot = gtk_path_widget_snapshot;
properties[PROP_TEXT] =
g_param_spec_string ("text",
"text",
"Text transformed along a path",
NULL,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
properties[PROP_EDITABLE] =
g_param_spec_boolean ("editable",
"editable",
"If the path can be edited by the user",
FALSE,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (object_class, N_PROPS, properties);
}
static void
drag_begin (GtkGestureDrag *gesture,
double x,
double y,
GtkPathWidget *self)
{
graphene_point_t mouse = GRAPHENE_POINT_INIT (x, y);
double width = gtk_widget_get_width (GTK_WIDGET (self));
double height = gtk_widget_get_height (GTK_WIDGET (self));
gsize i;
for (i = 0; i < 4; i++)
{
if (graphene_point_distance (&GRAPHENE_POINT_INIT (self->points[i].x * width, self->points[i].y * height), &mouse, NULL, NULL) <= POINT_SIZE)
{
self->active_point = i;
break;
}
}
if (i == 4)
{
gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_DENIED);
return;
}
gtk_widget_queue_draw (GTK_WIDGET (self));
}
static void
drag_update (GtkGestureDrag *drag,
double offset_x,
double offset_y,
GtkPathWidget *self)
{
double width = gtk_widget_get_width (GTK_WIDGET (self));
double height = gtk_widget_get_height (GTK_WIDGET (self));
double start_x, start_y;
gtk_gesture_drag_get_start_point (drag, &start_x, &start_y);
self->points[self->active_point] = GRAPHENE_POINT_INIT ((start_x + offset_x) / width,
(start_y + offset_y) / height);
self->points[self->active_point].x = CLAMP (self->points[self->active_point].x, 0, 1);
self->points[self->active_point].y = CLAMP (self->points[self->active_point].y, 0, 1);
gtk_path_widget_create_paths (self);
gtk_widget_queue_draw (GTK_WIDGET (self));
}
static void
pointer_motion (GtkEventControllerMotion *controller,
double x,
double y,
GtkPathWidget *self)
{
GskPathPoint point;
graphene_point_t pos;
if (gsk_path_get_closest_point (self->line_path,
&GRAPHENE_POINT_INIT (x, y),
INFINITY,
&point))
{
gsk_path_point_get_position (&point, self->line_path, &pos);
gtk_widget_queue_draw (GTK_WIDGET (self));
}
}
static void
pointer_leave (GtkEventControllerMotion *controller,
GtkPathWidget *self)
{
gtk_widget_queue_draw (GTK_WIDGET (self));
}
static void
gtk_path_widget_init (GtkPathWidget *self)
{
GtkEventController *controller;
controller = GTK_EVENT_CONTROLLER (gtk_gesture_drag_new ());
g_signal_connect (controller, "drag-begin", G_CALLBACK (drag_begin), self);
g_signal_connect (controller, "drag-update", G_CALLBACK (drag_update), self);
g_signal_connect (controller, "drag-end", G_CALLBACK (drag_update), self);
gtk_widget_add_controller (GTK_WIDGET (self), controller);
controller = GTK_EVENT_CONTROLLER (gtk_event_controller_motion_new ());
g_signal_connect (controller, "enter", G_CALLBACK (pointer_motion), self);
g_signal_connect (controller, "motion", G_CALLBACK (pointer_motion), self);
g_signal_connect (controller, "leave", G_CALLBACK (pointer_leave), self);
gtk_widget_add_controller (GTK_WIDGET (self), controller);
self->points[0] = GRAPHENE_POINT_INIT (0.1, 0.9);
self->points[1] = GRAPHENE_POINT_INIT (0.3, 0.1);
self->points[2] = GRAPHENE_POINT_INIT (0.7, 0.1);
self->points[3] = GRAPHENE_POINT_INIT (0.9, 0.9);
self->background = GDK_PAINTABLE (gdk_texture_new_from_resource ("/sliding_puzzle/portland-rose.jpg"));
gtk_path_widget_set_text (self, "It's almost working");
}
GtkWidget *
gtk_path_widget_new (void)
{
GtkPathWidget *self;
self = g_object_new (GTK_TYPE_PATH_WIDGET, NULL);
return GTK_WIDGET (self);
}
GtkWidget *
do_path_text (GtkWidget *do_widget)
{
static GtkWidget *window = NULL;
if (!window)
{
GtkBuilder *builder;
g_type_ensure (GTK_TYPE_PATH_WIDGET);
builder = gtk_builder_new_from_resource ("/path_text/path_text.ui");
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *) &window);
g_object_unref (builder);
}
if (!gtk_widget_get_visible (window))
gtk_window_present (GTK_WINDOW (window));
else
gtk_window_destroy (GTK_WINDOW (window));
return window;
}
+38
View File
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkWindow" id="window">
<property name="title" translatable="yes">Text along a Path</property>
<child type="titlebar">
<object class="GtkHeaderBar">
<child type="end">
<object class="GtkToggleButton" id="edit-toggle">
<property name="icon-name">document-edit-symbolic</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkRevealer">
<property name="reveal-child" bind-source="edit-toggle" bind-property="active" bind-flags="sync-create"></property>
<child>
<object class="GtkEntry" id="text">
<property name="text">Through the looking glass</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkPathWidget" id="view">
<property name="editable" bind-source="edit-toggle" bind-property="active" bind-flags="sync-create"></property>
<property name="text" bind-source="text" bind-property="text" bind-flags="sync-create"></property>
<property name="hexpand">true</property>
<property name="vexpand">true</property>
</object>
</child>
</object>
</child>
</object>
</interface>
+370
View File
@@ -0,0 +1,370 @@
/* Path/Walk
*
* This demo draws a world map and shows how to animate objects along a GskPath.
*
* The world map that is used here is a path with 211 lines and 1569 cubic
* Bėzier segments in 121 contours.
*/
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#define GTK_TYPE_PATH_WALK (gtk_path_walk_get_type ())
G_DECLARE_FINAL_TYPE (GtkPathWalk, gtk_path_walk, GTK, PATH_WALK, GtkWidget)
#define POINT_SIZE 8
enum {
PROP_0,
PROP_N_POINTS,
PROP_PATH,
N_PROPS
};
struct _GtkPathWalk
{
GtkWidget parent_instance;
GskPath *path;
graphene_rect_t bounds;
GskPath *arrow_path;
guint n_points;
};
struct _GtkPathWalkClass
{
GtkWidgetClass parent_class;
};
static GParamSpec *properties[N_PROPS] = { NULL, };
G_DEFINE_TYPE (GtkPathWalk, gtk_path_walk, GTK_TYPE_WIDGET)
static void
rgba_init_from_hsla (GdkRGBA *rgba,
float hue,
float saturation,
float lightness,
float alpha)
{
float m1, m2;
if (lightness <= 0.5)
m2 = lightness * (1 + saturation);
else
m2 = lightness + saturation - lightness * saturation;
m1 = 2 * lightness - m2;
rgba->alpha = alpha;
if (saturation == 0)
{
rgba->red = lightness;
rgba->green = lightness;
rgba->blue = lightness;
}
else
{
hue = hue + 120;
while (hue > 360)
hue -= 360;
while (hue < 0)
hue += 360;
if (hue < 60)
rgba->red = m1 + (m2 - m1) * hue / 60;
else if (hue < 180)
rgba->red = m2;
else if (hue < 240)
rgba->red = m1 + (m2 - m1) * (240 - hue) / 60;
else
rgba->red = m1;
hue -= 120;
if (hue < 0)
hue += 360;
if (hue < 60)
rgba->green = m1 + (m2 - m1) * hue / 60;
else if (hue < 180)
rgba->green = m2;
else if (hue < 240)
rgba->green = m1 + (m2 - m1) * (240 - hue) / 60;
else
rgba->green = m1;
hue -= 120;
if (hue < 0)
hue += 360;
if (hue < 60)
rgba->blue = m1 + (m2 - m1) * hue / 60;
else if (hue < 180)
rgba->blue = m2;
else if (hue < 240)
rgba->blue = m1 + (m2 - m1) * (240 - hue) / 60;
else
rgba->blue = m1;
}
}
static void
gtk_path_walk_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot)
{
GtkPathWalk *self = GTK_PATH_WALK (widget);
double width = gtk_widget_get_width (widget);
double height = gtk_widget_get_height (widget);
float length, progress;
GskStroke *stroke;
guint i;
if (self->path == NULL)
return;
gtk_snapshot_save (snapshot);
stroke = gsk_stroke_new (2.0);
gtk_snapshot_push_stroke (snapshot, self->path, stroke);
gtk_snapshot_append_color (snapshot, &(GdkRGBA) { 0, 0, 0, 1 }, &GRAPHENE_RECT_INIT (0, 0, width, height));
gtk_snapshot_pop (snapshot);
gsk_stroke_free (stroke);
length = gsk_path_get_length (self->path);
progress = 25.f * gdk_frame_clock_get_frame_time (gtk_widget_get_frame_clock (widget)) / G_USEC_PER_SEC;
stroke = gsk_stroke_new (1.0);
for (i = 0; i < self->n_points; i++)
{
GskPathPoint point;
graphene_point_t position;
float angle;
GdkRGBA color;
float distance;
distance = i * length / self->n_points;
distance = fmod (distance + progress, length);
gsk_path_get_point (self->path, distance, &point);
gsk_path_point_get_position (&point, self->path, &position);
angle = gsk_path_point_get_rotation (&point, self->path, GSK_PATH_FROM_START);
rgba_init_from_hsla (&color, 360.f * i / self->n_points, 1, 0.5, 1);
gtk_snapshot_save (snapshot);
gtk_snapshot_translate (snapshot, &position);
gtk_snapshot_rotate (snapshot, angle);
gtk_snapshot_append_fill (snapshot, self->arrow_path, GSK_FILL_RULE_EVEN_ODD, &color);
gtk_snapshot_append_stroke (snapshot, self->arrow_path, stroke, &(GdkRGBA) { 0, 0, 0, 1 });
gtk_snapshot_restore (snapshot);
}
gsk_stroke_free (stroke);
gtk_snapshot_restore (snapshot);
}
static void
gtk_path_walk_measure (GtkWidget *widget,
GtkOrientation orientation,
int for_size,
int *minimum,
int *natural,
int *minimum_baseline,
int *natural_baseline)
{
GtkPathWalk *self = GTK_PATH_WALK (widget);
if (orientation == GTK_ORIENTATION_HORIZONTAL)
*minimum = *natural = (int) ceilf (self->bounds.size.width);
else
*minimum = *natural = (int) ceilf (self->bounds.size.height);
}
static void
gtk_path_walk_set_n_points (GtkPathWalk *self,
gsize n_points)
{
if (self->n_points == n_points)
return;
self->n_points = n_points;
gtk_widget_queue_draw (GTK_WIDGET (self));
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_N_POINTS]);
}
static void
gtk_path_walk_set_path (GtkPathWalk *self,
GskPath *path)
{
if (self->path == path)
return;
g_clear_pointer (&self->path, gsk_path_unref);
graphene_rect_init (&self->bounds, 0, 0, 0, 0);
if (path)
{
GskStroke *stroke;
self->path = gsk_path_ref (path);
stroke = gsk_stroke_new (2.0);
gsk_path_get_stroke_bounds (path, stroke, &self->bounds);
gsk_stroke_free (stroke);
}
gtk_widget_queue_resize (GTK_WIDGET (self));
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_PATH]);
}
static void
gtk_path_walk_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
GtkPathWalk *self = GTK_PATH_WALK (object);
switch (prop_id)
{
case PROP_N_POINTS:
gtk_path_walk_set_n_points (self, g_value_get_uint (value));
break;
case PROP_PATH:
gtk_path_walk_set_path (self, g_value_get_boxed (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gtk_path_walk_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
GtkPathWalk *self = GTK_PATH_WALK (object);
switch (prop_id)
{
case PROP_N_POINTS:
g_value_set_uint (value, self->n_points);
break;
case PROP_PATH:
g_value_set_boxed (value, self->path);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gtk_path_walk_dispose (GObject *object)
{
GtkPathWalk *self = GTK_PATH_WALK (object);
g_clear_pointer (&self->path, gsk_path_unref);
g_clear_pointer (&self->arrow_path, gsk_path_unref);
G_OBJECT_CLASS (gtk_path_walk_parent_class)->dispose (object);
}
static void
gtk_path_walk_class_init (GtkPathWalkClass *klass)
{
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->dispose = gtk_path_walk_dispose;
object_class->set_property = gtk_path_walk_set_property;
object_class->get_property = gtk_path_walk_get_property;
widget_class->snapshot = gtk_path_walk_snapshot;
widget_class->measure = gtk_path_walk_measure;
properties[PROP_N_POINTS] =
g_param_spec_uint ("n-points",
NULL, NULL,
1, G_MAXUINT,
500,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
properties[PROP_PATH] =
g_param_spec_boxed ("path",
NULL, NULL,
GSK_TYPE_PATH,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (object_class, N_PROPS, properties);
}
static gboolean
tick_tick_tick (GtkWidget *self,
GdkFrameClock *frame_clock,
gpointer unused)
{
gtk_widget_queue_draw (GTK_WIDGET (self));
return G_SOURCE_CONTINUE;
}
static void
gtk_path_walk_init (GtkPathWalk *self)
{
/* Data taken from
* https://commons.wikimedia.org/wiki/Maps_of_the_world#/media/File:Simplified_blank_world_map_without_Antartica_(no_borders).svg
*/
GBytes *data = g_resources_lookup_data ("/path_walk/path_world.txt", 0, NULL);
GskPath *path = gsk_path_parse (g_bytes_get_data (data, NULL));
g_bytes_unref (data);
gtk_path_walk_set_path (self, path);
gsk_path_unref (path);
self->arrow_path = gsk_path_parse ("M 5 0 L 0 -5. 0 -2, -5 -2, -5 2, 0 2, 0 5 Z");
self->n_points = 500;
gtk_widget_add_tick_callback (GTK_WIDGET (self), tick_tick_tick, NULL, NULL);
}
GtkWidget *
gtk_path_walk_new (void)
{
GtkPathWalk *self;
self = g_object_new (GTK_TYPE_PATH_WALK, NULL);
return GTK_WIDGET (self);
}
GtkWidget *
do_path_walk (GtkWidget *do_widget)
{
static GtkWidget *window = NULL;
if (!window)
{
GtkBuilder *builder;
g_type_ensure (GTK_TYPE_PATH_WALK);
builder = gtk_builder_new_from_resource ("/path_walk/path_walk.ui");
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *) &window);
g_object_unref (builder);
}
if (!gtk_widget_get_visible (window))
gtk_window_present (GTK_WINDOW (window));
else
gtk_window_destroy (GTK_WINDOW (window));
return window;
}
+33
View File
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkWindow" id="window">
<property name="title" translatable="yes">World Map</property>
<property name="titlebar">
<object class="GtkHeaderBar">
<child type="end">
<object class="GtkSpinButton">
<property name="adjustment">
<object class="GtkAdjustment" id="adjustment">
<property name="lower">0</property>
<property name="upper">2000</property>
<property name="value">500</property>
</object>
</property>
</object>
</child>
</object>
</property>
<property name="child">
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkPathWalk" id="view">
<property name="n-points" bind-source="adjustment" bind-property="value"/>
<property name="hexpand">true</property>
<property name="vexpand">true</property>
</object>
</child>
</object>
</property>
</object>
</interface>
File diff suppressed because one or more lines are too long
+8
View File
@@ -34,5 +34,13 @@ base_url = "https://gitlab.gnome.org/GNOME/gtk/-/blob/main/"
[extra]
content_images = [
"gtk-logo.svg",
"images/caps-dark.png",
"images/caps-light.png",
"images/directions-dark.png",
"images/directions-light.png",
"images/join-dark.png",
"images/join-light.png",
"images/path-dark.png",
"images/path-light.png",
]
urlmap_file = "urlmap.js"
Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

+81
View File
@@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="210mm"
height="297mm"
viewBox="0 0 210 297"
version="1.1"
id="svg1"
inkscape:version="1.3 (0e150ed6c4, 2023-07-21)"
sodipodi:docname="caps.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview1"
pagecolor="#ffffff"
bordercolor="#000000"
borderopacity="0.25"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:document-units="mm"
inkscape:zoom="2.1493149"
inkscape:cx="438.74445"
inkscape:cy="288.69664"
inkscape:window-width="1920"
inkscape:window-height="1123"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="layer1" />
<defs
id="defs1">
<linearGradient
id="swatch1"
inkscape:swatch="solid">
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop1" />
</linearGradient>
</defs>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<path
style="fill:none;stroke:#000064;stroke-width:1;stroke-miterlimit:0;stroke-dasharray:none"
d="m 73.096455,77.084329 c 0,0 6.439436,18.711677 18.172676,26.635721"
id="path1"
sodipodi:nodetypes="cc" />
<path
style="color:#000000;fill:none;stroke:#000064;stroke-width:0.2;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
d="m 94.214979,99.722163 c -4.705477,-3.177832 -9.013472,-9.233699 -11.888672,-14.531169 -2.8752,-5.29748 -4.353516,-9.587833 -4.353516,-9.587833 L 68.51576,78.85704 c 0,0 1.743663,5.064163 5.021484,11.103457 3.277822,6.039297 8.05428,13.302573 15.082031,18.048773"
id="path1-1"
sodipodi:nodetypes="csccsc" />
<path
style="fill:none;stroke:#000064;stroke-width:1;stroke-miterlimit:0;stroke-dasharray:none"
d="m 112.14213,75.736452 c 0,0 6.43944,18.711675 18.17268,26.635728"
id="path1-4"
sodipodi:nodetypes="cc" />
<path
style="color:#000000;fill:none;stroke:#000064;stroke-width:0.2;stroke-linecap:round;stroke-miterlimit:0;stroke-dasharray:none;stroke-opacity:1"
d="m 132.83284,98.590758 c -4.70551,-3.177807 -9.01347,-9.233742 -11.88867,-14.53125 -2.8752,-5.297508 -4.35351,-9.587891 -4.35351,-9.587891 -0.89828,-2.611719 -3.74396,-4.000453 -6.35547,-3.101562 -2.61172,0.898277 -4.00046,3.743958 -3.10157,6.355468 0,0 1.74367,5.064185 5.02149,11.103516 3.27782,6.039331 8.05428,13.302641 15.08203,18.048851"
id="path1-4-5"
sodipodi:nodetypes="cscccsc" />
<path
style="fill:none;stroke:#000064;stroke-width:1;stroke-miterlimit:0;stroke-dasharray:none"
d="m 154.10911,73.84561 c 0,0 6.43943,18.711677 18.17267,26.63572"
id="path1-0"
sodipodi:nodetypes="cc" />
<path
style="color:#000000;fill:none;stroke:#000064;stroke-width:0.2;stroke-linecap:square;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
d="M 175.16683,96.47344 C 170.46135,93.295592 166.1514,87.239699 163.2762,81.94219 160.401,76.644682 158.92269,72.3543 158.92269,72.3543 l -1.62696,-4.728516 -9.45508,3.253906 1.62696,4.728516 c 0,0 1.74171,5.066138 5.01953,11.105469 3.27782,6.039331 8.05428,13.300675 15.08203,18.046895"
id="path1-4-1"
sodipodi:nodetypes="csccccsc" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

+328
View File
@@ -0,0 +1,328 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="210mm"
height="297mm"
viewBox="0 0 210 297"
version="1.1"
id="svg1"
inkscape:version="1.3 (0e150ed6c4, 2023-07-21)"
sodipodi:docname="directions.svg"
inkscape:export-filename="directions-light.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview1"
pagecolor="#ffffff"
bordercolor="#000000"
borderopacity="0.25"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:document-units="mm"
inkscape:zoom="1.0746575"
inkscape:cx="371.28108"
inkscape:cy="266.59657"
inkscape:window-width="1920"
inkscape:window-height="1123"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="layer1"
showgrid="false" />
<defs
id="defs1">
<marker
style="overflow:visible"
id="marker5"
refX="0"
refY="0"
orient="auto-start-reverse"
inkscape:stockid="Triangle arrow"
markerWidth="0.5"
markerHeight="0.5"
viewBox="0 0 1 1"
inkscape:isstock="true"
inkscape:collect="always"
preserveAspectRatio="xMidYMid">
<path
transform="scale(0.5)"
style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt"
d="M 5.77,0 -2.88,5 V -5 Z"
id="path5" />
</marker>
<marker
style="overflow:visible"
id="marker3"
refX="0"
refY="0"
orient="auto-start-reverse"
inkscape:stockid="Triangle arrow"
markerWidth="2"
markerHeight="2"
viewBox="0 0 1 1"
inkscape:isstock="true"
inkscape:collect="always"
preserveAspectRatio="xMidYMid">
<path
transform="scale(0.5)"
style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt"
d="M 5.77,0 -2.88,5 V -5 Z"
id="path3" />
</marker>
<marker
style="overflow:visible"
id="Triangle"
refX="0"
refY="0"
orient="auto-start-reverse"
inkscape:stockid="Triangle arrow"
markerWidth="2"
markerHeight="2"
viewBox="0 0 1 1"
inkscape:isstock="true"
inkscape:collect="always"
preserveAspectRatio="xMidYMid">
<path
transform="scale(0.5)"
style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt"
d="M 5.77,0 -2.88,5 V -5 Z"
id="path135" />
</marker>
<marker
style="overflow:visible"
id="marker3-8"
refX="0"
refY="0"
orient="auto-start-reverse"
inkscape:stockid="Triangle arrow"
markerWidth="2"
markerHeight="2"
viewBox="0 0 1 1"
inkscape:isstock="true"
inkscape:collect="always"
preserveAspectRatio="xMidYMid">
<path
transform="scale(0.5)"
style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt"
d="M 5.77,0 -2.88,5 V -5 Z"
id="path3-5" />
</marker>
<marker
style="overflow:visible"
id="Triangle-0"
refX="0"
refY="0"
orient="auto-start-reverse"
inkscape:stockid="Triangle arrow"
markerWidth="2"
markerHeight="2"
viewBox="0 0 1 1"
inkscape:isstock="true"
inkscape:collect="always"
preserveAspectRatio="xMidYMid">
<path
transform="scale(0.5)"
style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt"
d="M 5.77,0 -2.88,5 V -5 Z"
id="path135-9" />
</marker>
<marker
style="overflow:visible"
id="marker5-9"
refX="0"
refY="0"
orient="auto-start-reverse"
inkscape:stockid="Triangle arrow"
markerWidth="0.5"
markerHeight="0.5"
viewBox="0 0 1 1"
inkscape:isstock="true"
inkscape:collect="always"
preserveAspectRatio="xMidYMid">
<path
transform="scale(0.5)"
style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt"
d="M 5.77,0 -2.88,5 V -5 Z"
id="path5-8" />
</marker>
<marker
style="overflow:visible"
id="marker3-8-4"
refX="0"
refY="0"
orient="auto-start-reverse"
inkscape:stockid="Triangle arrow"
markerWidth="2"
markerHeight="2"
viewBox="0 0 1 1"
inkscape:isstock="true"
inkscape:collect="always"
preserveAspectRatio="xMidYMid">
<path
transform="scale(0.5)"
style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt"
d="M 5.77,0 -2.88,5 V -5 Z"
id="path3-5-4" />
</marker>
<marker
style="overflow:visible"
id="Triangle-0-7"
refX="0"
refY="0"
orient="auto-start-reverse"
inkscape:stockid="Triangle arrow"
markerWidth="2"
markerHeight="2"
viewBox="0 0 1 1"
inkscape:isstock="true"
inkscape:collect="always"
preserveAspectRatio="xMidYMid">
<path
transform="scale(0.5)"
style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt"
d="M 5.77,0 -2.88,5 V -5 Z"
id="path135-9-6" />
</marker>
</defs>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<path
style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:square;stroke-linejoin:bevel;stroke-miterlimit:10;marker-end:url(#marker5)"
d="m 27.834229,78.180655 c 21.653076,9.584156 38.648414,3.28592 57.704513,-16.91815 26.702288,3.84691 38.178308,6.290079 51.837088,35.267113"
id="path1"
sodipodi:nodetypes="ccc" />
<path
style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:square;stroke-linejoin:bevel;stroke-miterlimit:10;marker-end:url(#marker5-9)"
d="m 91.839025,170.91959 c -22.098283,1.18425 -24.17615,-37.34309 2.699778,-37.47998 20.898567,-0.10644 38.726427,9.19795 51.837087,35.26711"
id="path1-8"
sodipodi:nodetypes="csc" />
<path
style="fill:none;stroke:#000000;stroke-width:0.2;stroke-linecap:square;stroke-linejoin:bevel;stroke-miterlimit:10;stroke-dasharray:none;marker-start:url(#marker3);marker-end:url(#Triangle)"
d="M 52.087008,92.522138 119.92974,29.398044"
id="path2"
sodipodi:nodetypes="cc" />
<path
style="fill:none;stroke:#000000;stroke-width:0.2;stroke-linecap:square;stroke-linejoin:bevel;stroke-miterlimit:10;stroke-dasharray:none;marker-start:url(#marker3-8);marker-end:url(#Triangle-0)"
d="M 39.037646,53.839137 130.44855,69.048774"
id="path2-3"
sodipodi:nodetypes="cc"
inkscape:transform-center-x="-71.02355"
inkscape:transform-center-y="28.680447" />
<path
style="fill:none;stroke:#000000;stroke-width:0.2;stroke-linecap:square;stroke-linejoin:bevel;stroke-miterlimit:10;stroke-dasharray:none;marker-start:url(#marker3-8-4);marker-end:url(#Triangle-0-7)"
d="M 48.764932,133.73955 141.43055,133.1318"
id="path2-3-1"
sodipodi:nodetypes="cc"
inkscape:transform-center-x="-74.875204"
inkscape:transform-center-y="16.143612" />
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:300;font-stretch:normal;font-size:3.88055556px;font-family:Cantarell;-inkscape-font-specification:'Cantarell, Light';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.2;stroke-linecap:square;stroke-linejoin:bevel;stroke-miterlimit:10;stroke-dasharray:none"
x="99.90786"
y="24.737305"
id="text4"><tspan
sodipodi:role="line"
id="tspan4"
style="font-style:normal;font-variant:normal;font-weight:300;font-stretch:normal;font-size:3.88055556px;font-family:Cantarell;-inkscape-font-specification:'Cantarell, Light';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;fill:#000000;fill-opacity:1;stroke-width:0.2"
x="99.90786"
y="24.737305">GSK_PATH_FROM_START</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:300;font-stretch:normal;font-size:3.88056px;font-family:Cantarell;-inkscape-font-specification:'Cantarell, Light';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.2;stroke-linecap:square;stroke-linejoin:bevel;stroke-miterlimit:10;stroke-dasharray:none"
x="142.84389"
y="128.82414"
id="text4-5"><tspan
sodipodi:role="line"
id="tspan4-7"
style="font-style:normal;font-variant:normal;font-weight:300;font-stretch:normal;font-size:3.88056px;font-family:Cantarell;-inkscape-font-specification:'Cantarell, Light';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;fill:#000000;fill-opacity:1;stroke-width:0.2"
x="142.84389"
y="128.82414">GSK_PATH_FROM_START</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:300;font-stretch:normal;font-size:3.88055556px;font-family:Cantarell;-inkscape-font-specification:'Cantarell, Light';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.2;stroke-linecap:square;stroke-linejoin:bevel;stroke-miterlimit:10;stroke-dasharray:none"
x="29.309605"
y="100.65614"
id="text5"><tspan
sodipodi:role="line"
id="tspan5"
style="font-style:normal;font-variant:normal;font-weight:300;font-stretch:normal;font-size:3.88055556px;font-family:Cantarell;-inkscape-font-specification:'Cantarell, Light';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:0.2"
x="29.309605"
y="100.65614">GSK_PATH_TO_START</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:300;font-stretch:normal;font-size:3.88056px;font-family:Cantarell;-inkscape-font-specification:'Cantarell, Light';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.2;stroke-linecap:square;stroke-linejoin:bevel;stroke-miterlimit:10;stroke-dasharray:none"
x="14.843884"
y="141.82414"
id="text5-8"><tspan
sodipodi:role="line"
id="tspan5-8"
style="font-style:normal;font-variant:normal;font-weight:300;font-stretch:normal;font-size:3.88056px;font-family:Cantarell;-inkscape-font-specification:'Cantarell, Light';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:0.2"
x="14.843884"
y="141.82414">GSK_PATH_TO_START</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:300;font-stretch:normal;font-size:3.88056px;font-family:Cantarell;-inkscape-font-specification:'Cantarell, Light';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.2;stroke-linecap:square;stroke-linejoin:bevel;stroke-miterlimit:10;stroke-dasharray:none"
x="135.70834"
y="70.811882"
id="text6"><tspan
sodipodi:role="line"
id="tspan6"
style="font-style:normal;font-variant:normal;font-weight:300;font-stretch:normal;font-size:3.88056px;font-family:Cantarell;-inkscape-font-specification:'Cantarell, Light';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:0.2"
x="135.70834"
y="70.811882">GSK_PATH_TO_END</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:300;font-stretch:normal;font-size:3.88056px;font-family:Cantarell;-inkscape-font-specification:'Cantarell, Light';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.2;stroke-linecap:square;stroke-linejoin:bevel;stroke-miterlimit:10;stroke-dasharray:none"
x="142.84389"
y="141.82416"
id="text6-6"><tspan
sodipodi:role="line"
id="tspan6-2"
style="font-style:normal;font-variant:normal;font-weight:300;font-stretch:normal;font-size:3.88056px;font-family:Cantarell;-inkscape-font-specification:'Cantarell, Light';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:0.2"
x="142.84389"
y="141.82416">GSK_PATH_TO_END</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:300;font-stretch:normal;font-size:3.88056px;font-family:Cantarell;-inkscape-font-specification:'Cantarell, Light';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.2;stroke-linecap:square;stroke-linejoin:bevel;stroke-miterlimit:10;stroke-dasharray:none"
x="14.843884"
y="48.774254"
id="text7"><tspan
sodipodi:role="line"
id="tspan7"
style="font-style:normal;font-variant:normal;font-weight:300;font-stretch:normal;font-size:3.88056px;font-family:Cantarell;-inkscape-font-specification:'Cantarell, Light';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:0.2"
x="14.843884"
y="48.774254">GSK_PATH_FROM_END</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:300;font-stretch:normal;font-size:3.88056px;font-family:Cantarell;-inkscape-font-specification:'Cantarell, Light';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.2;stroke-linecap:square;stroke-linejoin:bevel;stroke-miterlimit:10;stroke-dasharray:none"
x="14.843884"
y="128.82414"
id="text7-5"><tspan
sodipodi:role="line"
id="tspan7-9"
style="font-style:normal;font-variant:normal;font-weight:300;font-stretch:normal;font-size:3.88056px;font-family:Cantarell;-inkscape-font-specification:'Cantarell, Light';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:0.2"
x="14.843884"
y="128.82414">GSK_PATH_FROM_END</tspan></text>
<circle
style="fill:#ff0404;fill-opacity:1;stroke:#000000;stroke-width:0.2;stroke-linecap:square;stroke-linejoin:bevel;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
id="path2-8-9-7"
cx="85.343727"
cy="61.691891"
r="1.5" />
<circle
style="fill:#ff0404;fill-opacity:1;stroke:#000000;stroke-width:0.2;stroke-linecap:square;stroke-linejoin:bevel;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
id="path2-8-9-7-0"
cx="93.787331"
cy="133.30902"
r="1.5" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

+72
View File
@@ -0,0 +1,72 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="210mm"
height="297mm"
viewBox="0 0 210 297"
version="1.1"
id="svg1"
inkscape:version="1.3 (0e150ed6c4, 2023-07-21)"
sodipodi:docname="join.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview1"
pagecolor="#ffffff"
bordercolor="#000000"
borderopacity="0.25"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:document-units="mm"
inkscape:zoom="0.75989759"
inkscape:cx="118.43701"
inkscape:cy="570.47161"
inkscape:window-width="1920"
inkscape:window-height="1123"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="layer1" />
<defs
id="defs1" />
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<path
style="fill:none;stroke:#000064;stroke-width:1;stroke-linecap:square;stroke-miterlimit:10;stroke-dasharray:none"
d="m 12.748727,122.15935 c 4.449842,-15.44496 4.175632,-15.92044 16.908788,-26.568585 0,0 8.478091,16.421195 35.150804,33.660325"
id="path1"
sodipodi:nodetypes="ccc" />
<path
style="color:#000000;fill:none;stroke:#000064;stroke-width:0.2;stroke-linecap:square;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
d="m 17.59375,123.72266 c 3.810222,-13.2249 3.591775,-14.13123 11.107422,-20.53516 1.289688,1.82186 2.604788,3.71164 4.800781,6.23242 5.743296,6.59272 14.891452,15.32766 28.632813,24.20899 M 67.5625,125.23047 C 54.631174,116.87268 46.204933,108.77726 41.041016,102.84961 35.877098,96.921954 34.140625,93.474609 34.140625,93.474609 l -2.861328,-5.544922 -4.789063,4.003907 C 13.673794,102.6514 12.411529,105.58692 7.984375,120.95313"
id="path1-3"
sodipodi:nodetypes="ccsccscccc" />
<path
style="fill:none;stroke:#000064;stroke-width:1;stroke-linecap:square;stroke-miterlimit:10;stroke-dasharray:none"
d="m 147.99215,122.60257 c 4.44988,-15.44499 4.17566,-15.92048 16.90889,-26.568657 0,0 8.47814,16.421267 35.15101,33.660397"
id="path1-5"
sodipodi:nodetypes="ccc" />
<path
style="color:#000000;fill:none;stroke:#000064;stroke-width:0.2;stroke-linecap:square;stroke-linejoin:bevel;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
d="m 152.79687,123.98633 c 3.81053,-13.22586 3.59005,-14.12993 11.10743,-20.53516 1.28968,1.82184 2.6029,3.71173 4.79882,6.23242 5.74333,6.59274 14.89333,15.32961 28.63477,24.21094 m 5.42773,-8.40039 c -12.9314,-8.35778 -21.35753,-16.45123 -26.52148,-22.37891 -5.16395,-5.927668 -6.90039,-9.374996 -6.90039,-9.374996 l -7.65039,-1.541015 C 148.87685,102.91706 147.61469,105.85252 143.1875,121.21875"
id="path1-5-8"
sodipodi:nodetypes="ccsccsccc" />
<path
style="fill:none;stroke:#000064;stroke-width:1;stroke-linecap:square;stroke-miterlimit:10;stroke-dasharray:none"
d="m 79.729342,122.0734 c 4.449844,-15.44499 4.175634,-15.92048 16.908794,-26.568654 0,0 8.478114,16.421264 35.150984,33.660394"
id="path1-7"
sodipodi:nodetypes="ccc" />
<path
style="color:#000000;fill:none;stroke:#000064;stroke-width:0.2;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
d="m 84.533203,123.19336 c 3.810222,-13.22495 3.591776,-14.1312 11.107422,-20.53516 1.289696,1.82187 2.604775,3.71164 4.800785,6.23243 5.74333,6.59275 14.89136,15.32765 28.63281,24.20898 m 5.42969,-8.39844 c -12.93141,-8.35778 -21.35949,-16.45122 -26.52344,-22.3789 -5.16395,-5.927686 -6.90039,-9.375004 -6.90039,-9.375004 -0.69636,-1.348401 -1.967393,-2.307601 -3.45508,-2.607422 -1.487509,-0.300132 -3.03083,0.09145 -4.195313,1.064453 C 80.61325,102.12215 79.350982,105.05756 74.923828,120.42383"
id="path1-7-4"
sodipodi:nodetypes="ccsccscccc" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

+108
View File
@@ -0,0 +1,108 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="210mm"
height="297mm"
viewBox="0 0 210 297"
version="1.1"
id="svg1"
inkscape:version="1.3 (0e150ed6c4, 2023-07-21)"
sodipodi:docname="path.svg"
inkscape:export-filename="path-dark.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview1"
pagecolor="#ffffff"
bordercolor="#000000"
borderopacity="0.25"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:document-units="mm"
inkscape:zoom="0.75989759"
inkscape:cx="397.42198"
inkscape:cy="561.25984"
inkscape:window-width="1920"
inkscape:window-height="1123"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="layer1" />
<defs
id="defs1" />
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<path
style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-linecap:square;stroke-linejoin:bevel;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
d="M 128.28233,149.47912 154.23127,90.244656 86.340809,68.820468"
id="path3" />
<path
style="fill:none;stroke:#000000;stroke-width:1;stroke-linecap:square;stroke-linejoin:bevel;stroke-miterlimit:10;fill-opacity:1;stroke-dasharray:none;stroke-opacity:1"
d="m 33.956804,113.31099 c -9.049189,-11.90893 5.40551,-40.570358 20.351208,-39.990271 26.687501,1.035822 4.06495,71.984581 30.695656,74.009711 19.642072,1.49368 41.962402,-34.42048 30.634382,-50.536241 C 99.663884,74.068616 50.763019,135.42833 33.956804,113.31099 Z"
id="path1"
sodipodi:nodetypes="sssss" />
<circle
style="fill:#ff0404;fill-opacity:1;stroke:#000000;stroke-width:0.2;stroke-linecap:square;stroke-linejoin:bevel;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
id="path2"
cx="34.517788"
cy="113.66589"
r="1.5" />
<circle
style="fill:#ff0404;fill-opacity:1;stroke:#000064;stroke-width:0.2;stroke-linecap:square;stroke-linejoin:bevel;stroke-miterlimit:10;stroke-dasharray:none"
id="path2-8"
cx="55.045853"
cy="73.566689"
r="1.5" />
<circle
style="fill:#ff0404;fill-opacity:1;stroke:#000064;stroke-width:0.2;stroke-linecap:square;stroke-linejoin:bevel;stroke-miterlimit:10;stroke-dasharray:none"
id="path2-8-5"
cx="55.045834"
cy="73.831245"
r="1.5" />
<circle
style="fill:#ff0404;fill-opacity:1;stroke:#000000;stroke-width:0.2;stroke-linecap:square;stroke-linejoin:bevel;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
id="path2-8-9"
cx="55.045834"
cy="73.831245"
r="1.5" />
<circle
style="fill:#ff0404;fill-opacity:1;stroke:#000000;stroke-width:0.2;stroke-linecap:square;stroke-linejoin:bevel;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
id="path2-8-9-7"
cx="86.398613"
cy="68.897667"
r="1.5" />
<circle
style="fill:#ff0404;fill-opacity:1;stroke:#000000;stroke-width:0.2;stroke-linecap:square;stroke-linejoin:bevel;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
id="path2-8-9-7-8"
cx="153.87553"
cy="90.112595"
r="1.5" />
<circle
style="fill:#ff0404;fill-opacity:1;stroke:#000064;stroke-width:0.2;stroke-linecap:square;stroke-linejoin:bevel;stroke-miterlimit:10;stroke-dasharray:none"
id="path2-8-7"
cx="84.803238"
cy="147.51736"
r="1.5" />
<circle
style="fill:#ff0404;fill-opacity:1;stroke:#000000;stroke-width:0.2;stroke-linecap:square;stroke-linejoin:bevel;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
id="path2-8-7-2"
cx="115.28235"
cy="96.705284"
r="1.5" />
<circle
style="fill:#ff0404;fill-opacity:1;stroke:#000000;stroke-width:0.2;stroke-linecap:square;stroke-linejoin:bevel;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
id="path2-8-9-7-9"
cx="127.92362"
cy="150.03427"
r="1.5" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.4 KiB

+181
View File
@@ -0,0 +1,181 @@
.. _gtk4-path-tool(1):
=================
gtk4-path-tool
=================
-----------------------
GskPath Utility
-----------------------
SYNOPSIS
--------
| **gtk4-path-tool** <COMMAND> [OPTIONS...] <PATH>
|
| **gtk4-path-tool** decompose [OPTIONS...] <PATH>
| **gtk4-path-tool** show [OPTIONS...] <PATH>
| **gtk4-path-tool** render [OPTIONS...] <PATH>
| **gtk4-path-tool** info [OPTIONS...] <PATH>
DESCRIPTION
-----------
``gtk4-path-tool`` can perform various tasks on paths. Paths are specified
in SVG syntax, as strings like "M 100 100 C 100 200 200 200 200 100 Z".
To read a path from a file, use a filename that starts with a '.' or a '/'.
To read a path from stdin, use '-'.
COMMANDS
--------
Decomposing
^^^^^^^^^^^
The ``decompose`` command approximates the path by one with simpler elements.
When used without options, the curves of the path are approximated by line
segments.
``--allow-quad``
Allow quadratic Bézier curves to be used in the generated path.
``--allow-cubic``
Allow cubic Bézier curves to be used in the generated path.
Showing
^^^^^^^
The ``show`` command displays the given path in a window. The interior
of the path is filled.
``--fill-rule=VALUE``
The fill rule that is used to determine what areas are inside the path.
The possible values are ``winding`` or ``even-odd``. The default is ``winding``.
``--fg-color=COLOR``
The color that is used to fill the interior of the path or stroke the path.
If not specified, black is used.
``--bg-color=COLOR``
The color that is used to render the background behind the path.
If not specified, white is used.
``--stroke``
Stroke the path instead of filling it.
``--line-width=VALUE``
The line width to use for the stroke. ``VALUE`` must be a positive number.
The default line width is 1.
``--line-cap=VALUE``
The cap style to use at line ends. The possible values are ``butt``, ``round``
or ``square``. See the SVG specification for details on these styles.
The default cap style is ``butt``.
``--line-join=VALUE``
The join style to use at line joins. The possible values are ``miter``,
``miter-clip``, ``round``, ``bevel`` or ``arcs``. See the SVG specification
for details on these styles.
The default join style is ``miter``.
``--miter-limit=VALUE``
The limit at which to clip miters at line joins. The default value is 4.
``--dashes=VALUE``
The dash pattern to use for this stroke. A dash pattern is specified by
a comma-separated list of alternating non-negative numbers. Each number
provides the length of alternate "on" and "off" portions of the stroke.
If the dash pattern is empty, dashing is disabled, which is the default.
See the SVG specification for details on dashing.
``--dash-offset=VALUE``
The offset into the dash pattern where dashing should begin.
The default value is 0.
Rendering
^^^^^^^^^
The ``render`` command renders the given path as a PNG image.
The interior of the path is filled.
``--fill-rule=VALUE``
The fill rule that is used to determine what areas are inside the path.
The possible values are ``winding`` or ``even-odd``. The default is ``winding``.
``--fg-color=COLOR``
The color that is used to fill the interior of the path or stroke the path.
If not specified, black is used.
``--bg-color=COLOR``
The color that is used to render the background behind the path.
If not specified, white is used.
``--output-file=FILE``
The file to save the PNG image to.
If not specified, "path.png" is used.
``--stroke``
Stroke the path instead of filling it.
``--line-width=VALUE``
The line width to use for the stroke. ``VALUE`` must be a positive number.
The default line width is 1.
``--line-cap=VALUE``
The cap style to use at line ends. The possible values are ``butt``, ``round``
or ``square``. See the SVG specification for details on these styles.
The default cap style is ``butt``.
``--line-join=VALUE``
The join style to use at line joins. The possible values are ``miter``,
``miter-clip``, ``round``, ``bevel`` or ``arcs``. See the SVG specification
for details on these styles.
The default join style is ``miter``.
``--miter-limit=VALUE``
The limit at which to clip miters at line joins. The default value is 4.
``--dashes=VALUE``
The dash pattern to use for this stroke. A dash pattern is specified by
a comma-separated list of alternating non-negative numbers. Each number
provides the length of alternate "on" and "off" portions of the stroke.
If the dash pattern is empty, dashing is disabled, which is the default.
See the SVG specification for details on dashing.
``--dash-offset=VALUE``
The offset into the dash pattern where dashing should begin.
The default value is 0.
Info
^^^^
The ``info`` command shows various information about the given path,
such as its bounding box.
REFERENCES
----------
- SVG Path Specification, https://www.w3.org/TR/SVG2/paths.html
+1
View File
@@ -77,6 +77,7 @@ if get_option('man-pages') and rst2man.found()
[ 'gtk4-query-settings', '1', ],
[ 'gtk4-rendernode-tool', '1' ],
[ 'gtk4-update-icon-cache', '1', ],
[ 'gtk4-path-tool', '1', ],
]
if get_option('demos')
+10 -10
View File
@@ -297,7 +297,7 @@ gdk_clipboard_read_local_async (GdkClipboard *clipboard,
{
GOutputStream *output_stream;
GIOStream *stream;
stream = gdk_pipe_io_stream_new ();
output_stream = g_io_stream_get_output_stream (stream);
gdk_clipboard_write_async (clipboard,
@@ -767,7 +767,7 @@ gdk_clipboard_read_value_internal (GdkClipboard *clipboard,
GdkContentFormats *formats;
GValue *value;
GTask *task;
task = g_task_new (clipboard, cancellable, callback, user_data);
g_task_set_priority (task, io_priority);
g_task_set_source_tag (task, source_tag);
@@ -946,7 +946,7 @@ gdk_clipboard_read_texture_finish (GdkClipboard *clipboard,
value = g_task_propagate_pointer (G_TASK (result), error);
if (!value)
return NULL;
return g_value_dup_object (value);
}
@@ -1011,7 +1011,7 @@ gdk_clipboard_read_text_finish (GdkClipboard *clipboard,
value = g_task_propagate_pointer (G_TASK (result), error);
if (!value)
return NULL;
return g_value_dup_string (value);
}
@@ -1110,7 +1110,7 @@ gdk_clipboard_write_async (GdkClipboard *clipboard,
GError *error = NULL;
g_assert (gtype != G_TYPE_INVALID);
g_value_init (&value, gtype);
if (gdk_content_provider_get_value (priv->content, &value, &error))
{
@@ -1126,7 +1126,7 @@ gdk_clipboard_write_async (GdkClipboard *clipboard,
{
g_task_return_error (task, error);
}
g_value_unset (&value);
}
else
@@ -1148,7 +1148,7 @@ gdk_clipboard_write_finish (GdkClipboard *clipboard,
g_return_val_if_fail (g_task_is_valid (result, clipboard), FALSE);
g_return_val_if_fail (g_task_get_source_tag (G_TASK (result)) == gdk_clipboard_write_async, FALSE);
return g_task_propagate_boolean (G_TASK (result), error);
return g_task_propagate_boolean (G_TASK (result), error);
}
static gboolean
@@ -1248,8 +1248,8 @@ gdk_clipboard_set_content (GdkClipboard *clipboard,
* Sets the clipboard to contain the value collected from the given varargs.
*
* Values should be passed the same way they are passed to other value
* collecting APIs, such as [`method@GObject.Object.set`] or
* [`func@GObject.signal_emit`].
* collecting APIs, such as [method@GObject.Object.set] or
* [func@GObject.signal_emit].
*
* ```c
* gdk_clipboard_set (clipboard, GTK_TYPE_STRING, "Hello World");
@@ -1263,7 +1263,7 @@ gdk_clipboard_set (GdkClipboard *clipboard,
...)
{
va_list args;
g_return_if_fail (GDK_IS_CLIPBOARD (clipboard));
va_start (args, type);
+2 -1
View File
@@ -1528,7 +1528,8 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
if (gdk_gl_context_get_use_es (context))
{
priv->has_unpack_subimage = epoxy_has_gl_extension ("GL_EXT_unpack_subimage");
priv->has_unpack_subimage = gdk_gl_version_greater_equal (&priv->gl_version, &GDK_GL_VERSION_INIT (3, 0)) ||
epoxy_has_gl_extension ("GL_EXT_unpack_subimage");
priv->has_khr_debug = epoxy_has_gl_extension ("GL_KHR_debug");
}
else
+2 -2
View File
@@ -153,7 +153,7 @@ gdk_gl_texture_find_format (gboolean use_es,
if (gdk_memory_format_alpha (format) != alpha)
continue;
if (!gdk_memory_format_gl_format (format, use_es, gl_major, gl_minor, &q_internal_format, &q_format, &q_type, &q_swizzle))
if (!gdk_memory_format_gl_format (format, use_es, gl_major, gl_minor, &q_internal_format, &q_format, &q_type, q_swizzle))
continue;
if (q_format != gl_format || q_type != gl_type)
@@ -188,7 +188,7 @@ gdk_gl_texture_do_download (GdkGLTexture *self,
FALSE,
major, minor,
&gl_internal_format,
&gl_format, &gl_type, &gl_swizzle))
&gl_format, &gl_type, gl_swizzle))
{
if (download->stride == expected_stride &&
download->format == format)
+2 -2
View File
@@ -739,12 +739,12 @@ gdk_memory_format_gl_format (GdkMemoryFormat format,
guint *out_internal_format,
guint *out_format,
guint *out_type,
GLint (*out_swizzle)[4])
GLint out_swizzle[4])
{
*out_internal_format = memory_formats[format].gl.internal_format;
*out_format = memory_formats[format].gl.format;
*out_type = memory_formats[format].gl.type;
memcpy (out_swizzle, &memory_formats[format].gl.swizzle, sizeof(GLint) * 4);
memcpy (out_swizzle, memory_formats[format].gl.swizzle, sizeof(GLint) * 4);
if (gles)
{
+1 -1
View File
@@ -52,7 +52,7 @@ gboolean gdk_memory_format_gl_format (GdkMemoryFormat
guint *out_internal_format,
guint *out_format,
guint *out_type,
GLint (*out_gizzle)[4]);
GLint out_gizzle[4]);
void gdk_memory_convert (guchar *dest_data,
gsize dest_stride,
+3
View File
@@ -127,3 +127,6 @@ libgdk_wayland = static_library('gdk-wayland',
link_with: [ libwayland_cursor, ],
dependencies: [ gdk_deps, gdk_wayland_deps ],
)
# Used to generate pkg-config Requires
wayland_public_deps = [wlclientdep]
+12 -1
View File
@@ -2857,7 +2857,10 @@ gdk_event_translate (MSG *msg,
break;
case WM_SYSCOMMAND:
switch (msg->wParam)
/* From: https://learn.microsoft.com/en-us/windows/win32/menurc/wm-syscommand?redirectedfrom=MSDN
* To obtain the correct result when testing the value of wParam,
* an application must combine the value 0xFFF0 with the wParam value by using the bitwise AND operator. */
switch (msg->wParam & 0xFFF0)
{
case SC_MINIMIZE:
case SC_RESTORE:
@@ -2964,6 +2967,14 @@ gdk_event_translate (MSG *msg,
windowpos = (WINDOWPOS *) msg->lParam;
windowpos->cx = our_mmi.ptMaxSize.x;
windowpos->cy = our_mmi.ptMaxSize.y;
if (!_gdk_win32_surface_lacks_wm_decorations (window) &&
!(windowpos->flags & SWP_NOCLIENTSIZE) &&
window->width == impl->next_layout.configured_width &&
window->height == impl->next_layout.configured_height)
{
impl->inhibit_configure = TRUE;
}
}
impl->maximizing = FALSE;
+1 -8
View File
@@ -1230,18 +1230,11 @@ get_effective_window_decorations (GdkSurface *window,
*decoration |= GDK_DECOR_MINIMIZE;
return TRUE;
}
else if (impl->hint_flags & GDK_HINT_MAX_SIZE)
{
*decoration = GDK_DECOR_ALL | GDK_DECOR_MAXIMIZE;
*decoration |= GDK_DECOR_MINIMIZE;
return TRUE;
}
else
{
*decoration = (GDK_DECOR_ALL | GDK_DECOR_MINIMIZE | GDK_DECOR_MAXIMIZE);
*decoration = GDK_DECOR_ALL;
return TRUE;
}
+2
View File
@@ -86,3 +86,5 @@ libgdk_x11 = static_library('gdk-x11',
] + common_cflags,
dependencies: [ gdk_deps, gdk_x11_deps, ],
)
x11_public_deps = [x11_dep]
+133
View File
@@ -0,0 +1,133 @@
static const double T[] = {
-0.0243502926634244325089558428537156614268871093149758091634531663960566965166295288529853061657116894882370493013671717560479926679408068852617342586968190919443025679363843727751902756254975073084367002129407854253246662805532069172532219089321005870178809284335033318073251039701073379759,
0.0243502926634244325089558428537156614268871093149758091634531663960566965166295288529853061657116894882370493013671717560479926679408068852617342586968190919443025679363843727751902756254975073084367002129407854253246662805532069172532219089321005870178809284335033318073251039701073379759,
-0.0729931217877990394495429419403374932441261816687788533563163323377395217254429050181833064967505478802134768007678458612956459126148837496307967995621683597067400860540057918571357609346700883624064782909888895547912499697295335516804810990011835717296819569741981551097569810739977931249,
0.0729931217877990394495429419403374932441261816687788533563163323377395217254429050181833064967505478802134768007678458612956459126148837496307967995621683597067400860540057918571357609346700883624064782909888895547912499697295335516804810990011835717296819569741981551097569810739977931249,
-0.1214628192961205544703764634922478782186836383371912940423495826006931832245070944213952236889690237679661122848626352437115925113582515415979746598665681268376919737373113667247142315234607397986222184384307059013512155412722263090766858403726100735651684437098923088469949297570988091677,
0.1214628192961205544703764634922478782186836383371912940423495826006931832245070944213952236889690237679661122848626352437115925113582515415979746598665681268376919737373113667247142315234607397986222184384307059013512155412722263090766858403726100735651684437098923088469949297570988091677,
-0.1696444204239928180373136297482698441999902667343778505894178746884342357796505591325925801106834127602396624627746208498838190598644711533868179088757129652678801285453336384132061358206434768209251779433993367981112053126660575920785488821886662635718276505127786854167528795165050389903,
0.1696444204239928180373136297482698441999902667343778505894178746884342357796505591325925801106834127602396624627746208498838190598644711533868179088757129652678801285453336384132061358206434768209251779433993367981112053126660575920785488821886662635718276505127786854167528795165050389903,
-0.217423643740007084149648748988822617578485831141222348630380401885689634737659235537163737740243604800759921292790013642836998201691226098978544332296437547642195961469059807833597096166848933098833151166287901339013986496737408125314858259377210847115061960167857239951500335854820530586,
0.217423643740007084149648748988822617578485831141222348630380401885689634737659235537163737740243604800759921292790013642836998201691226098978544332296437547642195961469059807833597096166848933098833151166287901339013986496737408125314858259377210847115061960167857239951500335854820530586,
-0.2646871622087674163739641725100201179804131362950932439559895448126206429452852982016450901649805445999078728714943692622330016257776575354105370883948495294882935681426154386660616476411740312465060150591301869544672050088454083442813632094277160007745547301572849406353682760306061929911,
0.2646871622087674163739641725100201179804131362950932439559895448126206429452852982016450901649805445999078728714943692622330016257776575354105370883948495294882935681426154386660616476411740312465060150591301869544672050088454083442813632094277160007745547301572849406353682760306061929911,
-0.3113228719902109561575126985601568835577153578680501269954571709858169098868398268719654999460149709757804582988077747605532896065842023340674450299515989484487746153929299031759475919924980452933324186984188982046762542556035347023744560814177013801414889023264804693830155588690576492164,
0.3113228719902109561575126985601568835577153578680501269954571709858169098868398268719654999460149709757804582988077747605532896065842023340674450299515989484487746153929299031759475919924980452933324186984188982046762542556035347023744560814177013801414889023264804693830155588690576492164,
-0.357220158337668115950442615046202531626264464640909112021237019340099177403802509741325589540743874845093675632547750287037622834793938695456980400958079292460482315821150714268593539935795231095157602025909339384694681190969656053235824652679875951093689200190014853543993102190088381483,
0.357220158337668115950442615046202531626264464640909112021237019340099177403802509741325589540743874845093675632547750287037622834793938695456980400958079292460482315821150714268593539935795231095157602025909339384694681190969656053235824652679875951093689200190014853543993102190088381483,
-0.4022701579639916036957667712601588487132652056150208082760431843129087214967261515969669708970990221669508217089555714806012046537594438323569293594638517933840725639831594134038262580440842200076281605641993773325072728778928440394419613403725280285705765326861533477990551765453978736181,
0.4022701579639916036957667712601588487132652056150208082760431843129087214967261515969669708970990221669508217089555714806012046537594438323569293594638517933840725639831594134038262580440842200076281605641993773325072728778928440394419613403725280285705765326861533477990551765453978736181,
-0.4463660172534640879849477147589151892067507578262501763082606820212937626970791295735937384813941473610238854736863966831464694923749954564921955859791688348936235671762050333408576202492209167272366373825152067680845198006626563761196191045700093968519269790165913301841545609485952718504,
0.4463660172534640879849477147589151892067507578262501763082606820212937626970791295735937384813941473610238854736863966831464694923749954564921955859791688348936235671762050333408576202492209167272366373825152067680845198006626563761196191045700093968519269790165913301841545609485952718504,
-0.4894031457070529574785263070219213908493732974637398373316540793240315585537584844752851087115581833443158831657759501916744927211636581386025171070582998790865902140901838128045602667002106847665927788023098753138400106615804847725751247952878407027140260429761863258319891988431055536872,
0.4894031457070529574785263070219213908493732974637398373316540793240315585537584844752851087115581833443158831657759501916744927211636581386025171070582998790865902140901838128045602667002106847665927788023098753138400106615804847725751247952878407027140260429761863258319891988431055536872,
-0.531279464019894545658013903544455247408525588734180238053268047166041778398245121448843253296460411619816073385211875151397248937264089998182375345915413219579220233566173902955487674957069948591213673456625912506280248298229907928060620469290406581396192419570799497688513058132396498814,
0.531279464019894545658013903544455247408525588734180238053268047166041778398245121448843253296460411619816073385211875151397248937264089998182375345915413219579220233566173902955487674957069948591213673456625912506280248298229907928060620469290406581396192419570799497688513058132396498814,
-0.5718956462026340342838781166591886431831910060912509932273284719418912212643223327597417735844776972648163821225207266145263395898251858906124801356522395225326954546582593857056725545247314092886133249957455688586118199388064447508712958637376347457406936802691416300157802889354368128467,
0.5718956462026340342838781166591886431831910060912509932273284719418912212643223327597417735844776972648163821225207266145263395898251858906124801356522395225326954546582593857056725545247314092886133249957455688586118199388064447508712958637376347457406936802691416300157802889354368128467,
-0.6111553551723932502488529710185489186961245593079718443367976666933088374650288148448667879830703867726577720666491772560110368248450475818132595468834493579434418252468978282181164008820769765174450056817468275783966537351796625224747700783378315186174632657840114512887287754747902924865,
0.6111553551723932502488529710185489186961245593079718443367976666933088374650288148448667879830703867726577720666491772560110368248450475818132595468834493579434418252468978282181164008820769765174450056817468275783966537351796625224747700783378315186174632657840114512887287754747902924865,
-0.6489654712546573398577612319934048855296904334732011728792502624366057598865738239773166627826358871699142531853930525866830933399401844502541092962631127742267449897116125748014270680393024011359139031312062573520509858894743036198986443014969748157931850178889912972291202354657382925509,
0.6489654712546573398577612319934048855296904334732011728792502624366057598865738239773166627826358871699142531853930525866830933399401844502541092962631127742267449897116125748014270680393024011359139031312062573520509858894743036198986443014969748157931850178889912972291202354657382925509,
-0.6852363130542332425635583710313763019356410785396718681324042749913611976548967332647625541234155413035075739348863233240851709341392873173633850612006618690218164007761541855237208605116527909791956398350719463021018362527198358286721239529091637248252469435642287693207506339068528700205,
0.6852363130542332425635583710313763019356410785396718681324042749913611976548967332647625541234155413035075739348863233240851709341392873173633850612006618690218164007761541855237208605116527909791956398350719463021018362527198358286721239529091637248252469435642287693207506339068528700205,
-0.7198818501716108268489402178319472447581380033149019526220473151184468592486433646042300919262498902882179891494724046747921544602557246455427317830132976771174504209146835854012577372395960646854355024460204286901035470812684876587693044068989973704915078171158689213412715251485203442313,
0.7198818501716108268489402178319472447581380033149019526220473151184468592486433646042300919262498902882179891494724046747921544602557246455427317830132976771174504209146835854012577372395960646854355024460204286901035470812684876587693044068989973704915078171158689213412715251485203442313,
-0.7528199072605318966118637748856939855517142713220871932461987761167722639636968539390413583009467924995905147153923286347693864945784890119950315095740891764880991728646942920208355501445550654259850385377192973526980795946453961077798744753892199929235882097232836682421729944934586281945,
0.7528199072605318966118637748856939855517142713220871932461987761167722639636968539390413583009467924995905147153923286347693864945784890119950315095740891764880991728646942920208355501445550654259850385377192973526980795946453961077798744753892199929235882097232836682421729944934586281945,
-0.7839723589433414076102205252137682840564141249898259334132759617476816578705098509357116190608002325895348207611752987335385494893726027026038902508685496606160441965948835252795524014713290879877269643684102005605450140247125536147801312017065532602835003540212221564314236937509990182173,
0.7839723589433414076102205252137682840564141249898259334132759617476816578705098509357116190608002325895348207611752987335385494893726027026038902508685496606160441965948835252795524014713290879877269643684102005605450140247125536147801312017065532602835003540212221564314236937509990182173,
-0.8132653151227975597419233380863033406981418225655972166956485149356586346082019870309280128411412936411423614767918756843380999442447282903502051218203273573634847203121451086379808399639198510674436238195505371716160648058477202993836014352158139813219612968106205248494087577632573534973,
0.8132653151227975597419233380863033406981418225655972166956485149356586346082019870309280128411412936411423614767918756843380999442447282903502051218203273573634847203121451086379808399639198510674436238195505371716160648058477202993836014352158139813219612968106205248494087577632573534973,
-0.840629296252580362751691544695873302982489823801755353928202683075593465893922171840726147868117503717663799561956411215937924134571068943700343442753760445948626598735504632170407243376224222403038093781056024445977626666740664628412660960413062370047183186652885532589557452614451434048,
0.840629296252580362751691544695873302982489823801755353928202683075593465893922171840726147868117503717663799561956411215937924134571068943700343442753760445948626598735504632170407243376224222403038093781056024445977626666740664628412660960413062370047183186652885532589557452614451434048,
-0.8659993981540928197607833850701575024125019187582496425664279511808356713122188567857456842034906362573453815878913951040194915987006979015304835979058725276345799813088989383312475641092775164460639450521468294104011206574786429237252678172922104036725327539940502197291939132802457917836,
0.8659993981540928197607833850701575024125019187582496425664279511808356713122188567857456842034906362573453815878913951040194915987006979015304835979058725276345799813088989383312475641092775164460639450521468294104011206574786429237252678172922104036725327539940502197291939132802457917836,
-0.8893154459951141058534040382728516224291944615104521893194744566084811090577722526400445910623711480590529533188832105988657269430913287263821624762648137092066620632787986348052306840101775313644572400860845559833367997001666659907951051347410546710134120144598833115095140475669485797579,
0.8893154459951141058534040382728516224291944615104521893194744566084811090577722526400445910623711480590529533188832105988657269430913287263821624762648137092066620632787986348052306840101775313644572400860845559833367997001666659907951051347410546710134120144598833115095140475669485797579,
-0.9105221370785028057563806680083298610134880848883640292531723714467102234556291968179018775780308458024302103848451312741663820589200520720207891653884985710130867134073520525932445557074805974235006810370309087879564826639263972805682465506594098949560288847385983395160311034445386606259,
0.9105221370785028057563806680083298610134880848883640292531723714467102234556291968179018775780308458024302103848451312741663820589200520720207891653884985710130867134073520525932445557074805974235006810370309087879564826639263972805682465506594098949560288847385983395160311034445386606259,
-0.9295691721319395758214901545592256073474270144297154975928116833612430986265594515998834499355844736686512805129688214992047597092114291955925880175797899765980745854426738149516325837607227287481909072315347776012991222301207304052068204069335766550173941103055407746774520789612843561385,
0.9295691721319395758214901545592256073474270144297154975928116833612430986265594515998834499355844736686512805129688214992047597092114291955925880175797899765980745854426738149516325837607227287481909072315347776012991222301207304052068204069335766550173941103055407746774520789612843561385,
-0.9464113748584028160624814913472647952793949717952331902317789712973664402149436591260928179188420533516264142755452159723722786167537167514691534968355366202934342465086995943893699962972237343218079763936958985487264411542890941861254842843026890160131607678957282346112697993618567018237,
0.9464113748584028160624814913472647952793949717952331902317789712973664402149436591260928179188420533516264142755452159723722786167537167514691534968355366202934342465086995943893699962972237343218079763936958985487264411542890941861254842843026890160131607678957282346112697993618567018237,
-0.9610087996520537189186141218971572067621146110378459494461586158623919945488992563976780806866203786216001498788310714552847469661399216303755820947005848739467276644122915754949838610353627723679982220628115164983443994552616161584523205789167087822341423097206088828267065770404672828066,
0.9610087996520537189186141218971572067621146110378459494461586158623919945488992563976780806866203786216001498788310714552847469661399216303755820947005848739467276644122915754949838610353627723679982220628115164983443994552616161584523205789167087822341423097206088828267065770404672828066,
-0.9733268277899109637418535073522726680261452944551741758819139781978152256958453749994966038154125547612207903105020176172420237675899907788807087542221018040460410464083361271842759039530092449625891215101984663282728542290395875313124045226564547294745437773482395329023327909760431499638,
0.9733268277899109637418535073522726680261452944551741758819139781978152256958453749994966038154125547612207903105020176172420237675899907788807087542221018040460410464083361271842759039530092449625891215101984663282728542290395875313124045226564547294745437773482395329023327909760431499638,
-0.9833362538846259569312993021568311169452475066237403837464872131233426128415470535606559721330818003585532628124845662897410684694651251174207713020897795837892725294581710205598344576799985346970638130204876060998657059283079767876980544166132523941283823202290746667358872631036031924711,
0.9833362538846259569312993021568311169452475066237403837464872131233426128415470535606559721330818003585532628124845662897410684694651251174207713020897795837892725294581710205598344576799985346970638130204876060998657059283079767876980544166132523941283823202290746667358872631036031924711,
-0.9910133714767443207393823834433031136413494453907904852225427459378131658644129997345108950133770434340330151289100150097018332483423277136039914249575686591612502752158650205954671083696496347591169012794322303027309768195334920157669446268175983954105533989275308193580349506657360682085,
0.9910133714767443207393823834433031136413494453907904852225427459378131658644129997345108950133770434340330151289100150097018332483423277136039914249575686591612502752158650205954671083696496347591169012794322303027309768195334920157669446268175983954105533989275308193580349506657360682085,
-0.9963401167719552793469245006763991232098575063402266121352522199507030568202208530946066801021703916301511794658310735397567341036554686814952726523955953805437164277655915410358813984246580862850974195805395101678543649116458555272523253307828290553873260588621490898443701779725568118502,
0.9963401167719552793469245006763991232098575063402266121352522199507030568202208530946066801021703916301511794658310735397567341036554686814952726523955953805437164277655915410358813984246580862850974195805395101678543649116458555272523253307828290553873260588621490898443701779725568118502,
-0.9993050417357721394569056243456363119697121916756087760628072954617646543505331997843242376462639434945376776512170265314011232493020401570891594274831367800115383317335285468800574240152992751785027563437707875403545865305271045717258142571193695943317890367167086616955235477529427992282,
0.9993050417357721394569056243456363119697121916756087760628072954617646543505331997843242376462639434945376776512170265314011232493020401570891594274831367800115383317335285468800574240152992751785027563437707875403545865305271045717258142571193695943317890367167086616955235477529427992282
};
static const double C[] = {
0.0486909570091397203833653907347499124426286922838743305086688042456914190998246107310291565645676057401607079939845156005172257043376703767287395573765236401039685866479381075274920900511719320271157129622463682509122641788910270632229694394595885032921037399187298767076084601033342936131,
0.0486909570091397203833653907347499124426286922838743305086688042456914190998246107310291565645676057401607079939845156005172257043376703767287395573765236401039685866479381075274920900511719320271157129622463682509122641788910270632229694394595885032921037399187298767076084601033342936131,
0.0485754674415034269347990667839781136875565447049294857111516761025158193093697039229163427633930410186232149083923688162761488505704450697417589593116703853157329164894580165517236877241308351214870169600093357854651930986960906313726182992933363325614247750209880050786299287510692780499,
0.0485754674415034269347990667839781136875565447049294857111516761025158193093697039229163427633930410186232149083923688162761488505704450697417589593116703853157329164894580165517236877241308351214870169600093357854651930986960906313726182992933363325614247750209880050786299287510692780499,
0.048344762234802957169769527158017809703692550609501080629442201445249828946429202156764153264348308119169811534137999799779908820312744765416129733427088646813066886130539178187597540312913636916139844188190193872629488730769015964208394624398401975043997268903006190530430762197842013971,
0.048344762234802957169769527158017809703692550609501080629442201445249828946429202156764153264348308119169811534137999799779908820312744765416129733427088646813066886130539178187597540312913636916139844188190193872629488730769015964208394624398401975043997268903006190530430762197842013971,
0.0479993885964583077281261798713460699543167134714936209446323930933335214619650277588138568504103427609283146728470455041360837549685364869161566863222680599110109210456299588352028330169041000166382937545505655464884266691630625402297821494221827392164049587946530563778771030124675514431,
0.0479993885964583077281261798713460699543167134714936209446323930933335214619650277588138568504103427609283146728470455041360837549685364869161566863222680599110109210456299588352028330169041000166382937545505655464884266691630625402297821494221827392164049587946530563778771030124675514431,
0.0475401657148303086622822069442231716408252512625387521584740318784735191312349586041971325618543660076682369564304738487584849740943805934034367382833518752314207901993991333786062812015195073547884746598535775062676699885664167707011249029305697669004958515813436770491520105115843742005,
0.0475401657148303086622822069442231716408252512625387521584740318784735191312349586041971325618543660076682369564304738487584849740943805934034367382833518752314207901993991333786062812015195073547884746598535775062676699885664167707011249029305697669004958515813436770491520105115843742005,
0.0469681828162100173253262857545810751998975284738125649829240886861900500181800807437012381630302198876925642461830694029139318555787845567143614289552410495903601238284556145544858090965965782916339169651505119399637862876053945518410353459767034026687936026945199383607112976484520939933,
0.0469681828162100173253262857545810751998975284738125649829240886861900500181800807437012381630302198876925642461830694029139318555787845567143614289552410495903601238284556145544858090965965782916339169651505119399637862876053945518410353459767034026687936026945199383607112976484520939933,
0.0462847965813144172959532492322611849696503075324468007778340818364698861774606986244241539105685321088517142947579291476238551538798963436740600968513359005801910700069462154098456091711311098901749803777735222026075473081311483686560830539773763176758567914860207820170792365910140063798,
0.0462847965813144172959532492322611849696503075324468007778340818364698861774606986244241539105685321088517142947579291476238551538798963436740600968513359005801910700069462154098456091711311098901749803777735222026075473081311483686560830539773763176758567914860207820170792365910140063798,
0.0454916279274181444797709969712690588873234618023998968168834081606504637618082102750954507142497706775055424364453740562113890878382679420378787427100982909191308430750899201141096789461078632697297091763378573830284133736378128577579722120264252594541491899441765769262904055702701625378,
0.0454916279274181444797709969712690588873234618023998968168834081606504637618082102750954507142497706775055424364453740562113890878382679420378787427100982909191308430750899201141096789461078632697297091763378573830284133736378128577579722120264252594541491899441765769262904055702701625378,
0.0445905581637565630601347100309448432940237999912217256432193286861948363377761089569585678875932857237669096941854082976565514031401996407675401022860761183118504326746863327792604337217763335682212515058414863183914930810334329596384915832703655935958010948424747251920190851700662833367,
0.0445905581637565630601347100309448432940237999912217256432193286861948363377761089569585678875932857237669096941854082976565514031401996407675401022860761183118504326746863327792604337217763335682212515058414863183914930810334329596384915832703655935958010948424747251920190851700662833367,
0.0435837245293234533768278609737374809227888974971180150532193925502569499020021803936448815937567079991401855477391110804568848623412043870399620479222000249538880795788245633051476595555730388360811011823841525667998427392843673284072004068821750061964976796287623004834501604656318714989,
0.0435837245293234533768278609737374809227888974971180150532193925502569499020021803936448815937567079991401855477391110804568848623412043870399620479222000249538880795788245633051476595555730388360811011823841525667998427392843673284072004068821750061964976796287623004834501604656318714989,
0.0424735151236535890073397679088173661655466481806496697314607722055245433487169327182398988553670128358787507582463602377168227019625334754497484024668087975720049504975593281010888062806587161032924284354938115463233015024659299046001504100674918329532481611571863222497170398830691222425,
0.0424735151236535890073397679088173661655466481806496697314607722055245433487169327182398988553670128358787507582463602377168227019625334754497484024668087975720049504975593281010888062806587161032924284354938115463233015024659299046001504100674918329532481611571863222497170398830691222425,
0.0412625632426235286101562974736380477399306355305474105429034779122704951178045914463267035032832336161816547420067160277921114474557623647771372636679857599931025531633255548770293397336318597716427093310378312957479805159734598610664983115148350548735211568465338522875618805992499897174,
0.0412625632426235286101562974736380477399306355305474105429034779122704951178045914463267035032832336161816547420067160277921114474557623647771372636679857599931025531633255548770293397336318597716427093310378312957479805159734598610664983115148350548735211568465338522875618805992499897174,
0.0399537411327203413866569261283360739186769506703336301114037026981570543670430333260307390357287606111017588757685176701688554806178713759519003171090525332423003042251947304213502522332118258365256241174986409729902714098049024753746340158430732115642207673265332738358717839602955875715,
0.0399537411327203413866569261283360739186769506703336301114037026981570543670430333260307390357287606111017588757685176701688554806178713759519003171090525332423003042251947304213502522332118258365256241174986409729902714098049024753746340158430732115642207673265332738358717839602955875715,
0.0385501531786156291289624969468089910127871122017180319662378854088005271323682681394418540442928363090545214563022868422017877042243007014244875098498616146404178795110038170109976252865902624380463581094085479557660525450020049773872343621719025128277593787164021147974906095237533202082,
0.0385501531786156291289624969468089910127871122017180319662378854088005271323682681394418540442928363090545214563022868422017877042243007014244875098498616146404178795110038170109976252865902624380463581094085479557660525450020049773872343621719025128277593787164021147974906095237533202082,
0.0370551285402400460404151018095833750834649453056563021747536272028091562122966687178302646649066832960609370472485057031765338738734008482025086366647963664178752038995704175623165041724901843573087856883034472545386037691055680911138721623610172486110313241291773258491882452773847899443,
0.0370551285402400460404151018095833750834649453056563021747536272028091562122966687178302646649066832960609370472485057031765338738734008482025086366647963664178752038995704175623165041724901843573087856883034472545386037691055680911138721623610172486110313241291773258491882452773847899443,
0.0354722132568823838106931467152459479480946310024100946926514848199381113651392962399922996268087884509143420993419937430515415557908457195618550238075571721209638845910166697234073788332647695349442265578792857058786796417110738673392400570019770741873271724201517438135222598792344040215,
0.0354722132568823838106931467152459479480946310024100946926514848199381113651392962399922996268087884509143420993419937430515415557908457195618550238075571721209638845910166697234073788332647695349442265578792857058786796417110738673392400570019770741873271724201517438135222598792344040215,
0.0338051618371416093915654821107254310210499263140045346675500650400323727745785853730452808963944098691936344225349051741060036935288424090581463711756382878498537611980973238606529148664990420534952057130296232922368792280098852092993207644225150541876980292972087619863453425206929192216,
0.0338051618371416093915654821107254310210499263140045346675500650400323727745785853730452808963944098691936344225349051741060036935288424090581463711756382878498537611980973238606529148664990420534952057130296232922368792280098852092993207644225150541876980292972087619863453425206929192216,
0.032057928354851553585467504347898716966221573881398062250169407854535275399124366530227987935629046729162364779969274126431870966979526186907589490002269660893281421728773647001279141626157958271220102615163092206489916992120482595587916535390136003611498634162765724522022671474313619317,
0.032057928354851553585467504347898716966221573881398062250169407854535275399124366530227987935629046729162364779969274126431870966979526186907589490002269660893281421728773647001279141626157958271220102615163092206489916992120482595587916535390136003611498634162765724522022671474313619317,
0.030234657072402478867974059819548659158281397768481241636026542045969161851838118212761980885178641520596873511042783163461341979185470882574743804555268086640389062237383427702813367624714014426121485626242067362445894463989335423458464954799181190120473168677930333898873084606011285311,
0.030234657072402478867974059819548659158281397768481241636026542045969161851838118212761980885178641520596873511042783163461341979185470882574743804555268086640389062237383427702813367624714014426121485626242067362445894463989335423458464954799181190120473168677930333898873084606011285311,
0.0283396726142594832275113052002373519812075841257543359907955185084500175712880712901834579816476269393013386531176072296695948860841466158639973753393323262188023471133258509422081952937349849822864752636994881600343083839805990853930436233762729622213044478376753949590318846038229829528,
0.0283396726142594832275113052002373519812075841257543359907955185084500175712880712901834579816476269393013386531176072296695948860841466158639973753393323262188023471133258509422081952937349849822864752636994881600343083839805990853930436233762729622213044478376753949590318846038229829528,
0.0263774697150546586716917926252251856755993308422457184496156736853021592428967790284780487213653480867620409279447766944383920384284787790772384251090745670478105870527396429136326932261251511732466974897397268573168068852344129736214469830280087710575094607457344820944885011053938108899,
0.0263774697150546586716917926252251856755993308422457184496156736853021592428967790284780487213653480867620409279447766944383920384284787790772384251090745670478105870527396429136326932261251511732466974897397268573168068852344129736214469830280087710575094607457344820944885011053938108899,
0.0243527025687108733381775504090689876499784155133784119819985685535536787083770723737264828464464223276155821319330210193549896426801083040150047332857692873011433649334477370145389017577189505240415125600908800786897201425473757275187332157593198572919772969833130729981971352463730545469,
0.0243527025687108733381775504090689876499784155133784119819985685535536787083770723737264828464464223276155821319330210193549896426801083040150047332857692873011433649334477370145389017577189505240415125600908800786897201425473757275187332157593198572919772969833130729981971352463730545469,
0.0222701738083832541592983303841550024229592905997594051455205429744914460867081990116647982811451138592401156680063927909718825845915896692701716212710541472344073624315399429951255221519263275095347974129106415903376085208797420439500915674568159744176912567285070988940509294826076696882,
0.0222701738083832541592983303841550024229592905997594051455205429744914460867081990116647982811451138592401156680063927909718825845915896692701716212710541472344073624315399429951255221519263275095347974129106415903376085208797420439500915674568159744176912567285070988940509294826076696882,
0.0201348231535302093723403167285438970895266801007919519220072343276769828211923597982299498416998597995443052252531684909219367615574440281549241161294448697202959593344989612626641188010558013085389491205901106884167596038790695150496733123662891637942237462337673353651179115491957031948,
0.0201348231535302093723403167285438970895266801007919519220072343276769828211923597982299498416998597995443052252531684909219367615574440281549241161294448697202959593344989612626641188010558013085389491205901106884167596038790695150496733123662891637942237462337673353651179115491957031948,
0.0179517157756973430850453020011193688971673570364158572977184273569247295870620984743089140579199272107974903016785911970727080884655646148340637373001805876560334052431930062983734905886704331100259778249929425439377011315288821865303197904492848823994202996722656114004109123107733596987,
0.0179517157756973430850453020011193688971673570364158572977184273569247295870620984743089140579199272107974903016785911970727080884655646148340637373001805876560334052431930062983734905886704331100259778249929425439377011315288821865303197904492848823994202996722656114004109123107733596987,
0.0157260304760247193219659952975397944260290098431565121528943932284210502164124556525745628476326997189475680077625258949765335021586482683126547283634704087193102431454662772463321304938516661086261262080252305539171654570677889578063634007609097342035360186636479612243231917699790225637,
0.0157260304760247193219659952975397944260290098431565121528943932284210502164124556525745628476326997189475680077625258949765335021586482683126547283634704087193102431454662772463321304938516661086261262080252305539171654570677889578063634007609097342035360186636479612243231917699790225637,
0.0134630478967186425980607666859556841084257719773496708184682785221983598894666268489697837056105038485845901773961664652581563686185523959473293683490869846700009741156668864960127745507806046701586435579547632680339906665338521813319281296935586498194608460412423723103161161922347608637,
0.0134630478967186425980607666859556841084257719773496708184682785221983598894666268489697837056105038485845901773961664652581563686185523959473293683490869846700009741156668864960127745507806046701586435579547632680339906665338521813319281296935586498194608460412423723103161161922347608637,
0.011168139460131128818590493019208135072778797816827287215251362273969701224836131369547661822970774719521543690039908073147476182135228738610704246958518755712518444434075738269866120460156365855324768445411463643114925829148750923090201475035559533993035986264487097245733097728698218563,
0.011168139460131128818590493019208135072778797816827287215251362273969701224836131369547661822970774719521543690039908073147476182135228738610704246958518755712518444434075738269866120460156365855324768445411463643114925829148750923090201475035559533993035986264487097245733097728698218563,
0.0088467598263639477230309146597306476951762660792204997984715769296110380005985367341694286322550520156167431790573509593010611842062630262878798782558974712042810219159674181580449655112696028911646066461502678711637780164986283350190669684468398617127841853445303466680698660632269500149,
0.0088467598263639477230309146597306476951762660792204997984715769296110380005985367341694286322550520156167431790573509593010611842062630262878798782558974712042810219159674181580449655112696028911646066461502678711637780164986283350190669684468398617127841853445303466680698660632269500149,
0.0065044579689783628561173603999812667711317610549523400952448792575685125717613068203530526491113296049409911387320826711045787146267036866881961532403342811327869183281273743976710008917886491097375367147212074243884772614562628844975421736416404173672075979097191581386023407454532945934,
0.0065044579689783628561173603999812667711317610549523400952448792575685125717613068203530526491113296049409911387320826711045787146267036866881961532403342811327869183281273743976710008917886491097375367147212074243884772614562628844975421736416404173672075979097191581386023407454532945934,
0.0041470332605624676352875357285514153133028192536848024628763661431834776690157393776820933106187137592011723199002845429836606307797425496666456172753165824787973801175029578301513761259541022471768825518482406145696380621686627285992715643614469568410535180218496973657001203470470418364,
0.0041470332605624676352875357285514153133028192536848024628763661431834776690157393776820933106187137592011723199002845429836606307797425496666456172753165824787973801175029578301513761259541022471768825518482406145696380621686627285992715643614469568410535180218496973657001203470470418364,
0.0017832807216964329472960791449719331799593472719279556695308063655858546954239803486698215802150348282744786016134857283616955449868451969230490863774274598030023211055562492709717566919237924255297982774711177411074145151155610163293142044147991553384925940046957893721166251082473659733,
0.0017832807216964329472960791449719331799593472719279556695308063655858546954239803486698215802150348282744786016134857283616955449868451969230490863774274598030023211055562492709717566919237924255297982774711177411074145151155610163293142044147991553384925940046957893721166251082473659733
};
+4 -5
View File
@@ -1456,7 +1456,7 @@ memory_format_gl_format (GdkMemoryFormat data_format,
guint *gl_internalformat,
guint *gl_format,
guint *gl_type,
GLint (*gl_swizzle)[4])
GLint gl_swizzle[4])
{
GdkMemoryDepth depth;
@@ -1577,7 +1577,7 @@ gsk_gl_command_queue_do_upload_texture_chunk (GskGLCommandQueue *self,
&gl_internalformat,
&gl_format,
&gl_type,
&gl_swizzle);
gl_swizzle);
gdk_texture_downloader_init (&downloader, texture);
gdk_texture_downloader_set_format (&downloader, data_format);
@@ -1595,8 +1595,7 @@ gsk_gl_command_queue_do_upload_texture_chunk (GskGLCommandQueue *self,
{
glTexSubImage2D (GL_TEXTURE_2D, 0, x, y, width, height, gl_format, gl_type, data);
}
else if (stride % bpp == 0 &&
(gdk_gl_context_check_version (self->context, NULL, "3.0") || gdk_gl_context_has_unpack_subimage (self->context)))
else if (stride % bpp == 0 && gdk_gl_context_has_unpack_subimage (self->context))
{
glPixelStorei (GL_UNPACK_ROW_LENGTH, stride / bpp);
@@ -1684,7 +1683,7 @@ gsk_gl_command_queue_upload_texture_chunks (GskGLCommandQueue *self,
&gl_internalformat,
&gl_format,
&gl_type,
&gl_swizzle);
gl_swizzle);
glTexImage2D (GL_TEXTURE_2D, 0, gl_internalformat, width, height, 0, gl_format, gl_type, NULL);
+282 -25
View File
@@ -61,6 +61,7 @@ struct _GskContourClass
GskContour * (* reverse) (const GskContour *contour);
int (* get_winding) (const GskContour *contour,
const graphene_point_t *point);
gsize (* get_n_ops) (const GskContour *contour);
gboolean (* get_closest_point) (const GskContour *contour,
const graphene_point_t *point,
float threshold,
@@ -76,6 +77,18 @@ struct _GskContourClass
float (* get_curvature) (const GskContour *contour,
GskRealPathPoint *point,
graphene_point_t *center);
void (* add_segment) (const GskContour *contour,
GskPathBuilder *builder,
gboolean emit_move_to,
GskRealPathPoint *start,
GskRealPathPoint *end);
void (* get_point) (const GskContour *contour,
float distance,
float precision,
GskRealPathPoint *result);
float (* get_distance) (const GskContour *contour,
GskRealPathPoint *point);
float (* get_length) (const GskContour *contour);
};
/* {{{ Utilities */
@@ -113,9 +126,13 @@ struct _GskStandardContour
GskPathFlags flags;
float length;
gsize has_length;
gsize n_ops;
gsize n_points;
graphene_point_t *points;
float *lengths;
gskpathop ops[];
};
@@ -123,9 +140,14 @@ static gsize
gsk_standard_contour_compute_size (gsize n_ops,
gsize n_points)
{
return sizeof (GskStandardContour)
+ sizeof (gskpathop) * n_ops
+ sizeof (graphene_point_t) * n_points;
gsize align = MAX (G_ALIGNOF (graphene_point_t),
MAX (G_ALIGNOF (gpointer),
G_ALIGNOF (GskStandardContour)));
gsize s = sizeof (GskStandardContour)
+ sizeof (gskpathop) * n_ops
+ sizeof (float) * n_ops
+ sizeof (graphene_point_t) * n_points;
return s + (align - (s % align));
}
static void
@@ -154,6 +176,29 @@ gsk_standard_contour_get_size (const GskContour *contour)
return gsk_standard_contour_compute_size (self->n_ops, self->n_points);
}
static void
gsk_standard_contour_ensure_lengths (const GskContour *contour)
{
GskStandardContour *self = (GskStandardContour *) contour;
if (g_once_init_enter (&self->has_length))
{
GskCurve curve;
self->lengths[0] = 0;
for (gsize i = 1; i < self->n_ops; i++)
{
gsk_curve_init (&curve, self->ops[i]);
self->lengths[i] = self->lengths[i - 1] + gsk_curve_get_length (&curve);
}
self->length = self->lengths[self->n_ops - 1];
g_once_init_leave (&self->has_length, 1);
}
}
static gboolean
gsk_standard_contour_foreach (const GskContour *contour,
float tolerance,
@@ -399,6 +444,14 @@ gsk_standard_contour_get_winding (const GskContour *contour,
return winding;
}
static gsize
gsk_standard_contour_get_n_ops (const GskContour *contour)
{
GskStandardContour *self = (GskStandardContour *) contour;
return self->n_ops;
}
static gboolean
gsk_standard_contour_get_closest_point (const GskContour *contour,
const graphene_point_t *point,
@@ -420,8 +473,8 @@ gsk_standard_contour_get_closest_point (const GskContour *contour,
if (dist <= threshold)
{
*out_dist = dist;
result->data.std.idx = 0;
result->data.std.t = 0;
result->idx = 0;
result->t = 0;
return TRUE;
}
@@ -437,7 +490,8 @@ gsk_standard_contour_get_closest_point (const GskContour *contour,
continue;
gsk_curve_init (&c, self->ops[i]);
if (gsk_curve_get_closest_point (&c, point, threshold, &distance, &t))
if (gsk_curve_get_closest_point (&c, point, threshold, &distance, &t) &&
distance < threshold)
{
best_idx = i;
best_t = t;
@@ -448,8 +502,8 @@ gsk_standard_contour_get_closest_point (const GskContour *contour,
if (best_idx != G_MAXUINT)
{
*out_dist = threshold;
result->data.std.idx = best_idx;
result->data.std.t = best_t;
result->idx = best_idx;
result->t = best_t;
return TRUE;
}
@@ -464,14 +518,14 @@ gsk_standard_contour_get_position (const GskContour *contour,
GskStandardContour *self = (GskStandardContour *) contour;
GskCurve curve;
if (G_UNLIKELY (point->data.std.idx == 0))
if (G_UNLIKELY (point->idx == 0))
{
*position = self->points[0];
return;
}
gsk_curve_init (&curve, self->ops[point->data.std.idx]);
gsk_curve_get_point (&curve, point->data.std.t, position);
gsk_curve_init (&curve, self->ops[point->idx]);
gsk_curve_get_point (&curve, point->t, position);
}
static void
@@ -485,19 +539,20 @@ gsk_standard_contour_get_tangent (const GskContour *contour,
gsize idx;
float t;
if (G_UNLIKELY (point->data.std.idx == 0))
if (G_UNLIKELY (point->idx == 0))
{
graphene_vec2_init (tangent, 1, 0);
return;
}
idx = point->data.std.idx;
t = point->data.std.t;
idx = point->idx;
t = point->t;
if (t == 0 && direction == GSK_PATH_START)
if (t == 0 && (direction == GSK_PATH_FROM_START ||
direction == GSK_PATH_TO_START))
{
/* Look at the previous segment */
if (idx > 0)
if (idx > 1)
{
idx--;
t = 1;
@@ -508,7 +563,8 @@ gsk_standard_contour_get_tangent (const GskContour *contour,
t = 1;
}
}
else if (t == 1 && direction == GSK_PATH_END)
else if (t == 1 && (direction == GSK_PATH_TO_END ||
direction == GSK_PATH_FROM_END))
{
/* Look at the next segment */
if (idx < self->n_ops - 1)
@@ -518,13 +574,16 @@ gsk_standard_contour_get_tangent (const GskContour *contour,
}
else if (self->flags & GSK_PATH_CLOSED)
{
idx = 0;
idx = 1;
t = 0;
}
}
gsk_curve_init (&curve, self->ops[idx]);
gsk_curve_get_tangent (&curve, t, tangent);
if (direction == GSK_PATH_TO_START || direction == GSK_PATH_FROM_END)
graphene_vec2_negate (tangent, tangent);
}
static float
@@ -535,11 +594,163 @@ gsk_standard_contour_get_curvature (const GskContour *contour,
GskStandardContour *self = (GskStandardContour *) contour;
GskCurve curve;
if (G_UNLIKELY (point->data.std.idx == 0))
if (G_UNLIKELY (point->idx == 0))
return 0;
gsk_curve_init (&curve, self->ops[point->data.std.idx]);
return gsk_curve_get_curvature (&curve, point->data.std.t, center);
gsk_curve_init (&curve, self->ops[point->idx]);
return gsk_curve_get_curvature (&curve, point->t, center);
}
static void
add_curve (GskCurve *curve,
GskPathBuilder *builder,
gboolean *emit_move_to)
{
if (*emit_move_to)
{
const graphene_point_t *s;
s = gsk_curve_get_start_point (curve);
gsk_path_builder_move_to (builder, s->x, s->y);
*emit_move_to = FALSE;
}
gsk_curve_builder_to (curve, builder);
}
static void
gsk_standard_contour_add_segment (const GskContour *contour,
GskPathBuilder *builder,
gboolean emit_move_to,
GskRealPathPoint *start,
GskRealPathPoint *end)
{
GskStandardContour *self = (GskStandardContour *) contour;
GskCurve c, c1, c2;
g_assert (start->idx < self->n_ops);
gsk_curve_init (&c, self->ops[start->idx]);
if (start->idx == end->idx)
{
gsk_curve_segment (&c, start->t, end->t, &c1);
add_curve (&c1, builder, &emit_move_to);
return;
}
if (start->t == 0)
{
add_curve (&c, builder, &emit_move_to);
}
else if (start->t < 1)
{
gsk_curve_split (&c, start->t, &c1, &c2);
add_curve (&c2, builder, &emit_move_to);
}
for (gsize i = start->idx + 1; i < end->idx; i++)
{
gsk_curve_init (&c, self->ops[i]);
add_curve (&c, builder, &emit_move_to);
}
gsk_curve_init (&c, self->ops[end->idx]);
if (c.op == GSK_PATH_CLOSE)
c.op = GSK_PATH_LINE;
if (end->t == 1)
{
add_curve (&c, builder, &emit_move_to);
}
else if (end->t > 0)
{
gsk_curve_split (&c, end->t, &c1, &c2);
add_curve (&c1, builder, &emit_move_to);
}
}
static void
gsk_standard_contour_get_point (const GskContour *contour,
float distance,
float precision,
GskRealPathPoint *result)
{
const GskStandardContour *self = (const GskStandardContour *) contour;
gsize i, i0, i1;
gsk_standard_contour_ensure_lengths (contour);
distance = CLAMP (distance, 0, self->length);
i0 = 0;
i1 = self->n_ops - 1;
while (i0 + 1 < i1)
{
i = (i0 + i1) / 2;
if (self->lengths[i] < distance)
i0 = i;
else
i1 = i;
}
g_assert (self->lengths[i0] <= distance && distance <= self->lengths[i1]);
if (distance >= self->lengths[i1])
{
if (i1 == self->n_ops - 1)
{
result->idx = i1;
result->t = 1;
}
else
{
result->idx = i1 + 1;
result->t = 0;
}
}
else
{
GskCurve curve;
gsk_curve_init (&curve, self->ops[i1]);
result->idx = i1;
result->t = gsk_curve_at_length (&curve, distance - self->lengths[i1 - 1], precision);
}
}
static float
gsk_standard_contour_get_distance (const GskContour *contour,
GskRealPathPoint *point)
{
const GskStandardContour *self = (const GskStandardContour *) contour;
GskCurve curve, curve1;
if (G_UNLIKELY (point->idx == 0))
return 0;
gsk_standard_contour_ensure_lengths (contour);
if (point->t == 0)
return self->lengths[point->idx - 1];
else if (point->t == 1)
return self->lengths[point->idx];
else
{
gsk_curve_init (&curve, self->ops[point->idx]);
gsk_curve_split (&curve, point->t, &curve1, NULL);
return self->lengths[point->idx - 1] + gsk_curve_get_length (&curve1);
}
}
static float
gsk_standard_contour_get_length (const GskContour *contour)
{
const GskStandardContour *self = (const GskStandardContour *) contour;
gsk_standard_contour_ensure_lengths (contour);
return self->length;
}
static const GskContourClass GSK_STANDARD_CONTOUR_CLASS =
@@ -556,10 +767,15 @@ static const GskContourClass GSK_STANDARD_CONTOUR_CLASS =
gsk_standard_contour_foreach,
gsk_standard_contour_reverse,
gsk_standard_contour_get_winding,
gsk_standard_contour_get_n_ops,
gsk_standard_contour_get_closest_point,
gsk_standard_contour_get_position,
gsk_standard_contour_get_tangent,
gsk_standard_contour_get_curvature,
gsk_standard_contour_add_segment,
gsk_standard_contour_get_point,
gsk_standard_contour_get_distance,
gsk_standard_contour_get_length,
};
/* You must ensure the contour has enough size allocated,
@@ -584,14 +800,17 @@ gsk_standard_contour_init (GskContour *contour,
self->n_ops = n_ops;
self->n_points = n_points;
self->points = (graphene_point_t *) &self->ops[n_ops];
self->lengths = (float *) &self->points[n_points];
memcpy (self->points, points, sizeof (graphene_point_t) * n_points);
memset (self->lengths, 0, sizeof (float) * n_ops);
offset += self->points - points;
for (i = 0; i < n_ops; i++)
{
self->ops[i] = gsk_pathop_encode (gsk_pathop_op (ops[i]),
gsk_pathop_points (ops[i]) + offset);
}
self->ops[i] = gsk_pathop_encode (gsk_pathop_op (ops[i]),
gsk_pathop_points (ops[i]) + offset);
self->length = 0.f;
self->has_length = 0;
}
GskContour *
@@ -706,6 +925,12 @@ gsk_contour_get_closest_point (const GskContour *self,
return self->klass->get_closest_point (self, point, threshold, result, out_dist);
}
gsize
gsk_contour_get_n_ops (const GskContour *self)
{
return self->klass->get_n_ops (self);
}
void
gsk_contour_get_position (const GskContour *self,
GskRealPathPoint *point,
@@ -731,6 +956,38 @@ gsk_contour_get_curvature (const GskContour *self,
return self->klass->get_curvature (self, point, center);
}
void
gsk_contour_add_segment (const GskContour *self,
GskPathBuilder *builder,
gboolean emit_move_to,
GskRealPathPoint *start,
GskRealPathPoint *end)
{
self->klass->add_segment (self, builder, emit_move_to, start, end);
}
void
gsk_contour_get_point (const GskContour *self,
float distance,
float precision,
GskRealPathPoint *result)
{
self->klass->get_point (self, distance, precision, result);
}
float
gsk_contour_get_distance (const GskContour *self,
GskRealPathPoint *point)
{
return self->klass->get_distance (self, point);
}
float
gsk_contour_get_length (const GskContour *self)
{
return self->klass->get_length (self);
}
/* }}} */
/* vim:set foldmethod=marker expandtab: */
+15
View File
@@ -57,6 +57,7 @@ void gsk_contour_get_start_end (const GskContou
graphene_point_t *end);
int gsk_contour_get_winding (const GskContour *self,
const graphene_point_t *point);
gsize gsk_contour_get_n_ops (const GskContour *self);
gboolean gsk_contour_get_closest_point (const GskContour *self,
const graphene_point_t *point,
float threshold,
@@ -72,5 +73,19 @@ void gsk_contour_get_tangent (const GskContou
float gsk_contour_get_curvature (const GskContour *self,
GskRealPathPoint *point,
graphene_point_t *center);
void gsk_contour_add_segment (const GskContour *self,
GskPathBuilder *builder,
gboolean emit_move_to,
GskRealPathPoint *start,
GskRealPathPoint *end);
void gsk_contour_get_point (const GskContour *self,
float distance,
float precision,
GskRealPathPoint *result);
float gsk_contour_get_distance (const GskContour *self,
GskRealPathPoint *point);
float gsk_contour_get_length (const GskContour *self);
G_END_DECLS
+136 -57
View File
@@ -76,6 +76,8 @@ struct _GskCurveClass
GskBoundingBox *bounds);
void (* get_tight_bounds) (const GskCurve *curve,
GskBoundingBox *bounds);
void (* get_derivative) (const GskCurve *curve,
GskCurve *derivative);
};
/* {{{ Utilities */
@@ -311,6 +313,19 @@ gsk_line_curve_get_bounds (const GskCurve *curve,
gsk_bounding_box_init (bounds, &pts[0], &pts[1]);
}
static void
gsk_line_curve_get_derivative (const GskCurve *curve,
GskCurve *deriv)
{
const GskLineCurve *self = &curve->line;
graphene_point_t p;
p.x = self->points[1].x - self->points[0].x;
p.y = self->points[1].y - self->points[0].y;
gsk_line_curve_init_from_points (&deriv->line, GSK_PATH_LINE, &p, &p);
}
static const GskCurveClass GSK_LINE_CURVE_CLASS = {
gsk_line_curve_init,
gsk_line_curve_init_foreach,
@@ -330,6 +345,7 @@ static const GskCurveClass GSK_LINE_CURVE_CLASS = {
gsk_line_curve_decompose_curve,
gsk_line_curve_get_bounds,
gsk_line_curve_get_bounds,
gsk_line_curve_get_derivative,
};
/* }}} */
@@ -670,6 +686,21 @@ gsk_quad_curve_get_tight_bounds (const GskCurve *curve,
}
}
static void
gsk_quad_curve_get_derivative (const GskCurve *curve,
GskCurve *deriv)
{
const GskQuadCurve *self = &curve->quad;
graphene_point_t p[2];
p[0].x = 2.f * (self->points[1].x - self->points[0].x);
p[0].y = 2.f * (self->points[1].y - self->points[0].y);
p[1].x = 2.f * (self->points[2].x - self->points[1].x);
p[1].y = 2.f * (self->points[2].y - self->points[1].y);
gsk_line_curve_init_from_points (&deriv->line, GSK_PATH_LINE, &p[0], &p[1]);
}
static const GskCurveClass GSK_QUAD_CURVE_CLASS = {
gsk_quad_curve_init,
gsk_quad_curve_init_foreach,
@@ -689,6 +720,7 @@ static const GskCurveClass GSK_QUAD_CURVE_CLASS = {
gsk_quad_curve_decompose_curve,
gsk_quad_curve_get_bounds,
gsk_quad_curve_get_tight_bounds,
gsk_quad_curve_get_derivative,
};
/* }}} */
@@ -859,61 +891,6 @@ gsk_cubic_curve_reverse (const GskCurve *curve,
reverse->cubic.has_coefficients = FALSE;
}
static void
gsk_curve_get_derivative (const GskCurve *curve,
GskCurve *deriv)
{
switch (curve->op)
{
case GSK_PATH_LINE:
{
const GskLineCurve *self = &curve->line;
graphene_point_t p;
p.x = self->points[1].x - self->points[0].x;
p.y = self->points[1].y - self->points[0].y;
gsk_line_curve_init_from_points (&deriv->line, GSK_PATH_LINE, &p, &p);
}
break;
case GSK_PATH_QUAD:
{
const GskQuadCurve *self = &curve->quad;
graphene_point_t p[2];
p[0].x = 2.f * (self->points[1].x - self->points[0].x);
p[0].y = 2.f * (self->points[1].y - self->points[0].y);
p[1].x = 2.f * (self->points[2].x - self->points[1].x);
p[1].y = 2.f * (self->points[2].y - self->points[1].y);
gsk_line_curve_init_from_points (&deriv->line, GSK_PATH_LINE, &p[0], &p[1]);
}
break;
case GSK_PATH_CUBIC:
{
const GskCubicCurve *self = &curve->cubic;
graphene_point_t p[3];
p[0].x = 3.f * (self->points[1].x - self->points[0].x);
p[0].y = 3.f * (self->points[1].y - self->points[0].y);
p[1].x = 3.f * (self->points[2].x - self->points[1].x);
p[1].y = 3.f * (self->points[2].y - self->points[1].y);
p[2].x = 3.f * (self->points[3].x - self->points[2].x);
p[2].y = 3.f * (self->points[3].y - self->points[2].y);
gsk_quad_curve_init_from_points (&deriv->quad, p);
}
break;
case GSK_PATH_MOVE:
case GSK_PATH_CLOSE:
default:
g_assert_not_reached ();
}
}
static inline float
cross (const graphene_vec2_t *v1,
const graphene_vec2_t *v2)
@@ -928,6 +905,9 @@ pow3 (float w)
return w * w * w;
}
static void gsk_cubic_curve_get_derivative (const GskCurve *curve,
GskCurve *deriv);
static float
gsk_cubic_curve_get_curvature (const GskCurve *curve,
float t)
@@ -937,8 +917,8 @@ gsk_cubic_curve_get_curvature (const GskCurve *curve,
graphene_vec2_t d, dd;
float num, denom;
gsk_curve_get_derivative (curve, &c1);
gsk_curve_get_derivative (&c1, &c2);
gsk_cubic_curve_get_derivative (curve, &c1);
gsk_quad_curve_get_derivative (&c1, &c2);
gsk_curve_get_point (&c1, t, &p);
gsk_curve_get_point (&c2, t, &pp);
@@ -1150,6 +1130,23 @@ gsk_cubic_curve_get_tight_bounds (const GskCurve *curve,
}
}
static void
gsk_cubic_curve_get_derivative (const GskCurve *curve,
GskCurve *deriv)
{
const GskCubicCurve *self = &curve->cubic;
graphene_point_t p[3];
p[0].x = 3.f * (self->points[1].x - self->points[0].x);
p[0].y = 3.f * (self->points[1].y - self->points[0].y);
p[1].x = 3.f * (self->points[2].x - self->points[1].x);
p[1].y = 3.f * (self->points[2].y - self->points[1].y);
p[2].x = 3.f * (self->points[3].x - self->points[2].x);
p[2].y = 3.f * (self->points[3].y - self->points[2].y);
gsk_quad_curve_init_from_points (&deriv->quad, p);
}
static const GskCurveClass GSK_CUBIC_CURVE_CLASS = {
gsk_cubic_curve_init,
gsk_cubic_curve_init_foreach,
@@ -1169,6 +1166,7 @@ static const GskCurveClass GSK_CUBIC_CURVE_CLASS = {
gsk_cubic_curve_decompose_curve,
gsk_cubic_curve_get_bounds,
gsk_cubic_curve_get_tight_bounds,
gsk_cubic_curve_get_derivative,
};
/* }}} */
@@ -1359,6 +1357,13 @@ gsk_curve_get_tight_bounds (const GskCurve *curve,
get_class (curve->op)->get_tight_bounds (curve, bounds);
}
void
gsk_curve_get_derivative (const GskCurve *curve,
GskCurve *deriv)
{
get_class (curve->op)->get_derivative (curve, deriv);
}
static inline int
line_get_crossing (const graphene_point_t *p,
const graphene_point_t *p1,
@@ -1528,6 +1533,80 @@ gsk_curve_get_closest_point (const GskCurve *curve,
return find_closest_point (curve, point, threshold, 0, 1, out_dist, out_t);
}
/* Legendre-Gauss values for n=64,
* see https://pomax.github.io/bezierinfo/legendre-gauss.html
*/
#include "ct-values.c"
/* Compute arclength by using Gauss quadrature on
*
* \int_0^z \sqrt{ (dx/dt)^2 + (dy/dt)^2 } dt
*/
float
gsk_curve_get_length (const GskCurve *curve)
{
double z = 0.5;
double sum;
GskCurve derivative;
graphene_point_t d;
if (curve->op == GSK_PATH_LINE ||
curve->op == GSK_PATH_CLOSE)
return graphene_point_distance (gsk_curve_get_start_point (curve),
gsk_curve_get_end_point (curve),
NULL, NULL);
gsk_curve_get_derivative (curve, &derivative);
sum = 0;
for (unsigned int i = 0; i < G_N_ELEMENTS (T); i++)
{
double t = z * T[i] + z;
gsk_curve_get_point (&derivative, t, &d);
sum += C[i] * sqrt (d.x * d.x + d.y * d.y);
}
return z * sum;
}
/* Compute the inverse of the arclength using bisection,
* to a given precision
*/
float
gsk_curve_at_length (const GskCurve *curve,
float length,
float epsilon)
{
float t1, t2, t, l;
GskCurve c1;
g_assert (epsilon >= FLT_EPSILON);
t1 = 0;
t2 = 1;
while (t1 < t2)
{
t = (t1 + t2) / 2;
if (t == t1 || t == t2)
break;
gsk_curve_split (curve, t, &c1, NULL);
l = gsk_curve_get_length (&c1);
if (fabsf (length - l) < epsilon)
break;
else if (l < length)
t1 = t;
else
t2 = t;
}
return t;
}
/* }}} */
/* vim:set foldmethod=marker expandtab: */
+7
View File
@@ -145,6 +145,8 @@ void gsk_curve_get_bounds (const GskCurve
void gsk_curve_get_tight_bounds (const GskCurve *curve,
GskBoundingBox *bounds);
void gsk_curve_get_derivative (const GskCurve *curve,
GskCurve *derivative);
int gsk_curve_get_crossing (const GskCurve *curve,
const graphene_point_t *point);
gboolean gsk_curve_get_closest_point (const GskCurve *curve,
@@ -152,6 +154,11 @@ gboolean gsk_curve_get_closest_point (const GskCurve
float threshold,
float *out_dist,
float *out_t);
float gsk_curve_get_length (const GskCurve *curve);
float gsk_curve_at_length (const GskCurve *curve,
float distance,
float epsilon);
G_END_DECLS
+45 -12
View File
@@ -1,5 +1,5 @@
/* GSK - The GTK Scene Kit
* Copyright 2016 Endless
* Copyright 2016 Endless
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -42,8 +42,6 @@
* @GSK_REPEAT_NODE: A node that repeats the child's contents
* @GSK_CLIP_NODE: A node that clips its child to a rectangular area
* @GSK_ROUNDED_CLIP_NODE: A node that clips its child to a rounded rectangle
* @GSK_FILL_NODE: A node that fills a path
* @GSK_STROKE_NODE: A node that strokes a path
* @GSK_SHADOW_NODE: A node that draws a shadow below its child
* @GSK_BLEND_NODE: A node that blends two children together
* @GSK_CROSS_FADE_NODE: A node that cross-fades between two children
@@ -53,7 +51,9 @@
* @GSK_GL_SHADER_NODE: A node that uses OpenGL fragment shaders to render
* @GSK_TEXTURE_SCALE_NODE: A node drawing a `GdkTexture` scaled and filtered (Since: 4.10)
* @GSK_MASK_NODE: A node that masks one child with another (Since: 4.10)
* @GSK_FILL_NODE: A node that fills a path
* @GSK_STROKE_NODE: A node that strokes a path
* The type of a node determines what the node is rendering.
*/
typedef enum {
@@ -76,8 +76,6 @@ typedef enum {
GSK_REPEAT_NODE,
GSK_CLIP_NODE,
GSK_ROUNDED_CLIP_NODE,
GSK_FILL_NODE,
GSK_STROKE_NODE,
GSK_SHADOW_NODE,
GSK_BLEND_NODE,
GSK_CROSS_FADE_NODE,
@@ -86,7 +84,9 @@ typedef enum {
GSK_DEBUG_NODE,
GSK_GL_SHADER_NODE,
GSK_TEXTURE_SCALE_NODE,
GSK_MASK_NODE
GSK_MASK_NODE,
GSK_FILL_NODE,
GSK_STROKE_NODE
} GskRenderNodeType;
/**
@@ -222,6 +222,14 @@ typedef enum {
*
* New entries may be added in future versions.
*
* <figure>
* <picture>
* <source srcset="caps-dark.png" media="(prefers-color-scheme: dark)">
* <img alt="Line Cap Styles" src="caps-light.png">
* </picture>
* <figcaption>GSK_LINE_CAP_BUTT, GSK_LINE_CAP_ROUND, GSK_LINE_CAP_SQUARE</figcaption>
* </figure>
*
* Since: 4.14
*/
typedef enum {
@@ -244,6 +252,14 @@ typedef enum {
*
* New entries may be added in future versions.
*
* <figure>
* <picture>
* <source srcset="join-dark.png" media="(prefers-color-scheme: dark)">
* <img alt="Line Join Styles" src="join-light.png">
* </picture>
* <figcaption>GSK_LINE_JOINT_MITER, GSK_LINE_JOINT_ROUND, GSK_LINE_JOIN_BEVEL</figcaption>
* </figure>
*
* Since: 4.14
*/
typedef enum {
@@ -282,17 +298,34 @@ typedef enum {
/**
* GskPathDirection:
* @GSK_PATH_START: The side that leads to the start of the path
* @GSK_PATH_END: The side that leads to the end of the path
* @GSK_PATH_FROM_START: The tangent in path direction of the incoming side
* of the path
* @GSK_PATH_TO_START: The tangent against path direction of the incoming side
* of the path
* @GSK_PATH_TO_END: The tangent in path direction of the outgoing side
* of the path
* @GSK_PATH_FROM_END: The tangent against path direction of the outgoing
* side of the path
*
* The values of the `GskPathDirection` enum are used to pick one
* of the two sides of the path that at a given point on the path.
* of the four tangents at a given point on the path.
*
* Note that the directions for @GSK_PATH_FROM_START/@GSK_PATH_TO_END and
* @GSK_PATH_TO_START/@GSK_PATH_FROM_END will coincide for smooth points.
* Only sharp turns will exhibit four different directions.
*
* <picture>
* <source srcset="directions-dark.png" media="(prefers-color-scheme: dark)">
* <img alt="Path Tangents" src="directions-light.png">
* </picture>
*
* Since: 4.14
*/
typedef enum {
GSK_PATH_START,
GSK_PATH_END
GSK_PATH_FROM_START,
GSK_PATH_TO_START,
GSK_PATH_TO_END,
GSK_PATH_FROM_END,
} GskPathDirection;
/**
+201 -7
View File
@@ -30,18 +30,26 @@
* GskPath:
*
* A `GskPath` describes lines and curves that are more complex
* than simple rectangles. Paths can used for rendering (filling or
* stroking) and for animations (e.g. as trajectories).
* than simple rectangles.
*
* Paths can used for rendering (filling or stroking) and for animations
* (e.g. as trajectories).
*
* `GskPath` is an immutable, opaque, reference-counted struct.
* After creation, you cannot change the types it represents.
* Instead, new `GskPath` objects have to be created.
*
* The [struct@Gsk.PathBuilder] structure is meant to help in this endeavor.
* After creation, you cannot change the types it represents. Instead,
* new `GskPath` objects have to be created. The [struct@Gsk.PathBuilder]
* structure is meant to help in this endeavor.
*
* Conceptually, a path consists of zero or more contours (continous, connected
* curves), each of which may or may not be closed. Contours are typically
* constructed from Bézier segments.
*
* <picture>
* <source srcset="path-dark.png" media="(prefers-color-scheme: dark)">
* <img alt="A Path" src="path-light.png">
* </picture>
*
* Since: 4.14
*/
struct _GskPath
@@ -420,6 +428,7 @@ gsk_path_get_bounds (GskPath *self,
*
* Returns: `TRUE` if the path has bounds, `FALSE` if the path is known
* to be empty and have no bounds.
* Since: 4.14
*/
gboolean
gsk_path_get_stroke_bounds (GskPath *self,
@@ -490,6 +499,72 @@ gsk_path_in_fill (GskPath *self,
}
}
/**
* gsk_path_get_start_point:
* @self: a `GskPath`
* @result: (out caller-allocates): return location for point
*
* Gets the start point of the path.
*
* An empty path has no points, so `FALSE`
* is returned in this case.
*
* Returns: `TRUE` if @result was filled
*
* Since: 4.14
*/
gboolean
gsk_path_get_start_point (GskPath *self,
GskPathPoint *result)
{
GskRealPathPoint *res = (GskRealPathPoint *) result;
g_return_val_if_fail (self != NULL, FALSE);
g_return_val_if_fail (result != NULL, FALSE);
if (self->n_contours == 0)
return FALSE;
res->contour = 0;
res->idx = 1;
res->t = 0;
return TRUE;
}
/**
* gsk_path_get_end_point:
* @self: a `GskPath`
* @result: (out caller-allocates): return location for point
*
* Gets the end point of the path.
*
* An empty path has no points, so `FALSE`
* is returned in this case.
*
* Returns: `TRUE` if @result was filled
*
* Since: 4.14
*/
gboolean
gsk_path_get_end_point (GskPath *self,
GskPathPoint *result)
{
GskRealPathPoint *res = (GskRealPathPoint *) result;
g_return_val_if_fail (self != NULL, FALSE);
g_return_val_if_fail (result != NULL, FALSE);
if (self->n_contours == 0)
return FALSE;
res->contour = self->n_contours - 1;
res->idx = gsk_contour_get_n_ops (self->contours[self->n_contours - 1]) - 1;
res->t = 1;
return TRUE;
}
/**
* gsk_path_get_closest_point:
* @self: a `GskPath`
@@ -532,7 +607,6 @@ gsk_path_get_closest_point (GskPath *self,
{
found = TRUE;
res->contour = i;
res->path = self;
threshold = distance;
}
}
@@ -939,6 +1013,22 @@ parse_circle (const char **p,
* [SVG path syntax](https://www.w3.org/TR/SVG11/paths.html#PathData),
* as e.g. produced by [method@Gsk.Path.to_string].
*
* A high-level summary of the syntax:
*
* - `M x y` Move to `(x, y)`
* - `L x y` Add a line from the current point to `(x, y)`
* - `Q x1 y1 x2 y2` Add a quadratic Bézier from the current point to `(x2, y2)`, with control point `(x1, y1)`
* - `C x1 y1 x2 y2 x3 y3` Add a cubic Bézier from the current point to `(x3, y3)`, with control points `(x1, y1)` and `(x2, y2)`
* - `Z` Close the contour by drawing a line back to the start point
* - `H x` Add a horizontal line from the current point to the given x value
* - `V y` Add a vertical line from the current point to the given y value
* - `T x2 y2` Add a quadratic Bézier, using the reflection of the previous segments' control point as control point
* - `S x2 y2 x3 y3` Add a cubic Bézier, using the reflection of the previous segments' second control point as first control point
* - `A rx ry r l s x y` Add an elliptical arc from the current point to `(x, y)` with radii rx and ry. See the SVG documentation for how the other parameters influence the arc.
*
* All the commands have lowercase variants that interpret coordinates
* relative to the current point.
*
* Returns: (nullable): a new `GskPath`, or `NULL`
* if @string could not be parsed
*
@@ -1323,3 +1413,107 @@ error:
return NULL;
}
/**
* gsk_path_get_length:
* @self: a `GskPath`
*
* Returns the length of the path.
*
* Returns: the length of @self
*
* Since: 4.14
*/
float
gsk_path_get_length (GskPath *self)
{
float length = 0;
g_return_val_if_fail (self != NULL, 0);
for (gsize i = 0; i < self->n_contours; i++)
{
length += gsk_contour_get_length (self->contours[i]);
}
return length;
}
/**
* gsk_path_get_point:
* @self: a `GskPath`
* @distance: the distance
* @result: (out caller-allocates): return location for the point
*
* Computes the point that is at the given
* distance from the beginning of the path.
*
* An empty path has no points, so `FALSE`
* is returned in this case.
*
* Returns: `TRUE` if @result was filled
*
* Since: 4.14
*/
gboolean
gsk_path_get_point (GskPath *self,
float distance,
GskPathPoint *result)
{
GskRealPathPoint *res = (GskRealPathPoint *) result;
gsize i;
g_return_val_if_fail (self != NULL, 0);
g_return_val_if_fail (result != NULL, 0);
if (self->n_contours == 0)
return FALSE;
for (i = 0; i < self->n_contours - 1; i++)
{
float length = gsk_contour_get_length (self->contours[i]);
if (distance < length)
break;
distance -= length;
}
gsk_contour_get_point (self->contours[i], distance, 0.0001, res);
res->contour = i;
return TRUE;
}
/**
* gsk_path_point_get_distance:
* @point: a `GskPathPoint
* @path: the `GskPath` that @point is on
*
* Returns the distance from the beginning of the path to @point.
*
* Returns: the distance of @point
*
* Since: 4.14
*/
float
gsk_path_point_get_distance (const GskPathPoint *point,
GskPath *path)
{
GskRealPathPoint *p = (GskRealPathPoint *)point;
float distance = 0;
g_return_val_if_fail (point != NULL, 0);
g_return_val_if_fail (path != NULL, 0);
g_return_val_if_fail (p->contour < path->n_contours, 0);
for (gsize i = 0; i < path->n_contours; i++)
{
if (i == p->contour)
return distance + gsk_contour_get_distance (path->contours[i], p);
distance += gsk_contour_get_length (path->contours[i]);
}
g_return_val_if_reached (0);
}
+17
View File
@@ -41,6 +41,8 @@ G_BEGIN_DECLS
* By default, [method@Gsk.Path.foreach] will only emit a path with all operations
* flattened to straight lines to allow for maximum compatibility. The only
* operations emitted will be `GSK_PATH_MOVE`, `GSK_PATH_LINE` and `GSK_PATH_CLOSE`.
*
* Since: 4.14
*/
typedef enum
{
@@ -110,6 +112,13 @@ gboolean gsk_path_in_fill (GskPath
const graphene_point_t *point,
GskFillRule fill_rule);
GDK_AVAILABLE_IN_4_14
gboolean gsk_path_get_start_point (GskPath *self,
GskPathPoint *result);
GDK_AVAILABLE_IN_4_14
gboolean gsk_path_get_end_point (GskPath *self,
GskPathPoint *result);
GDK_AVAILABLE_IN_4_14
gboolean gsk_path_get_closest_point (GskPath *self,
const graphene_point_t *point,
@@ -122,6 +131,14 @@ gboolean gsk_path_foreach (GskPath
GskPathForeachFunc func,
gpointer user_data);
GDK_AVAILABLE_IN_4_14
float gsk_path_get_length (GskPath *self);
GDK_AVAILABLE_IN_4_14
gboolean gsk_path_get_point (GskPath *self, float distance,
GskPathPoint *result);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GskPath, gsk_path_unref)
G_END_DECLS
+186
View File
@@ -54,6 +54,9 @@
* either common shapes like [method@Gsk.PathBuilder.add_circle]
* or by adding from other paths like [method@Gsk.PathBuilder.add_path].
*
* The `gsk_path_builder_add_*` methods always add complete contours,
* and do not use or modify the current point.
*
* The other option is to define each line and curve manually with
* the `gsk_path_builder_*_to` group of functions. You start with
* a call to [method@Gsk.PathBuilder.move_to] to set the starting point
@@ -63,6 +66,8 @@
* back with a line to the starting point.
*
* This is similar for how paths are drawn in Cairo.
*
* Since: 4.14
*/
struct _GskPathBuilder
@@ -388,9 +393,13 @@ void
gsk_path_builder_add_cairo_path (GskPathBuilder *self,
const cairo_path_t *path)
{
graphene_point_t current;
g_return_if_fail (self != NULL);
g_return_if_fail (path != NULL);
current = self->current_point;
for (gsize i = 0; i < path->num_data; i += path->data[i].header.length)
{
const cairo_path_data_t *data = &path->data[i];
@@ -421,6 +430,9 @@ gsk_path_builder_add_cairo_path (GskPathBuilder *self,
break;
}
}
gsk_path_builder_end_current (self);
self->current_point = current;
}
/**
@@ -430,6 +442,8 @@ gsk_path_builder_add_cairo_path (GskPathBuilder *self,
*
* Adds @rect as a new contour to the path built by the builder.
*
* The path is going around the rectangle in clockwise direction.
*
* If the width or height of the rectangle is negative, the start
* point will be on the right or bottom, respectively.
*
@@ -442,8 +456,12 @@ void
gsk_path_builder_add_rect (GskPathBuilder *self,
const graphene_rect_t *rect)
{
graphene_point_t current;
g_return_if_fail (self != NULL);
current = self->current_point;
gsk_path_builder_move_to (self, rect->origin.x, rect->origin.y);
gsk_path_builder_rel_line_to (self, rect->size.width, 0);
@@ -451,6 +469,81 @@ gsk_path_builder_add_rect (GskPathBuilder *self,
gsk_path_builder_rel_line_to (self, - rect->size.width, 0);
gsk_path_builder_close (self);
self->current_point = current;
}
/**
* gsk_path_builder_add_rounded_rect:
* @self: a #GskPathBuilder
* @rect: the rounded rect
*
* Adds @rect as a new contour to the path built in @self.
*
* The path is going around the rectangle in clockwise direction.
*
* Since: 4.14
*/
void
gsk_path_builder_add_rounded_rect (GskPathBuilder *self,
const GskRoundedRect *rect)
{
graphene_point_t current;
g_return_if_fail (self != NULL);
g_return_if_fail (rect != NULL);
current = self->current_point;
gsk_path_builder_move_to (self,
rect->bounds.origin.x + rect->corner[GSK_CORNER_TOP_LEFT].width,
rect->bounds.origin.y);
/* top */
gsk_path_builder_line_to (self,
rect->bounds.origin.x + rect->bounds.size.width - rect->corner[GSK_CORNER_TOP_RIGHT].width,
rect->bounds.origin.y);
/* topright corner */
gsk_path_builder_svg_arc_to (self,
rect->corner[GSK_CORNER_TOP_RIGHT].width,
rect->corner[GSK_CORNER_TOP_RIGHT].height,
0, FALSE, TRUE,
rect->bounds.origin.x + rect->bounds.size.width,
rect->bounds.origin.y + rect->corner[GSK_CORNER_TOP_RIGHT].height);
/* right */
gsk_path_builder_line_to (self,
rect->bounds.origin.x + rect->bounds.size.width,
rect->bounds.origin.y + rect->bounds.size.height - rect->corner[GSK_CORNER_BOTTOM_RIGHT].height);
/* bottomright corner */
gsk_path_builder_svg_arc_to (self,
rect->corner[GSK_CORNER_BOTTOM_RIGHT].width,
rect->corner[GSK_CORNER_BOTTOM_RIGHT].height,
0, FALSE, TRUE,
rect->bounds.origin.x + rect->bounds.size.width - rect->corner[GSK_CORNER_BOTTOM_RIGHT].width,
rect->bounds.origin.y + rect->bounds.size.height);
/* bottom */
gsk_path_builder_line_to (self,
rect->bounds.origin.x + rect->corner[GSK_CORNER_BOTTOM_LEFT].width,
rect->bounds.origin.y + rect->bounds.size.height);
/* bottomleft corner */
gsk_path_builder_svg_arc_to (self,
rect->corner[GSK_CORNER_BOTTOM_LEFT].width,
rect->corner[GSK_CORNER_BOTTOM_LEFT].height,
0, FALSE, TRUE,
rect->bounds.origin.x,
rect->bounds.origin.y + rect->bounds.size.height - rect->corner[GSK_CORNER_BOTTOM_LEFT].height);
/* left */
gsk_path_builder_line_to (self,
rect->bounds.origin.x,
rect->bounds.origin.y + rect->corner[GSK_CORNER_TOP_LEFT].height);
/* topleft corner */
gsk_path_builder_svg_arc_to (self,
rect->corner[GSK_CORNER_TOP_LEFT].width,
rect->corner[GSK_CORNER_TOP_LEFT].height,
0, FALSE, TRUE,
rect->bounds.origin.x + rect->corner[GSK_CORNER_TOP_LEFT].width,
rect->bounds.origin.y);
/* done */
gsk_path_builder_close (self);
self->current_point = current;
}
static gboolean
@@ -475,6 +568,8 @@ circle_contour_curve (const graphene_point_t pts[4],
*
* Adds a circle with the @center and @radius.
*
* The path is going around the circle in clockwise direction.
*
* Since: 4.14
*/
void
@@ -482,16 +577,22 @@ gsk_path_builder_add_circle (GskPathBuilder *self,
const graphene_point_t *center,
float radius)
{
graphene_point_t current;
g_return_if_fail (self != NULL);
g_return_if_fail (center != NULL);
g_return_if_fail (radius > 0);
current = self->current_point;
gsk_path_builder_move_to (self, center->x + radius, center->y);
gsk_spline_decompose_arc (center, radius,
GSK_PATH_TOLERANCE_DEFAULT,
0, 2 * M_PI,
circle_contour_curve, self);
gsk_path_builder_close (self);
self->current_point = current;
}
/**
@@ -983,3 +1084,88 @@ gsk_path_builder_add_layout (GskPathBuilder *self,
cairo_destroy (cr);
cairo_surface_destroy (surface);
}
/**
* gsk_path_builder_add_segment:
* @self: a `GskPathBuilder`
* @path: the `GskPath` to take the segment to
* @start: the point on @path to start at
* @end: the point on @path to end at
*
* Adds to @self the segment of @path from @start to @end.
*
* If @start is equal to or after @end, the path will first add the
* segment from @start to the end of the path, and then add the segment
* from the beginning to @end. If the path is closed, these segments
* will be connected.
*
* Note that this method always adds a path with the given start point
* and end point. To add a closed path, use [method@Gsk.PathBuilder.add_path].
*
* Since: 4.14
*/
void
gsk_path_builder_add_segment (GskPathBuilder *self,
GskPath *path,
const GskPathPoint *start,
const GskPathPoint *end)
{
GskRealPathPoint *s = (GskRealPathPoint *) start;
GskRealPathPoint *e = (GskRealPathPoint *) end;
const GskContour *contour;
gsize n_contours = gsk_path_get_n_contours (path);
graphene_point_t current;
gsize n_ops;
g_return_if_fail (self != NULL);
g_return_if_fail (path != NULL);
g_return_if_fail (start != NULL);
g_return_if_fail (end != NULL);
g_return_if_fail (s->contour < n_contours);
g_return_if_fail (e->contour < n_contours);
current = self->current_point;
contour = gsk_path_get_contour (path, s->contour);
n_ops = gsk_contour_get_n_ops (contour);
if (s->contour == e->contour)
{
if (gsk_path_point_compare (start, end) < 0)
{
gsk_contour_add_segment (contour, self, TRUE, s, e);
goto out;
}
else if (n_contours == 1)
{
if (n_ops > 1)
gsk_contour_add_segment (contour, self, TRUE,
s,
&(GskRealPathPoint) { s->contour, n_ops - 1, 1 });
gsk_contour_add_segment (contour, self, n_ops <= 1,
&(GskRealPathPoint) { s->contour, 1, 0 },
e);
goto out;
}
}
if (n_ops > 1)
gsk_contour_add_segment (contour, self, TRUE,
s,
&(GskRealPathPoint) { s->contour, n_ops - 1, 1. });
for (gsize i = (s->contour + 1) % n_contours; i != e->contour; i = (i + 1) % n_contours)
gsk_path_builder_add_contour (self, gsk_contour_dup (gsk_path_get_contour (path, i)));
contour = gsk_path_get_contour (path, e->contour);
n_ops = gsk_contour_get_n_ops (contour);
if (n_ops > 1)
gsk_contour_add_segment (contour, self, TRUE,
&(GskRealPathPoint) { e->contour, 1, 0 },
e);
out:
gsk_path_builder_end_current (self);
self->current_point = current;
}
+8 -1
View File
@@ -65,10 +65,17 @@ GDK_AVAILABLE_IN_4_14
void gsk_path_builder_add_rect (GskPathBuilder *self,
const graphene_rect_t *rect);
GDK_AVAILABLE_IN_4_14
void gsk_path_builder_add_rounded_rect (GskPathBuilder *self,
const GskRoundedRect *rect);
GDK_AVAILABLE_IN_4_14
void gsk_path_builder_add_circle (GskPathBuilder *self,
const graphene_point_t *center,
float radius);
GDK_AVAILABLE_IN_4_14
void gsk_path_builder_add_segment (GskPathBuilder *self,
GskPath *path,
const GskPathPoint *start,
const GskPathPoint *end);
GDK_AVAILABLE_IN_4_14
void gsk_path_builder_move_to (GskPathBuilder *self,
float x,
+145 -22
View File
@@ -19,12 +19,16 @@
#include "config.h"
#include <math.h>
#include "gskpathpointprivate.h"
#include "gskcontourprivate.h"
#include "gdk/gdkprivate.h"
#define RAD_TO_DEG(x) ((x) / (G_PI / 180.f))
/**
* GskPathPoint:
*
@@ -39,6 +43,8 @@
* don't a reference to the path object they are obtained from. It is the
* callers responsibility to keep a reference to the path as long as the
* `GskPathPoint` is used.
*
* Since: 4.14
*/
G_DEFINE_BOXED_TYPE (GskPathPoint, gsk_path_point,
@@ -64,10 +70,81 @@ gsk_path_point_free (GskPathPoint *point)
g_free (point);
}
/**
* gsk_path_point_equal:
* @point1: a `GskPathPoint`
* @point2: another `GskPathPoint`
*
* Returns whether the two path points refer to the same
* location on all paths.
*
* Note that the start- and endpoint of a closed contour
* will compare nonequal according to this definition.
* Use [method@Gsk.Path.is_closed] to find out if the
* start- and endpoint of a concrete path refer to the
* same location.
*
* Return: `TRUE` if @point1 and @point2 are equal
*/
gboolean
gsk_path_point_equal (const GskPathPoint *point1,
const GskPathPoint *point2)
{
const GskRealPathPoint *p1 = (const GskRealPathPoint *) point1;
const GskRealPathPoint *p2 = (const GskRealPathPoint *) point2;
if (p1->contour == p2->contour)
{
if ((p1->idx == p2->idx && p1->t == p2->t) ||
(p1->idx + 1 == p2->idx && p1->t == 1 && p2->t == 0) ||
(p1->idx == p2->idx + 1 && p1->t == 0 && p2->t == 1))
return TRUE;
}
return FALSE;
}
/**
* gsk_path_point_compare:
* @point1: a `GskPathPoint`
* @point2: another `GskPathPoint`
*
* Returns whether @point1 is before or after @point2.
*
* Returns: -1 if @point1 is before @point2,
* 1 if @point1 is after @point2,
* 0 if they are equal
*/
int
gsk_path_point_compare (const GskPathPoint *point1,
const GskPathPoint *point2)
{
const GskRealPathPoint *p1 = (const GskRealPathPoint *) point1;
const GskRealPathPoint *p2 = (const GskRealPathPoint *) point2;
if (gsk_path_point_equal (point1, point2))
return 0;
if (p1->contour < p2->contour)
return -1;
else if (p1->contour > p2->contour)
return 1;
else if (p1->idx < p2->idx)
return -1;
else if (p1->idx > p2->idx)
return 1;
else if (p1->t < p2->t)
return -1;
else if (p1->t > p2->t)
return 1;
return 0;
}
/**
* gsk_path_point_get_position:
* @path: a `GskPath`
* @point: a `GskPathPoint` on @path
* @point: a `GskPathPoint`
* @path: the path that @point is on
* @position: (out caller-allocates): Return location for
* the coordinates of the point
*
@@ -76,23 +153,26 @@ gsk_path_point_free (GskPathPoint *point)
* Since: 4.14
*/
void
gsk_path_point_get_position (GskPath *path,
const GskPathPoint *point,
gsk_path_point_get_position (const GskPathPoint *point,
GskPath *path,
graphene_point_t *position)
{
GskRealPathPoint *self = (GskRealPathPoint *) point;
const GskContour *contour = gsk_path_get_contour (path, self->contour);
const GskContour *contour;
g_return_if_fail (path == self->path);
g_return_if_fail (contour != NULL);
g_return_if_fail (self != NULL);
g_return_if_fail (path != NULL);
g_return_if_fail (position != NULL);
g_return_if_fail (self->contour < gsk_path_get_n_contours (path));
contour = gsk_path_get_contour (path, self->contour),
gsk_contour_get_position (contour, self, position);
}
/**
* gsk_path_point_get_tangent:
* @path: a `GskPath`
* @point: a `GskPathPoint` on @path
* @point: a `GskPathPoint`
* @path: the path that @point is on
* @direction: the direction for which to return the tangent
* @tangent: (out caller-allocates): Return location for
* the tangent at the point
@@ -105,28 +185,69 @@ gsk_path_point_get_position (GskPath *path,
* point, and the direction coming out of it. The @direction
* argument lets you choose which one to get.
*
* If you want to orient something in the direction of the
* path, [method@Gsk.PathPoint.get_rotation] may be more
* convenient to use.
*
* Since: 4.14
*/
void
gsk_path_point_get_tangent (GskPath *path,
const GskPathPoint *point,
gsk_path_point_get_tangent (const GskPathPoint *point,
GskPath *path,
GskPathDirection direction,
graphene_vec2_t *tangent)
{
GskRealPathPoint *self = (GskRealPathPoint *) point;
const GskContour *contour = gsk_path_get_contour (path, self->contour);
const GskContour *contour;
g_return_if_fail (path == self->path);
g_return_if_fail (contour != NULL);
g_return_if_fail (self != NULL);
g_return_if_fail (path != NULL);
g_return_if_fail (tangent != NULL);
g_return_if_fail (self->contour < gsk_path_get_n_contours (path));
contour = gsk_path_get_contour (path, self->contour),
gsk_contour_get_tangent (contour, self, direction, tangent);
}
/**
* gsk_path_point_get_rotation:
* @point: a `GskPathPoint`
* @path: the path that @point is on
* @direction: the direction for which to return the rotation
*
* Gets the direction of the tangent at a given point.
*
* This is a convenience variant of [method@Gsk.PathPoint.get_tangent]
* that returns the angle between the tangent and the X axis. The angle
* can e.g. be used in [method@Gtk.Snapshot.rotate].
*
* Returns: the angle between the tangent and the X axis, in degrees
*
* Since: 4.14
*/
float
gsk_path_point_get_rotation (const GskPathPoint *point,
GskPath *path,
GskPathDirection direction)
{
GskRealPathPoint *self = (GskRealPathPoint *) point;
graphene_vec2_t tangent;
g_return_val_if_fail (self != NULL, 0);
g_return_val_if_fail (path != NULL, 0);
g_return_val_if_fail (self->contour < gsk_path_get_n_contours (path), 0);
gsk_path_point_get_tangent (point, path, direction, &tangent);
return RAD_TO_DEG (atan2f (graphene_vec2_get_y (&tangent),
graphene_vec2_get_x (&tangent)));
}
/**
* gsk_path_point_get_curvature:
* @path: a `GskPath`
* @point: a `GskPathPoint` on @path
* @center: (out caller-allocates): Return location for
* @point: a `GskPathPoint`
* @path: the path that @point is on
* @center: (out caller-allocates) (nullable): Return location for
* the center of the osculating circle
*
* Calculates the curvature of the path at the point.
@@ -141,15 +262,17 @@ gsk_path_point_get_tangent (GskPath *path,
* Since: 4.14
*/
float
gsk_path_point_get_curvature (GskPath *path,
const GskPathPoint *point,
gsk_path_point_get_curvature (const GskPathPoint *point,
GskPath *path,
graphene_point_t *center)
{
GskRealPathPoint *self = (GskRealPathPoint *) point;
const GskContour *contour = gsk_path_get_contour (path, self->contour);
const GskContour *contour;
g_return_val_if_fail (path == self->path, 0);
g_return_val_if_fail (contour != NULL, 0);
g_return_val_if_fail (self != NULL, 0);
g_return_val_if_fail (path != NULL, 0);
g_return_val_if_fail (self->contour < gsk_path_get_n_contours (path), 0);
contour = gsk_path_get_contour (path, self->contour);
return gsk_contour_get_curvature (contour, self, center);
}
+23 -6
View File
@@ -49,19 +49,36 @@ GDK_AVAILABLE_IN_4_14
void gsk_path_point_free (GskPathPoint *point);
GDK_AVAILABLE_IN_4_14
void gsk_path_point_get_position (GskPath *path,
const GskPathPoint *point,
gboolean gsk_path_point_equal (const GskPathPoint *point1,
const GskPathPoint *point2);
GDK_AVAILABLE_IN_4_14
int gsk_path_point_compare (const GskPathPoint *point1,
const GskPathPoint *point2);
GDK_AVAILABLE_IN_4_14
void gsk_path_point_get_position (const GskPathPoint *point,
GskPath *path,
graphene_point_t *position);
GDK_AVAILABLE_IN_4_14
void gsk_path_point_get_tangent (GskPath *path,
const GskPathPoint *point,
void gsk_path_point_get_tangent (const GskPathPoint *point,
GskPath *path,
GskPathDirection direction,
graphene_vec2_t *tangent);
GDK_AVAILABLE_IN_4_14
float gsk_path_point_get_curvature (GskPath *path,
const GskPathPoint *point,
float gsk_path_point_get_rotation (const GskPathPoint *point,
GskPath *path,
GskPathDirection direction);
GDK_AVAILABLE_IN_4_14
float gsk_path_point_get_curvature (const GskPathPoint *point,
GskPath *path,
graphene_point_t *center);
GDK_AVAILABLE_IN_4_14
float gsk_path_point_get_distance (const GskPathPoint *point,
GskPath *path);
G_END_DECLS
+2 -8
View File
@@ -7,15 +7,9 @@ G_BEGIN_DECLS
struct _GskRealPathPoint
{
GskPath *path;
gsize contour;
union {
struct {
unsigned int idx;
float t;
} std;
} data;
gsize idx;
float t;
};
G_STATIC_ASSERT (sizeof (GskRealPathPoint) <= sizeof (GskPathPoint));
-1
View File
@@ -35,7 +35,6 @@ G_BEGIN_DECLS
#define GSK_SERIALIZATION_ERROR (gsk_serialization_error_quark ())
typedef struct _GskRenderNode GskRenderNode;
typedef struct _GskColorStop GskColorStop;
typedef struct _GskShadow GskShadow;
+28 -7
View File
@@ -3841,11 +3841,12 @@ gsk_color_matrix_node_class_init (gpointer g_class,
* Creates a `GskRenderNode` that will drawn the @child with
* @color_matrix.
*
* In particular, the node will transform the operation
* In particular, the node will transform colors by applying
*
* pixel = color_matrix * pixel + color_offset
* pixel = transpose(color_matrix) * pixel + color_offset
*
* for every pixel.
* for every pixel. The transformation operates on unpremultiplied
* colors, with color components ordered R, G, B, A.
*
* Returns: (transfer full) (type GskColorMatrixNode): A new `GskRenderNode`
*/
@@ -3970,7 +3971,7 @@ gsk_repeat_node_draw (GskRenderNode *node,
scale_x *= width / self->child_bounds.size.width;
scale_y *= height / self->child_bounds.size.height;
cairo_surface_set_device_scale (surface, scale_x, scale_y);
cairo_surface_set_device_offset (surface,
cairo_surface_set_device_offset (surface,
- self->child_bounds.origin.x * scale_x,
- self->child_bounds.origin.y * scale_y);
@@ -4141,7 +4142,7 @@ gsk_clip_node_diff (GskRenderNode *node1,
gsk_render_node_diff_impossible (node1, node2, region);
}
}
static void
gsk_clip_node_class_init (gpointer g_class,
gpointer class_data)
@@ -4372,6 +4373,15 @@ gsk_rounded_clip_node_get_clip (const GskRenderNode *node)
/* }}} */
/* {{{ GSK_FILL_NODE */
/**
* GskFillNode:
*
* A render node filling the area given by [struct@Gsk.Path]
* and [enum@Gsk.FillRule] with the child node.
*
* Since: 4.14
*/
struct _GskFillNode
{
GskRenderNode render_node;
@@ -4572,6 +4582,15 @@ gsk_fill_node_get_fill_rule (const GskRenderNode *node)
/* }}} */
/* {{{ GSK_STROKE_NODE */
/**
* GskStrokeNode:
*
* A render node that will fill the area determined by stroking the the given
* [struct@Gsk.Path] using the [struct@Gsk.Stroke] attributes.
*
* Since: 4.14
*/
struct _GskStrokeNode
{
GskRenderNode render_node;
@@ -4670,8 +4689,10 @@ gsk_stroke_node_class_init (gpointer g_class,
* @path: (transfer none): The path describing the area to stroke
* @stroke: (transfer none): The stroke attributes to use
*
* Creates a #GskRenderNode that will stroke the @child along the given
* @path using the attributes defined in @stroke.
* Creates a #GskRenderNode that will fill the outline generated by stroking
* the given @path using the attributes defined in @stroke.
*
* The area is filled with @child.
*
* Returns: (transfer none) (type GskStrokeNode): A new #GskRenderNode
*
+1 -1
View File
@@ -14,7 +14,7 @@ typedef struct _GskRenderNodeClass GskRenderNodeClass;
* We don't add an "n-types" value to avoid having to handle
* it in every single switch.
*/
#define GSK_RENDER_NODE_TYPE_N_TYPES (GSK_MASK_NODE + 1)
#define GSK_RENDER_NODE_TYPE_N_TYPES (GSK_STROKE_NODE + 1)
extern GType gsk_render_node_types[];
+3 -2
View File
@@ -26,6 +26,8 @@
*
* A `GskStroke` struct collects the parameters that influence
* the operation of stroking a path.
*
* Since: 4.14
*/
G_DEFINE_BOXED_TYPE (GskStroke, gsk_stroke, gsk_stroke_copy, gsk_stroke_free)
@@ -426,8 +428,7 @@ gsk_stroke_set_dash (GskStroke *self,
/**
* gsk_stroke_get_dash:
* @self: a `GskStroke`
* @n_dash: (out caller-allocates): number of elements
* in the array returned
* @n_dash: (out): number of elements in the array returned
*
* Gets the dash array in use or `NULL` if dashing is disabled.
*
+1
View File
@@ -29,6 +29,7 @@ typedef struct _GskPath GskPath;
typedef struct _GskPathBuilder GskPathBuilder;
typedef struct _GskPathPoint GskPathPoint;
typedef struct _GskRenderer GskRenderer;
typedef struct _GskRenderNode GskRenderNode;
typedef struct _GskStroke GskStroke;
typedef struct _GskTransform GskTransform;
+2 -2
View File
@@ -234,8 +234,8 @@
* API as they come in. Usually `GtkCellArea` is only interested in
* button events, however some customized derived areas can be implemented
* who are interested in handling other events. Handling an event can
* trigger the [`signal@Gtk.CellArea::focus-changed`] signal to fire; as well
* as [`signal@Gtk.CellArea::add-editable`] in the case that an editable cell
* trigger the [signal@Gtk.CellArea::focus-changed] signal to fire; as well
* as [signal@Gtk.CellArea::add-editable] in the case that an editable cell
* was clicked and needs to start editing. You can call
* [method@Gtk.CellArea.stop_editing] at any time to cancel any cell editing
* that is currently in progress.
+1 -1
View File
@@ -1140,7 +1140,7 @@ gtk_tree_view_class_init (GtkTreeViewClass *class)
* @column: (nullable): the `GtkTreeViewColumn` in which the activation occurred
*
* The "row-activated" signal is emitted when the method
* [`method@Gtk.TreeView.row_activated`] is called.
* [method@Gtk.TreeView.row_activated] is called.
*
* This signal is emitted when the user double-clicks a treeview row with the
* [property@Gtk.TreeView:activate-on-single-click] property set to %FALSE,
+4 -4
View File
@@ -937,13 +937,13 @@ gtk_tree_view_column_update_button (GtkTreeViewColumn *tree_column)
if ((!alternative && priv->sort_order == GTK_SORT_ASCENDING) ||
(alternative && priv->sort_order == GTK_SORT_DESCENDING))
{
gtk_widget_remove_css_class (arrow, "descending");
gtk_widget_add_css_class (arrow, "ascending");
gtk_widget_remove_css_class (arrow, "ascending");
gtk_widget_add_css_class (arrow, "descending");
}
else
{
gtk_widget_remove_css_class (arrow, "ascending");
gtk_widget_add_css_class (arrow, "descending");
gtk_widget_remove_css_class (arrow, "descending");
gtk_widget_add_css_class (arrow, "ascending");
}
}
+2 -1
View File
@@ -459,7 +459,8 @@ gsk_pango_renderer_release (GskPangoRenderer *renderer)
*
* Creates render nodes for rendering @layout in the given foregound @color
* and appends them to the current node of @snapshot without changing the
* current node.
* current node. The current theme's foreground color for a widget can be
* obtained with [method@Gtk.Widget.get_color].
*
* Note that if the layout does not produce any visible output, then nodes
* may not be added to the @snapshot.
+39
View File
@@ -45,6 +45,7 @@ static GdkContentProvider *
double x,
double y,
GtkColorDialogButton *self);
static void activated (GtkColorDialogButton *self);
static void button_clicked (GtkColorDialogButton *self);
static void update_button_sensitivity
(GtkColorDialogButton *self);
@@ -96,8 +97,17 @@ enum
NUM_PROPERTIES
};
/* Signals */
enum
{
SIGNAL_ACTIVATE = 1,
NUM_SIGNALS
};
static GParamSpec *properties[NUM_PROPERTIES];
static unsigned int color_dialog_button_signals[NUM_SIGNALS] = { 0 };
G_DEFINE_TYPE (GtkColorDialogButton, gtk_color_dialog_button, GTK_TYPE_WIDGET)
static void
@@ -108,6 +118,8 @@ gtk_color_dialog_button_init (GtkColorDialogButton *self)
GtkDragSource *source;
GtkDropTarget *dest;
g_signal_connect_swapped (self, "activate", G_CALLBACK (activated), self);
self->color = GDK_RGBA ("00000000");
self->button = gtk_button_new ();
@@ -278,6 +290,27 @@ gtk_color_dialog_button_class_init (GtkColorDialogButtonClass *class)
g_object_class_install_properties (object_class, NUM_PROPERTIES, properties);
/**
* GtkColorDialogButton::activate:
* @widget: the object which received the signal
*
* Emitted when the color dialog button is activated.
*
* The `::activate` signal on `GtkColorDialogButton` is an action signal
* and emitting it causes the button to pop up its dialog.
*
* Since: 4.14
*/
color_dialog_button_signals[SIGNAL_ACTIVATE] =
g_signal_new (I_ ("activate"),
G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
0,
NULL, NULL,
NULL,
G_TYPE_NONE, 0);
gtk_widget_class_set_activate_signal (widget_class, color_dialog_button_signals[SIGNAL_ACTIVATE]);
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT);
gtk_widget_class_set_css_name (widget_class, "colorbutton");
gtk_widget_class_set_accessible_role (widget_class, GTK_ACCESSIBLE_ROLE_GROUP);
@@ -366,6 +399,12 @@ color_chosen (GObject *source,
update_button_sensitivity (self);
}
static void
activated (GtkColorDialogButton *self)
{
gtk_widget_activate (self->button);
}
static void
button_clicked (GtkColorDialogButton *self)
{
+8 -1
View File
@@ -1798,6 +1798,8 @@ gtk_column_view_scroll_to_column (GtkColumnView *self,
gtk_adjustment_get_page_size (self->hadjustment));
gtk_adjustment_set_value (self->hadjustment, new_value);
g_clear_pointer (&scroll_info, gtk_scroll_info_unref);
}
void
@@ -2214,9 +2216,14 @@ gtk_column_view_scroll_to (GtkColumnView *self,
if (column && (flags & GTK_LIST_SCROLL_FOCUS))
gtk_column_view_set_focus_column (self, column, FALSE);
gtk_list_view_scroll_to (self->listview, pos, flags, scroll);
gtk_list_view_scroll_to (self->listview,
pos,
flags,
scroll ? gtk_scroll_info_ref (scroll) : NULL);
if (column)
gtk_column_view_scroll_to_column (self, column, scroll);
else
g_clear_pointer (&scroll, gtk_scroll_info_unref);
}
+19 -16
View File
@@ -43,6 +43,8 @@
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
@class FilterComboBox;
typedef struct {
GtkFileChooserNative *self;
@@ -68,31 +70,33 @@ typedef struct {
NSMutableArray *filters;
NSMutableArray *filter_names;
NSComboBox *filter_combo_box;
FilterComboBox *filter_popup_button;
GSList *files;
int response;
} FileChooserQuartzData;
@interface FilterComboBox : NSObject<NSComboBoxDelegate>
@interface FilterComboBox : NSPopUpButton
{
FileChooserQuartzData *data;
}
- (id) initWithData:(FileChooserQuartzData *) quartz_data;
- (void)comboBoxSelectionDidChange:(NSNotification *)notification;
- (void) popUpButtonSelectionChanged:(id) sender;
@end
@implementation FilterComboBox
- (id) initWithData:(FileChooserQuartzData *) quartz_data
{
[super init];
[super initWithFrame:NSMakeRect(0, 0, 200, 24)];
[self setTarget:self];
[self setAction:@selector(popUpButtonSelectionChanged:)];
data = quartz_data;
return self;
}
- (void)comboBoxSelectionDidChange:(NSNotification *)notification
- (void)popUpButtonSelectionChanged:(id)sender
{
NSInteger selected_index = [data->filter_combo_box indexOfSelectedItem];
NSInteger selected_index = [data->filter_popup_button indexOfSelectedItem];
NSArray *filter = [data->filters objectAtIndex:selected_index];
// check for empty strings in filter -> indicates all filetypes should be allowed!
if ([filter containsObject:@""])
@@ -302,10 +306,8 @@ filechooser_quartz_launch (FileChooserQuartzData *data)
if (data->filters)
{
// when filters have been provided, a combobox needs to be added
data->filter_combo_box = [[NSComboBox alloc] initWithFrame:NSMakeRect(0, 0, 200, 24)];
[data->filter_combo_box addItemsWithObjectValues:data->filter_names];
[data->filter_combo_box setEditable:NO];
[data->filter_combo_box setDelegate:[[FilterComboBox alloc] initWithData:data]];
data->filter_popup_button = [[FilterComboBox alloc] initWithData:data];
[data->filter_popup_button addItemsWithTitles:data->filter_names];
if (data->self->current_filter)
{
@@ -329,16 +331,18 @@ filechooser_quartz_launch (FileChooserQuartzData *data)
g_object_unref (filters);
if (current_filter_index != GTK_INVALID_LIST_POSITION)
[data->filter_combo_box selectItemAtIndex:current_filter_index];
[data->filter_popup_button selectItemAtIndex:current_filter_index];
else
[data->filter_combo_box selectItemAtIndex:0];
[data->filter_popup_button selectItemAtIndex:0];
}
else
{
[data->filter_combo_box selectItemAtIndex:0];
[data->filter_popup_button selectItemAtIndex:0];
}
[data->filter_combo_box setToolTip:[NSString stringWithUTF8String:_("Select which types of files are shown")]];
[data->panel setAccessoryView:data->filter_combo_box];
[data->filter_popup_button popUpButtonSelectionChanged:NULL];
[data->filter_popup_button setToolTip:[NSString stringWithUTF8String:_("Select which types of files are shown")]];
[data->panel setAccessoryView:data->filter_popup_button];
if ([data->panel isKindOfClass:[NSOpenPanel class]] && [data->panel respondsToSelector:@selector(setAccessoryViewDisclosed:)])
{
[(id<CanSetAccessoryViewDisclosed>) data->panel setAccessoryViewDisclosed:YES];
@@ -578,4 +582,3 @@ gtk_file_chooser_native_quartz_hide (GtkFileChooserNative *self)
}
data->panel = NULL;
}
+2 -5
View File
@@ -758,8 +758,6 @@ gtk_file_filter_get_attributes (GtkFileFilter *filter)
#ifdef GDK_WINDOWING_MACOS
#import <Foundation/Foundation.h>
NSArray * _gtk_file_filter_get_as_pattern_nsstrings (GtkFileFilter *filter)
{
NSMutableArray *array = [[NSMutableArray alloc] init];
@@ -773,9 +771,8 @@ NSArray * _gtk_file_filter_get_as_pattern_nsstrings (GtkFileFilter *filter)
{
case FILTER_RULE_MIME_TYPE:
{
// convert mime-types to UTI
NSString *mime_type_nsstring = [NSString stringWithUTF8String: rule->u.content_types[0]];
NSString *uti_nsstring = (NSString *) UTTypeCreatePreferredIdentifierForTag (kUTTagClassMIMEType, (CFStringRef) mime_type_nsstring, NULL);
// GContentType from GIO use UTI on macOS since glib version 2.51
NSString *uti_nsstring = [NSString stringWithUTF8String: rule->u.content_types[0]];
if (uti_nsstring == NULL)
{
[array release];
+39 -1
View File
@@ -32,7 +32,7 @@
#include "gtkwidgetprivate.h"
#include "gtktypebuiltins.h"
static void activated (GtkFontDialogButton *self);
static void button_clicked (GtkFontDialogButton *self);
static void update_button_sensitivity
(GtkFontDialogButton *self);
@@ -100,8 +100,17 @@ enum
NUM_PROPERTIES
};
/* Signals */
enum
{
SIGNAL_ACTIVATE = 1,
NUM_SIGNALS
};
static GParamSpec *properties[NUM_PROPERTIES];
static unsigned int font_dialog_button_signals[NUM_SIGNALS] = { 0 };
G_DEFINE_TYPE (GtkFontDialogButton, gtk_font_dialog_button, GTK_TYPE_WIDGET)
static void
@@ -110,6 +119,8 @@ gtk_font_dialog_button_init (GtkFontDialogButton *self)
GtkWidget *box;
PangoFontDescription *font_desc;
g_signal_connect_swapped (self, "activate", G_CALLBACK (activated), self);
self->button = gtk_button_new ();
g_signal_connect_swapped (self->button, "clicked", G_CALLBACK (button_clicked), self);
self->font_label = gtk_label_new (_("Font"));
@@ -383,6 +394,27 @@ gtk_font_dialog_button_class_init (GtkFontDialogButtonClass *class)
g_object_class_install_properties (object_class, NUM_PROPERTIES, properties);
/**
* FontDialogButton::activate:
* @widget: The object which received the signal
*
* Emitted when the font dialog button is activated.
*
* The `::activate` signal on `GtkFontDialogButton` is an action signal
* and emitting it causes the button to pop up its dialog.
*
* Since: 4.14
*/
font_dialog_button_signals[SIGNAL_ACTIVATE] =
g_signal_new (I_ ("activate"),
G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
0,
NULL, NULL,
NULL,
G_TYPE_NONE, 0);
gtk_widget_class_set_activate_signal (widget_class, font_dialog_button_signals[SIGNAL_ACTIVATE]);
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT);
gtk_widget_class_set_css_name (widget_class, "fontbutton");
gtk_widget_class_set_accessible_role (widget_class, GTK_ACCESSIBLE_ROLE_GROUP);
@@ -499,6 +531,12 @@ font_and_features_chosen (GObject *source,
update_button_sensitivity (self);
}
static void
activated (GtkFontDialogButton *self)
{
gtk_widget_activate (self->button);
}
static void
button_clicked (GtkFontDialogButton *self)
{
+2 -2
View File
@@ -121,7 +121,7 @@ static GParamSpec *properties[N_PROPS] = { NULL, };
* @self: a `GtkListBase`
* @across: position in pixels in the direction cross to the list
* @along: position in pixels in the direction of the list
* @pos: (out caller-allocates): set to the looked up position
* @pos: (out): set to the looked up position
* @area: (out caller-allocates) (optional): set to the area occupied
* by the returned position
*
@@ -1519,7 +1519,7 @@ gtk_list_base_allocate_children (GtkListBase *self,
GtkListBasePrivate *priv = gtk_list_base_get_instance_private (self);
GtkListTile *tile;
int dx, dy;
gtk_list_base_get_adjustment_values (self, OPPOSITE_ORIENTATION (priv->orientation), &dx, NULL, NULL);
gtk_list_base_get_adjustment_values (self, priv->orientation, &dy, NULL, NULL);
+3 -3
View File
@@ -27,9 +27,9 @@
* `GtkListHeader` is used by list widgets to represent the headers they
* display.
*
* The `GtkListHeader`s are managed just like [class@gtk.ListItem]s via
* their factory, but provide a different set of properties suitable for
* managing the header instead of individual items.
* `GtkListHeader` objects are managed just like [class@Gtk.ListItem]
* objects via their factory, but provide a different set of properties suitable
* for managing the header instead of individual items.
*
* Since: 4.12
*/
+4 -3
View File
@@ -27,13 +27,14 @@
/**
* GtkListItem:
*
* `GtkListItem` is used by list widgets to represent items in a `GListModel`.
* `GtkListItem` is used by list widgets to represent items in a
* [iface@Gio.ListModel].
*
* The `GtkListItem`s are managed by the list widget (with its factory)
* `GtkListItem` objects are managed by the list widget (with its factory)
* and cannot be created by applications, but they need to be populated
* by application code. This is done by calling [method@Gtk.ListItem.set_child].
*
* `GtkListItem`s exist in 2 stages:
* `GtkListItem` objects exist in 2 stages:
*
* 1. The unbound stage where the listitem is not currently connected to
* an item in the list. In that case, the [property@Gtk.ListItem:item]
+2 -2
View File
@@ -1510,8 +1510,8 @@ gtk_menu_button_set_child (GtkMenuButton *menu_button,
NULL,
NULL,
NULL,
(GtkGizmoFocusFunc)gtk_widget_focus_self,
(GtkGizmoGrabFocusFunc)gtk_widget_grab_focus_self);
(GtkGizmoFocusFunc)gtk_widget_focus_child,
NULL);
gtk_widget_set_layout_manager (inner_widget, gtk_bin_layout_new ());
gtk_widget_set_hexpand (inner_widget, TRUE);
+2 -2
View File
@@ -33,12 +33,12 @@
/**
* GtkOverlayLayout:
*
* `GtkOverlayLayout` is the layout manager used by `GtkOverlay`.
* `GtkOverlayLayout` is the layout manager used by [class@Gtk.Overlay].
*
* It places widgets as overlays on top of the main child.
*
* This is not a reusable layout manager, since it expects its widget
* to be a `GtkOverlay`. It only listed here so that its layout
* to be a `GtkOverlay`. It is only listed here so that its layout
* properties get documented.
*/
+13 -12
View File
@@ -70,30 +70,31 @@
* # CSS nodes
*
* ```
* popover[.menu]
* popover.background[.menu]
* arrow
* contents.background
* contents
* <child>
* ```
*
* The contents child node always gets the .background style class
* and the popover itself gets the .menu style class if the popover
* is menu-like (i.e. `GtkPopoverMenu`).
* `GtkPopover` has a main node with name `popover`, an arrow with name `arrow`,
* and another node for the content named `contents`. The `popover` node always
* gets the `.background` style class. It also gets the `.menu` style class
* if the popover is menu-like, e.g. is a [class@Gtk.PopoverMenu].
*
* Particular uses of `GtkPopover`, such as touch selection popups or
* magnifiers in `GtkEntry` or `GtkTextView` get style classes like
* .touch-selection or .magnifier to differentiate from plain popovers.
* `.touch-selection` or `.magnifier` to differentiate from plain popovers.
*
* When styling a popover directly, the popover node should usually
* When styling a popover directly, the `popover` node should usually
* not have any background. The visible part of the popover can have
* a shadow. To specify it in CSS, set the box-shadow of the contents node.
* a shadow. To specify it in CSS, set the box-shadow of the `contents` node.
*
* Note that, in order to accomplish appropriate arrow visuals, `GtkPopover`
* uses custom drawing for the arrow node. This makes it possible for the
* uses custom drawing for the `arrow` node. This makes it possible for the
* arrow to change its shape dynamically, but it also limits the possibilities
* of styling it using CSS. In particular, the arrow gets drawn over the
* content node's border and shadow, so they look like one shape, which
* means that the border width of the content node and the arrow node should
* of styling it using CSS. In particular, the `arrow` gets drawn over the
* `content` node's border and shadow, so they look like one shape, which
* means that the border width of the `content` node and the `arrow` node should
* be the same. The arrow also does not support any border shape other than
* solid, no border-radius, only one border width (border-bottom-width is
* used) and no box-shadow.
+8 -1
View File
@@ -135,7 +135,14 @@
*
* `GtkPopoverMenu` is just a subclass of `GtkPopover` that adds custom content
* to it, therefore it has the same CSS nodes. It is one of the cases that add
* a .menu style class to the popover's main node.
* a `.menu` style class to the main `popover` node.
*
* Menu items have nodes with name `button` and class `.model`. If a section
* display-hint is set, the section gets a node `box` with class `horizontal`
* plus a class with the same text as the display hint. Note that said box may
* not be the direct ancestor of the item `button`s. Thus, for example, to style
* items in an `inline-buttons` section, select `.inline-buttons button.model`.
* Other things that may be of interest to style in menus include `label` nodes.
*
* # Accessibility
*
+3 -4
View File
@@ -113,10 +113,9 @@ gtk_section_model_default_init (GtkSectionModelInterface *iface)
* gtk_section_model_get_section:
* @self: a `GtkSectionModel`
* @position: the position of the item to query
* @out_start: (out caller-allocates): the position of the first
* item in the section
* @out_end: (out caller-allocates): the position of the first
* item not part of the section anymore.
* @out_start: (out): the position of the first item in the section
* @out_end: (out): the position of the first item not part of the section
* anymore.
*
* Query the section that covers the given position. The number of
* items in the section can be computed by `out_end - out_start`.
+3 -3
View File
@@ -29,7 +29,7 @@
* GtkSignalListItemFactory:
*
* `GtkSignalListItemFactory` is a `GtkListItemFactory` that emits signals
* to to manage listitems.
* to manage listitems.
*
* Signals are emitted for every listitem in the same order:
*
@@ -216,9 +216,9 @@ gtk_signal_list_item_factory_class_init (GtkSignalListItemFactoryClass *klass)
* @self: The `GtkSignalListItemFactory`
* @object: The `GObject` to unbind
*
* Emitted when a object has been unbound from its item, for example when
* Emitted when an object has been unbound from its item, for example when
* a listitem was removed from use in a list widget
* and its new [property@Gtk.ListItem:item] is about to be unset.
* and its [property@Gtk.ListItem:item] is about to be unset.
*
* This signal is the opposite of the [signal@Gtk.SignalListItemFactory::bind]
* signal and should be used to undo everything done in that signal.
+82 -11
View File
@@ -567,29 +567,29 @@ merge_color_matrix_nodes (const graphene_matrix_t *matrix2,
const graphene_vec4_t *offset2,
GskRenderNode *child)
{
const graphene_matrix_t *mat1 = gsk_color_matrix_node_get_color_matrix (child);
const graphene_matrix_t *matrix1 = gsk_color_matrix_node_get_color_matrix (child);
const graphene_vec4_t *offset1 = gsk_color_matrix_node_get_color_offset (child);
graphene_matrix_t mat2 = *matrix2;
graphene_vec4_t off2 = *offset2;
graphene_matrix_t matrix;
graphene_vec4_t offset;
GskRenderNode *result;
g_assert (gsk_render_node_get_node_type (child) == GSK_COLOR_MATRIX_NODE);
/* color matrix node: color = mat * p + offset; for a pixel p.
* color = mat1 * (mat2 * p + offset2) + offset1;
* = mat1 * mat2 * p + offset2 * mat1 + offset1
* = (mat1 * mat2) * p + (offset2 * mat1 + offset1)
/* color matrix node: color = trans(mat) * p + offset; for a pixel p.
* color = trans(mat2) * (trans(mat1) * p + offset1) + offset2
* = trans(mat2) * trans(mat1) * p + trans(mat2) * offset1 + offset2
* = trans(mat1 * mat2) * p + (trans(mat2) * offset1 + offset2)
* Which this code does.
* mat1 and offset1 come from @child.
*/
graphene_matrix_transform_vec4 (mat1, offset2, &off2);
graphene_vec4_add (&off2, offset1, &off2);
graphene_matrix_transform_vec4 (matrix2, offset1, &offset);
graphene_vec4_add (&offset, offset2, &offset);
graphene_matrix_multiply (mat1, &mat2, &mat2);
graphene_matrix_multiply (matrix1, matrix2, &matrix);
result = gsk_color_matrix_node_new (gsk_color_matrix_node_get_child (child),
&mat2, &off2);
&matrix, &offset);
return result;
}
@@ -656,6 +656,13 @@ gtk_snapshot_collect_color_matrix (GtkSnapshot *snapshot,
* Modifies the colors of an image by applying an affine transformation
* in RGB space.
*
* In particular, the colors will be transformed by applying
*
* pixel = transpose(color_matrix) * pixel + color_offset
*
* for every pixel. The transformation operates on unpremultiplied
* colors, with color components ordered R, G, B, A.
*
* The image is recorded until the next call to [method@Gtk.Snapshot.pop].
*/
void
@@ -1151,6 +1158,9 @@ gtk_snapshot_clear_fill (GtkSnapshotState *state)
*
* The image is recorded until the next call to [method@Gtk.Snapshot.pop].
*
* If you want to fill the path with a color, [method@Gtk.Snapshot.append_fill]
* may be more convenient.
*
* Since: 4.14
*/
void
@@ -1171,6 +1181,35 @@ gtk_snapshot_push_fill (GtkSnapshot *snapshot,
state->data.fill.fill_rule = fill_rule;
}
/**
* gtk_snapshot_append_fill:
* @snapshot: a `GtkSnapshot`
* @path: The path describing the area to fill
* @fill_rule: The fill rule to use
* @color: the color to fill the path with
*
* A convenience method to fill a path with a color.
*
* See [method@Gtk.Snapshot.push_fill] if you need
* to fill a path with more complex content than
* a color.
*
* Since: 4.14
*/
void
gtk_snapshot_append_fill (GtkSnapshot *snapshot,
GskPath *path,
GskFillRule fill_rule,
const GdkRGBA *color)
{
graphene_rect_t bounds;
gsk_path_get_bounds (path, &bounds);
gtk_snapshot_push_fill (snapshot, path, fill_rule);
gtk_snapshot_append_color (snapshot, color, &bounds);
gtk_snapshot_pop (snapshot);
}
static GskRenderNode *
gtk_snapshot_collect_stroke (GtkSnapshot *snapshot,
GtkSnapshotState *state,
@@ -1222,6 +1261,9 @@ gtk_snapshot_clear_stroke (GtkSnapshotState *state)
* everything else, so uneven scaling will cause horizontal and vertical
* strokes to have different widths.
*
* If you want to stroke the path with a color, [method@Gtk.Snapshot.append_stroke]
* may be more convenient.
*
* Since: 4.14
*/
void
@@ -1265,6 +1307,35 @@ gtk_snapshot_collect_shadow (GtkSnapshot *snapshot,
return shadow_node;
}
/**
* gtk_snapshot_append_stroke:
* @snapshot: a `GtkSnapshot`
* @path: The path describing the area to fill
* @stroke: The stroke attributes
* @color: the color to fill the path with
*
* A convenience method to stroke a path with a color.
*
* See [method@Gtk.Snapshot.push_stroke] if you need
* to stroke a path with more complex content than
* a color.
*
* Since: 4.14
*/
void
gtk_snapshot_append_stroke (GtkSnapshot *snapshot,
GskPath *path,
const GskStroke *stroke,
const GdkRGBA *color)
{
graphene_rect_t bounds;
gsk_path_get_stroke_bounds (path, stroke, &bounds);
gtk_snapshot_push_stroke (snapshot, path, stroke);
gtk_snapshot_append_color (snapshot, color, &bounds);
gtk_snapshot_pop (snapshot);
}
static void
gtk_snapshot_clear_shadow (GtkSnapshotState *state)
{
+10
View File
@@ -240,6 +240,16 @@ void gtk_snapshot_append_layout (GtkSnapshot
PangoLayout *layout,
const GdkRGBA *color);
GDK_AVAILABLE_IN_4_14
void gtk_snapshot_append_fill (GtkSnapshot *snapshot,
GskPath *path,
GskFillRule fill_rule,
const GdkRGBA *color);
GDK_AVAILABLE_IN_4_14
void gtk_snapshot_append_stroke (GtkSnapshot *snapshot,
GskPath *path,
const GskStroke *stroke,
const GdkRGBA *color);
G_END_DECLS
+25 -5
View File
@@ -3977,9 +3977,11 @@ gtk_text_insert_at_cursor (GtkText *self,
if (priv->editable)
{
begin_change (self);
gtk_text_reset_im_context (self);
gtk_editable_insert_text (GTK_EDITABLE (self), str, -1, &pos);
gtk_text_set_selection_bounds (self, pos, pos);
end_change (self);
}
}
@@ -3999,12 +4001,14 @@ gtk_text_delete_from_cursor (GtkText *self,
return;
}
begin_change (self);
if (priv->selection_bound != priv->current_pos)
{
gtk_text_delete_selection (self);
gtk_text_schedule_im_reset (self);
gtk_text_reset_im_context (self);
return;
goto done;
}
switch (type)
@@ -4074,6 +4078,8 @@ gtk_text_delete_from_cursor (GtkText *self,
gtk_text_reset_im_context (self);
}
done:
end_change (self);
gtk_text_pend_cursor_blink (self);
}
@@ -4089,12 +4095,14 @@ gtk_text_backspace (GtkText *self)
return;
}
begin_change (self);
if (priv->selection_bound != priv->current_pos)
{
gtk_text_delete_selection (self);
gtk_text_schedule_im_reset (self);
gtk_text_reset_im_context (self);
return;
goto done;
}
prev_pos = gtk_text_move_logically (self, priv->current_pos, -1);
@@ -4147,6 +4155,8 @@ gtk_text_backspace (GtkText *self)
gtk_widget_error_bell (GTK_WIDGET (self));
}
done:
end_change (self);
gtk_text_pend_cursor_blink (self);
}
@@ -4191,7 +4201,11 @@ gtk_text_cut_clipboard (GtkText *self)
if (priv->editable)
{
if (priv->selection_bound != priv->current_pos)
gtk_text_delete_selection (self);
{
begin_change (self);
gtk_text_delete_selection (self);
end_change (self);
}
}
else
{
@@ -4209,9 +4223,15 @@ gtk_text_paste_clipboard (GtkText *self)
GtkTextPrivate *priv = gtk_text_get_instance_private (self);
if (priv->editable)
gtk_text_paste (self, gtk_widget_get_clipboard (GTK_WIDGET (self)));
{
begin_change (self);
gtk_text_paste (self, gtk_widget_get_clipboard (GTK_WIDGET (self)));
end_change (self);
}
else
gtk_widget_error_bell (GTK_WIDGET (self));
{
gtk_widget_error_bell (GTK_WIDGET (self));
}
gtk_text_update_handles (self);
}
+2
View File
@@ -744,5 +744,7 @@ gtk_viewport_scroll_to (GtkViewport *viewport,
gtk_adjustment_animate_to_value (viewport->adjustment[GTK_ORIENTATION_HORIZONTAL], x);
gtk_adjustment_animate_to_value (viewport->adjustment[GTK_ORIENTATION_VERTICAL], y);
g_clear_pointer (&scroll, gtk_scroll_info_unref);
}
+14 -1
View File
@@ -1312,10 +1312,22 @@ gtk_inspector_object_tree_select_object (GtkInspectorObjectTree *wt,
GTK_LIST_SCROLL_SELECT | GTK_LIST_SCROLL_FOCUS,
NULL);
g_signal_emit (wt, signals[OBJECT_SELECTED], 0, object); // FIXME
g_signal_emit (wt, signals[OBJECT_SELECTED], 0, object);
g_object_unref (row_item);
}
static void
on_selected_item (GtkSingleSelection *selection,
GParamSpec *pspec,
GtkInspectorObjectTree *wt)
{
GObject *selected = gtk_single_selection_get_selected_item (selection);
GtkTreeListRow *row = GTK_TREE_LIST_ROW (selected);
GObject *object = gtk_tree_list_row_get_item (row);
g_signal_emit (wt, signals[OBJECT_SELECTED], 0, object);
g_object_unref (object);
}
void
gtk_inspector_object_tree_set_display (GtkInspectorObjectTree *wt,
GdkDisplay *display)
@@ -1329,4 +1341,5 @@ gtk_inspector_object_tree_set_display (GtkInspectorObjectTree *wt,
wt->priv->selection = gtk_single_selection_new (g_object_ref (G_LIST_MODEL (wt->priv->tree_model)));
gtk_column_view_set_model (GTK_COLUMN_VIEW (wt->priv->list),
GTK_SELECTION_MODEL (wt->priv->selection));
g_signal_connect (wt->priv->selection, "notify::selected-item", G_CALLBACK (on_selected_item), wt);
}
-1
View File
@@ -1075,7 +1075,6 @@ endif
if macos_enabled
gtk_macos_frameworks = [
'AppKit',
'Foundation',
]
gtk_deps += [dependency('appleframeworks', modules: gtk_macos_frameworks)]
endif
+7 -19
View File
@@ -817,28 +817,15 @@ endif
gsk_packages = [ 'graphene-gobject-1.0 @0@'.format(graphene_req) ]
gtk_packages = [ 'gio-2.0 @0@'.format(glib_req) ]
gio_pkgname = os_unix ? 'gio-unix-2.0' : 'gio-2.0'
gdk_private_packages = [
'@0@ @1@'.format(gio_pkgname, glib_req),
'epoxy @0@'.format(epoxy_req),
] + x11_pkgs + wayland_pkgs + cairo_backends
gsk_private_packages = [] # all already in gdk_private_packages
pangoft2_pkgs = (wayland_enabled or x11_enabled) ? ['pangoft2'] : []
gtk_private_packages = pangoft2_pkgs
pkgs = []
pkg_targets = []
display_backends = []
enabled_backends = []
foreach backend: [ 'broadway', 'macos', 'wayland', 'win32', 'x11', ]
if get_variable('@0@_enabled'.format(backend))
pkgs += ['gtk4-@0@'.format(backend)]
pkg_targets += backend
display_backends += [ backend ]
enabled_backends += backend
endif
endforeach
common_pc_variables = [
'targets=@0@'.format(' '.join(pkg_targets)),
'targets=@0@'.format(' '.join(enabled_backends)),
'gtk_binary_version=@0@'.format(gtk_binary_version),
'gtk_host=@0@-@1@'.format(host_machine.cpu_family(), host_machine.system()), # FIXME
]
@@ -853,13 +840,14 @@ pkg_config.generate(libgtk,
)
meson.override_dependency('gtk4', libgtk_dep)
foreach pkg: pkgs
foreach backend: enabled_backends
pkg = 'gtk4-@0@'.format(backend)
pkg_config.generate(
filebase: pkg,
unescaped_variables: common_pc_variables,
name: 'GTK',
description: 'GTK Graphical UI Library',
requires: 'gtk4',
requires: ['gtk4', get_variable('@0@_public_deps'.format(backend), [])],
)
meson.override_dependency(pkg, libgtk_dep)
endforeach
@@ -904,7 +892,7 @@ endif
#### Summary ####
summary('Display backends', display_backends, section: 'Components')
summary('Display backends', enabled_backends, section: 'Components')
summary('Print backends', print_backends, section: 'Components')
summary('Media backends', media_backends, section: 'Components')
+1 -1
View File
@@ -23,7 +23,7 @@
#include <glib-object.h>
#include <gtk/gtk.h>
#include "gtkprintbackendprivate.h"
#include "gtk/print/gtkprintbackendprivate.h"
G_BEGIN_DECLS
+2 -2
View File
@@ -21,7 +21,7 @@
#include <glib-object.h>
#include <cpdb/cpdb-frontend.h>
#include <gtk/gtkprinterprivate.h>
#include <gtk/print/gtkprinterprivate.h>
G_BEGIN_DECLS
@@ -43,4 +43,4 @@ void gtk_printer_cpdb_set_printer_obj (GtkPrinterCpdb
G_END_DECLS
#endif /* __GTK_PRINTER_CPDB_H__ */
#endif /* __GTK_PRINTER_CPDB_H__ */
+7 -1
View File
@@ -425,9 +425,15 @@ tools/gtk-builder-tool-screenshot.c
tools/gtk-builder-tool-simplify.c
tools/gtk-builder-tool-validate.c
tools/gtk-launch.c
tools/gtk-path-tool.c
tools/gtk-path-tool-decompose.c
tools/gtk-path-tool-info.c
tools/gtk-path-tool-render.c
tools/gtk-path-tool-show.c
tools/gtk-path-tool-utils.c
tools/gtk-rendernode-tool.c
tools/gtk-rendernode-tool-info.c
tools/gtk-rendernode-tool-show.c
tools/gtk-rendernode-tool-render.c
tools/gtk-rendernode-tool-show.c
tools/gtk-rendernode-tool-utils.c
tools/updateiconcache.c
+1075 -813
View File
File diff suppressed because it is too large Load Diff
+1195 -896
View File
File diff suppressed because it is too large Load Diff
+263 -70
View File
@@ -12,8 +12,8 @@ msgid ""
msgstr ""
"Project-Id-Version: gtk+ 2.6\n"
"Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/gtk/-/issues/\n"
"POT-Creation-Date: 2023-07-31 15:14+0000\n"
"PO-Revision-Date: 2023-08-01 09:23+0330\n"
"POT-Creation-Date: 2023-08-14 13:16+0000\n"
"PO-Revision-Date: 2023-08-15 02:04+0330\n"
"Last-Translator: Danial Behzadi <dani.behzi@ubuntu.com>\n"
"Language-Team: Persian <>\n"
"Language: fa\n"
@@ -137,7 +137,7 @@ msgstr "برنامه از API مربوط به %s پشتبانی نمی‌کند"
#. translators: This is about OpenGL backend names, like
#. * "Trying to use X11 GLX, but EGL is already in use"
#: gdk/gdkglcontext.c:1863
#: gdk/gdkglcontext.c:1864
#, c-format
msgid "Trying to use %s, but %s is already in use"
msgstr "تلاش شد از %s استفاده شود، ولی %s از پیش در حال استفاده است"
@@ -2182,7 +2182,7 @@ msgstr "یک پرونده با همان نام در حال حاضر وجود د
#: gtk/gtkfiledialog.c:843 gtk/gtkmessagedialog.c:170 gtk/gtkmessagedialog.c:179
#: gtk/gtkmountoperation.c:608 gtk/print/gtkpagesetupunixdialog.c:282
#: gtk/print/gtkprintbackend.c:638 gtk/print/gtkprintunixdialog.c:682
#: gtk/print/gtkprintunixdialog.c:839 gtk/gtkwindow.c:6238
#: gtk/print/gtkprintunixdialog.c:839 gtk/gtkwindow.c:6242
#: gtk/ui/gtkappchooserdialog.ui:48 gtk/ui/gtkassistant.ui:52
#: gtk/ui/gtkcolorchooserdialog.ui:36 gtk/ui/gtkfontchooserdialog.ui:27
msgid "_Cancel"
@@ -2270,7 +2270,7 @@ msgid "If you delete an item, it will be permanently lost."
msgstr "اگر موردی را پاک کنید، برای همیشه از دست خواهد رفت."
#: gtk/gtkfilechooserwidget.c:1185 gtk/gtkfilechooserwidget.c:1815
#: gtk/gtklabel.c:5693 gtk/gtktext.c:6125 gtk/gtktextview.c:9018
#: gtk/gtklabel.c:5695 gtk/gtktext.c:6145 gtk/gtktextview.c:9018
msgid "_Delete"
msgstr "_حذف"
@@ -2608,31 +2608,31 @@ msgstr "بستن"
msgid "Close the infobar"
msgstr "بستن نوار اطّلاعات"
#: gtk/gtklabel.c:5690 gtk/gtktext.c:6113 gtk/gtktextview.c:9006
#: gtk/gtklabel.c:5692 gtk/gtktext.c:6133 gtk/gtktextview.c:9006
msgid "Cu_t"
msgstr "_برش"
#: gtk/gtklabel.c:5691 gtk/gtktext.c:6117 gtk/gtktextview.c:9010
#: gtk/gtklabel.c:5693 gtk/gtktext.c:6137 gtk/gtktextview.c:9010
msgid "_Copy"
msgstr "_رونوشت"
#: gtk/gtklabel.c:5692 gtk/gtktext.c:6121 gtk/gtktextview.c:9014
#: gtk/gtklabel.c:5694 gtk/gtktext.c:6141 gtk/gtktextview.c:9014
msgid "_Paste"
msgstr "_چسباندن"
#: gtk/gtklabel.c:5698 gtk/gtktext.c:6134 gtk/gtktextview.c:9039
#: gtk/gtklabel.c:5700 gtk/gtktext.c:6154 gtk/gtktextview.c:9039
msgid "Select _All"
msgstr "انتخاب _همه"
#: gtk/gtklabel.c:5703
#: gtk/gtklabel.c:5705
msgid "_Open Link"
msgstr "_گشودن پیوند"
#: gtk/gtklabel.c:5707
#: gtk/gtklabel.c:5709
msgid "Copy _Link Address"
msgstr "_رونوشت از نشانی پیوند"
#: gtk/gtklabel.c:5751 gtk/gtktext.c:2716 gtk/gtktextview.c:9088
#: gtk/gtklabel.c:5753 gtk/gtktext.c:2716 gtk/gtktextview.c:9088
msgid "Context menu"
msgstr "فهرست بافتاری"
@@ -2703,7 +2703,7 @@ msgid "Play"
msgstr "پخش"
#: gtk/gtkmessagedialog.c:162 gtk/gtkmessagedialog.c:180
#: gtk/print/gtkprintbackend.c:639 gtk/gtkwindow.c:6239
#: gtk/print/gtkprintbackend.c:639 gtk/gtkwindow.c:6243
msgid "_OK"
msgstr "_تأیید"
@@ -3557,7 +3557,7 @@ msgctxt "accessibility"
msgid "Sidebar"
msgstr "نوار کناری"
#: gtk/gtktext.c:6139 gtk/gtktextview.c:9044
#: gtk/gtktext.c:6159 gtk/gtktextview.c:9044
msgid "Insert _Emoji"
msgstr "درج _ایموجی"
@@ -3569,12 +3569,12 @@ msgstr "بر_گردان"
msgid "_Redo"
msgstr "_انجام دوباره"
#: gtk/gtkwindow.c:6227
#: gtk/gtkwindow.c:6231
#, c-format
msgid "Do you want to use GTK Inspector?"
msgstr "می‌خواهید از بازرس +GTK استفاده کنید؟"
#: gtk/gtkwindow.c:6229
#: gtk/gtkwindow.c:6233
#, c-format
msgid ""
"GTK Inspector is an interactive debugger that lets you explore and modify the "
@@ -3584,7 +3584,7 @@ msgstr ""
"بازرس +GTK یک بازرس تعاملی است که به شما اجازه پیمایش و تغییر هسته برنامه‌های +GTK "
"را می‌دهد. استفاده از آن ممکن است باعث شود که برنامه‌ها قفل کنند یا از هم بپاشند."
#: gtk/gtkwindow.c:6234
#: gtk/gtkwindow.c:6238
msgid "Dont show this message again"
msgstr "این پیام را دوباره نشان نده"
@@ -3620,7 +3620,8 @@ msgstr "نقش"
msgid "Description"
msgstr "شرح"
#: gtk/inspector/a11y.ui:99 gtk/inspector/misc-info.ui:297
#: gtk/inspector/a11y.ui:99 gtk/inspector/misc-info.ui:296
#: tools/gtk-path-tool-info.c:72
msgid "Bounds"
msgstr "مزرها"
@@ -3925,61 +3926,61 @@ msgstr "حالت درخواست"
msgid "Measure map"
msgstr "نگاشت اندازه"
#: gtk/inspector/misc-info.ui:254
#: gtk/inspector/misc-info.ui:253
msgid "Expand"
msgstr "گسترش"
#: gtk/inspector/misc-info.ui:322
#: gtk/inspector/misc-info.ui:321
msgid "Baseline"
msgstr "خط مبنا"
#: gtk/inspector/misc-info.ui:347
#: gtk/inspector/misc-info.ui:346
msgid "Surface"
msgstr "سطح"
#: gtk/inspector/misc-info.ui:366 gtk/inspector/misc-info.ui:401
#: gtk/inspector/misc-info.ui:436 gtk/inspector/prop-editor.c:1150
#: gtk/inspector/misc-info.ui:365 gtk/inspector/misc-info.ui:400
#: gtk/inspector/misc-info.ui:435 gtk/inspector/prop-editor.c:1150
#: gtk/inspector/prop-editor.c:1533 gtk/inspector/window.ui:396
msgid "Properties"
msgstr "ویژگی‌ها"
#: gtk/inspector/misc-info.ui:382
#: gtk/inspector/misc-info.ui:381
msgid "Renderer"
msgstr "پرداختگر"
#: gtk/inspector/misc-info.ui:417
#: gtk/inspector/misc-info.ui:416
msgid "Frame Clock"
msgstr "دیده‌بان فریم"
#: gtk/inspector/misc-info.ui:452
#: gtk/inspector/misc-info.ui:451
msgid "Tick Callback"
msgstr "بازخورد تیک"
#: gtk/inspector/misc-info.ui:478
#: gtk/inspector/misc-info.ui:477
msgid "Frame Count"
msgstr "تعداد قاب"
#: gtk/inspector/misc-info.ui:503
#: gtk/inspector/misc-info.ui:502
msgid "Frame Rate"
msgstr "آهنگ قاب"
#: gtk/inspector/misc-info.ui:528
#: gtk/inspector/misc-info.ui:527
msgid "Scale"
msgstr "مقیاس"
#: gtk/inspector/misc-info.ui:553
#: gtk/inspector/misc-info.ui:552
msgid "Mapped"
msgstr "متصل شده"
#: gtk/inspector/misc-info.ui:579
#: gtk/inspector/misc-info.ui:578
msgid "Realized"
msgstr "محقق شده"
#: gtk/inspector/misc-info.ui:605
#: gtk/inspector/misc-info.ui:604
msgid "Is Toplevel"
msgstr "سطح بالا (Toplevel) است"
#: gtk/inspector/misc-info.ui:631
#: gtk/inspector/misc-info.ui:630
msgid "Child Visible"
msgstr "فرزند قابل دیدن است"
@@ -4088,7 +4089,7 @@ msgstr "منبع:"
msgid "Defined At"
msgstr "تعریف شده در"
#: gtk/inspector/recorder.c:1865
#: gtk/inspector/recorder.c:1922
#, c-format
msgid "Saving RenderNode failed"
msgstr "ذخیرهٔ RenderNode شکست خورد"
@@ -7124,7 +7125,8 @@ msgstr ""
#: tools/gtk-builder-tool-enumerate.c:56 tools/gtk-builder-tool-preview.c:179
#: tools/gtk-builder-tool-preview.c:180 tools/gtk-builder-tool-screenshot.c:360
#: tools/gtk-builder-tool-simplify.c:2529 tools/gtk-builder-tool-validate.c:261
#: tools/gtk-rendernode-tool-info.c:200 tools/gtk-rendernode-tool-show.c:102
#: tools/gtk-path-tool-render.c:62 tools/gtk-rendernode-tool-info.c:208
#: tools/gtk-rendernode-tool-show.c:102
msgid "FILE"
msgstr "پرونده"
@@ -7156,8 +7158,8 @@ msgid "Use style from CSS file"
msgstr "استفادهٔ سبک از پروندهٔ CSS"
#: tools/gtk-builder-tool-preview.c:187 tools/gtk-builder-tool-screenshot.c:370
#: tools/gtk-builder-tool-validate.c:268 tools/gtk-rendernode-tool-show.c:109
#: tools/gtk-rendernode-tool-render.c:204
#: tools/gtk-builder-tool-validate.c:268 tools/gtk-rendernode-tool-render.c:204
#: tools/gtk-rendernode-tool-show.c:109
#, c-format
msgid "Could not initialize windowing system\n"
msgstr "نتوانست سامانهٔ پنجره را راه‌اندازی کند\n"
@@ -7380,6 +7382,213 @@ msgstr "%s: همچین برنامه‌ای وجود ندارد %s"
msgid "%s: error launching application: %s\n"
msgstr "%s: خطا در اجرا برنامه: %s\n"
#: tools/gtk-path-tool.c:35
#, c-format
msgid ""
"Usage:\n"
" gtk4-path-tool [COMMAND] [OPTION…] PATH\n"
"\n"
"Perform various tasks on paths.\n"
"\n"
"Commands:\n"
" decompose Decompose the path\n"
" show Display the path in a window\n"
" render Render the path as an image\n"
" info Print information about the path\n"
"\n"
msgstr ""
"استفاده:\n"
" gtk4-path-tool [دستور] [‫گزینه…‬] FILE\n"
"\n"
"انجام وظایف مختلف روی مسیرها.\n"
"\n"
"\n"
" decompose باز کردن مسیر\n"
" show نمایش مسیر در یک پنجره\n"
" render پرداخت مسیر به شکل یک عکس\n"
" info چاپ اطّلاعات دربارهٔ مسیر\n"
"\n"
#: tools/gtk-path-tool-decompose.c:75
msgid "Allow quadratic Bézier curves"
msgstr "اجازه به منحی‌های درجه دوم بزیه"
#: tools/gtk-path-tool-decompose.c:76
msgid "Allow cubic Bézier curves"
msgstr "اجازه به منحی‌های درجه سوم بزیه"
#: tools/gtk-path-tool-decompose.c:77 tools/gtk-path-tool-info.c:34
#: tools/gtk-path-tool-render.c:63 tools/gtk-path-tool-show.c:132
msgid "PATH"
msgstr "PATH"
#: tools/gtk-path-tool-decompose.c:89
msgid "Decompose a path."
msgstr "باز کردن یک مسیر."
#: tools/gtk-path-tool-decompose.c:102 tools/gtk-path-tool-info.c:58
msgid "No paths given."
msgstr "مسیری داده نشده"
#: tools/gtk-path-tool-decompose.c:128
msgid "That didn't work out."
msgstr "کار نکرد."
#: tools/gtk-path-tool-info.c:45
msgid "Print information about a path."
msgstr "چاپ اطّلاعات دربارهٔ یک مسیر."
#: tools/gtk-path-tool-info.c:65
msgid "Path is empty."
msgstr "مسیر خالی است."
#: tools/gtk-path-tool-info.c:69
msgid "Path is closed"
msgstr "مسیر بسته است"
#: tools/gtk-path-tool-render.c:52 tools/gtk-path-tool-show.c:122
msgid "Fill rule (winding, even-odd)"
msgstr "قاعدهٔ پر کردن (winding, even-odd)"
#: tools/gtk-path-tool-render.c:52 tools/gtk-path-tool-render.c:56
#: tools/gtk-path-tool-render.c:57 tools/gtk-path-tool-render.c:58
#: tools/gtk-path-tool-render.c:59 tools/gtk-path-tool-render.c:60
#: tools/gtk-path-tool-render.c:61 tools/gtk-path-tool-show.c:122
#: tools/gtk-path-tool-show.c:126 tools/gtk-path-tool-show.c:127
#: tools/gtk-path-tool-show.c:128 tools/gtk-path-tool-show.c:129
#: tools/gtk-path-tool-show.c:130 tools/gtk-path-tool-show.c:131
msgid "VALUE"
msgstr "VALUE"
#: tools/gtk-path-tool-render.c:53 tools/gtk-path-tool-show.c:123
msgid "Foreground color"
msgstr "رنگ پیش‌زمینه"
#: tools/gtk-path-tool-render.c:53 tools/gtk-path-tool-render.c:54
#: tools/gtk-path-tool-show.c:123 tools/gtk-path-tool-show.c:124
msgid "COLOR"
msgstr "COLOR"
#: tools/gtk-path-tool-render.c:54 tools/gtk-path-tool-show.c:124
msgid "Background color"
msgstr "رنگ پس‌زمینه"
#: tools/gtk-path-tool-render.c:55 tools/gtk-path-tool-show.c:125
msgid "Stroke the path instead of filling it"
msgstr "خط‌کشی دور مسیر به جای پر کردنش"
#: tools/gtk-path-tool-render.c:56 tools/gtk-path-tool-show.c:126
msgid "Line width (number)"
msgstr "پهنای خط (عدد)"
#: tools/gtk-path-tool-render.c:57 tools/gtk-path-tool-show.c:127
msgid "Line cap (butt, round, square)"
msgstr "کلاهک خط (butt, round, square)"
#: tools/gtk-path-tool-render.c:58 tools/gtk-path-tool-show.c:128
msgid "Line join (miter, miter-clip, round, bevel, arcs)"
msgstr "پیوستن خط (miter, miter-clip, round, bevel, arcs)"
#: tools/gtk-path-tool-render.c:59 tools/gtk-path-tool-show.c:129
msgid "Miter limit (number)"
msgstr "کران تاج (عدد)"
#: tools/gtk-path-tool-render.c:60 tools/gtk-path-tool-show.c:130
msgid "Dash pattern (comma-separated numbers)"
msgstr "الگوی نقطه‌چین (عددهای جدا شده با کاما)"
#: tools/gtk-path-tool-render.c:61 tools/gtk-path-tool-show.c:131
msgid "Dash offset (number)"
msgstr "انحراف از مبدأ نقطه‌چین (عدد)"
#: tools/gtk-path-tool-render.c:62
msgid "The output file"
msgstr "پروندهٔ خروجی"
#: tools/gtk-path-tool-render.c:81 tools/gtk-path-tool-show.c:145
msgid "Could not initialize windowing system"
msgstr "نتوانست سامانهٔ پنجره را راه‌اندازی کند"
#: tools/gtk-path-tool-render.c:89
msgid "Render the path to a png image."
msgstr "پرداخت مسیر در یک تصویر png."
#: tools/gtk-path-tool-render.c:102 tools/gtk-path-tool-show.c:166
msgid "No path specified"
msgstr "مسیری مشخّص نشده"
#: tools/gtk-path-tool-render.c:108
msgid "Can only render a single path"
msgstr "تنها می‌تواند یک تک‌مسیر را پرداخت کند"
#: tools/gtk-path-tool-render.c:114 tools/gtk-path-tool-show.c:178
msgid "fill rule"
msgstr "قاعدهٔ پر کردن"
#: tools/gtk-path-tool-render.c:118 tools/gtk-path-tool-show.c:182
msgid "line cap"
msgstr "کلاهک خط"
#: tools/gtk-path-tool-render.c:119 tools/gtk-path-tool-show.c:183
msgid "line join"
msgstr "پیوستن خط"
#: tools/gtk-path-tool-render.c:143 tools/gtk-path-tool-show.c:207
#, c-format
msgid "Failed to parse '%s' as number"
msgstr "شکست در تجزیهٔ «%s» به شکل عدد"
#: tools/gtk-path-tool-render.c:187
#, c-format
msgid "Saving png to '%s' failed"
msgstr "ذخیرهٔ png در «%s» شکست خورد"
#: tools/gtk-path-tool-render.c:194
#, c-format
msgid "Output written to '%s'."
msgstr "خروجی در «%s» نوشته شد."
#: tools/gtk-path-tool-show.c:43 tools/gtk-path-tool-show.c:78
msgid "Path Preview"
msgstr "پیش‌نمایش مسیر"
#: tools/gtk-path-tool-show.c:153
msgid "Display the path."
msgstr "نمایش مسیر."
#: tools/gtk-path-tool-show.c:172
msgid "Can only show a single path"
msgstr "تنها می‌تواند یک تک‌مسیر را نمایش دهد"
#: tools/gtk-path-tool-utils.c:58
#, c-format
msgid "Failed to read from standard input: %s\n"
msgstr "شکست در خواندن از ورودی استاندارد: %s\n"
#: tools/gtk-path-tool-utils.c:64
#, c-format
msgid "Error reading from standard input: %s\n"
msgstr "خطا در خواندن از ورودی استاندارد: %s\n"
#: tools/gtk-path-tool-utils.c:83
#, c-format
msgid "Failed to parse '%s' as path.\n"
msgstr "شکست در تجزیهٔ «%s» به شکل مسیر.\n"
#: tools/gtk-path-tool-utils.c:109
#, c-format
msgid "Failed to parse '%s' as %s."
msgstr "شکست در تجزیهٔ «%s» به شکل %s"
#: tools/gtk-path-tool-utils.c:111
msgid "Possible values: "
msgstr "مقدارهای ممکن: "
#: tools/gtk-path-tool-utils.c:135
#, c-format
msgid "Could not parse '%s' as color"
msgstr "نتوانست «%s» را به شکل رنگ تجزیه کند"
#: tools/gtk-rendernode-tool.c:35
#, c-format
msgid ""
@@ -7408,50 +7617,41 @@ msgstr ""
" screenshot نماگرفت از پرونده\n"
"\n"
#: tools/gtk-rendernode-tool-info.c:177
#: tools/gtk-rendernode-tool-info.c:185
#, c-format
msgid "Number of nodes: %u\n"
msgstr "شمار گره‌ها: %Iu\n"
#: tools/gtk-rendernode-tool-info.c:184
#: tools/gtk-rendernode-tool-info.c:192
#, c-format
msgid "Depth: %u\n"
msgstr "ژرفا: %Iu\n"
#: tools/gtk-rendernode-tool-info.c:187
#: tools/gtk-rendernode-tool-info.c:195
#, c-format
msgid "Bounds: %g x %g\n"
msgstr "مرزها: %g × %g\n"
#: tools/gtk-rendernode-tool-info.c:188
#: tools/gtk-rendernode-tool-info.c:196
#, c-format
msgid "Origin: %g %g\n"
msgstr "خاستگاه: %g × %g\n"
#: tools/gtk-rendernode-tool-info.c:209
#: tools/gtk-rendernode-tool-info.c:217
msgid "Provide information about the render node."
msgstr "اطّلاعاتی دربارهٔ گره پرداختگر فراهم می‌کند."
#: tools/gtk-rendernode-tool-info.c:222 tools/gtk-rendernode-tool-show.c:130
#: tools/gtk-rendernode-tool-render.c:225
#: tools/gtk-rendernode-tool-info.c:230 tools/gtk-rendernode-tool-render.c:225
#: tools/gtk-rendernode-tool-show.c:130
#, c-format
msgid "No .node file specified\n"
msgstr "هیچ پروندهٔ ‪.node‬ ای مشخّص نشده\n"
#: tools/gtk-rendernode-tool-info.c:228
#: tools/gtk-rendernode-tool-info.c:236
#, c-format
msgid "Can only accept a single .node file\n"
msgstr "تنها می‌تواند یک تک‌پروندهٔ ‪.node‬ را بپذیرد\n"
#: tools/gtk-rendernode-tool-show.c:117
msgid "Show the render node."
msgstr "نمایش گره پرداختگر."
#: tools/gtk-rendernode-tool-show.c:136
#, c-format
msgid "Can only preview a single .node file\n"
msgstr "تنها می‌تواند یک تک‌پروندهٔ ‪.node‬ را پیش‌نمایش دهد\n"
#: tools/gtk-rendernode-tool-render.c:123
#, c-format
msgid ""
@@ -7483,6 +7683,15 @@ msgstr "پرداخت یک پروندهٔ ‪.node‬ در یک تصویر."
msgid "Can only render a single .node file to a single output file\n"
msgstr "تنها می‌تواند یک تک‌پروندهٔ ‪.noide‬ را در یک پروندهٔ خروحی پرداخت کند\n"
#: tools/gtk-rendernode-tool-show.c:117
msgid "Show the render node."
msgstr "نمایش گره پرداختگر."
#: tools/gtk-rendernode-tool-show.c:136
#, c-format
msgid "Can only preview a single .node file\n"
msgstr "تنها می‌تواند یک تک‌پروندهٔ ‪.node‬ را پیش‌نمایش دهد\n"
#: tools/gtk-rendernode-tool-utils.c:51
#, c-format
msgid "Error at %s: %s\n"
@@ -8372,9 +8581,6 @@ msgstr ""
#~ msgid "Can't parse “%s”\n"
#~ msgstr "نمی‌توان «%s» را تجزیه کرد\n"
#~ msgid "Failed to parse png image"
#~ msgstr "شکست در تجزیهٔ تصویر png"
#~ msgid "Sandbox does not provide an OpenGL implementation"
#~ msgstr "قرنطینه پیاده‌سازی OpenGLای را فراهم نمی‌کند"
@@ -8508,9 +8714,6 @@ msgstr ""
#~ msgid "Size of the palette in 8 bit mode"
#~ msgstr "اندازهٔ تخته‌رنگ در حالت ۸ بیتی"
#~ msgid "COLORS"
#~ msgstr "COLORS"
#~ msgctxt "Action description"
#~ msgid "Toggles the cell"
#~ msgstr "تغییر وضعیت سلول"
@@ -8739,10 +8942,6 @@ msgstr ""
#~ msgid "_Print"
#~ msgstr "_چاپ"
#~ msgctxt "Stock label"
#~ msgid "Print Pre_view"
#~ msgstr "_پیش‌نمایش چاپ"
#~ msgctxt "Stock label"
#~ msgid "_Properties"
#~ msgstr "_ویژگی‌ها"
@@ -9906,9 +10105,6 @@ msgstr ""
#~ msgid "_Insert Unicode Control Character"
#~ msgstr "_درج نویسه‌ی کنترلی یونی‌کد"
#~ msgid "Could not add a bookmark"
#~ msgstr "نمی‌توان نشانکی اضافه کرد"
#~ msgid "Could not remove bookmark"
#~ msgstr "نمی‌توان نشانک را حذف کرد"
@@ -10099,9 +10295,6 @@ msgstr ""
#~ msgid "Failed to open temporary file"
#~ msgstr "باز کردن پرونده‌ی موقت شکست خورد"
#~ msgid "Failed to read from temporary file"
#~ msgstr "خواندن از پرونده‌ی موقت شکست خورد"
#~ msgid "Failed to open '%s' for writing: %s"
#~ msgstr "نمی‌توان «%s» را برای نوشتن باز کرد: %s"
+1252 -744
View File
File diff suppressed because it is too large Load Diff
+1207 -1669
View File
File diff suppressed because it is too large Load Diff
+297 -72
View File
@@ -11,8 +11,8 @@ msgid ""
msgstr ""
"Project-Id-Version: gtk\n"
"Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/gtk/-/issues/\n"
"POT-Creation-Date: 2023-07-31 15:14+0000\n"
"PO-Revision-Date: 2023-08-01 06:03+0200\n"
"POT-Creation-Date: 2023-08-15 19:28+0000\n"
"PO-Revision-Date: 2023-08-16 05:35+0200\n"
"Last-Translator: Ekaterine Papava <papava.e@gtu.ge>\n"
"Language-Team: Georgian <http://mail.gnome.org/mailman/listinfo/gnome-ge-"
"list>\n"
@@ -135,7 +135,7 @@ msgstr "აპლიკაციას %s-ის API-ის მხარდა
#. translators: This is about OpenGL backend names, like
#. * "Trying to use X11 GLX, but EGL is already in use"
#: gdk/gdkglcontext.c:1863
#: gdk/gdkglcontext.c:1864
#, c-format
msgid "Trying to use %s, but %s is already in use"
msgstr "%s გამოყენების მცდელობა, მაგრამ %s უკვე გამოიყენება"
@@ -1068,13 +1068,13 @@ msgid "Pick a Color"
msgstr "ფერის არჩევა"
#: gtk/deprecated/gtkcolorbutton.c:502 gtk/gtkcolorchooserwidget.c:313
#: gtk/gtkcolordialogbutton.c:302
#: gtk/gtkcolordialogbutton.c:335
#, c-format
msgid "Red %d%%, Green %d%%, Blue %d%%, Alpha %d%%"
msgstr "წითელი %d%%, მწვანე %d%%, ლურჯი %d%%, ალფა %d%%"
#: gtk/deprecated/gtkcolorbutton.c:508 gtk/gtkcolorchooserwidget.c:319
#: gtk/gtkcolordialogbutton.c:308
#: gtk/gtkcolordialogbutton.c:341
#, c-format
msgid "Red %d%%, Green %d%%, Blue %d%%"
msgstr "წითელი %d%%, მწვანე %d%%, ლურჯი %d%%"
@@ -1089,11 +1089,11 @@ msgid "Pick a Font"
msgstr "აირჩიეთ შრიფტი"
#: gtk/deprecated/gtkfontbutton.c:597 gtk/gtkfilechooserwidget.c:3871
#: gtk/gtkfontdialogbutton.c:115 gtk/inspector/visual.ui:169
#: gtk/gtkfontdialogbutton.c:126 gtk/inspector/visual.ui:169
msgid "Font"
msgstr "შრიფტი"
#: gtk/deprecated/gtkfontbutton.c:1152 gtk/gtkfontdialogbutton.c:614
#: gtk/deprecated/gtkfontbutton.c:1152 gtk/gtkfontdialogbutton.c:652
msgctxt "font"
msgid "None"
msgstr "არცერთი"
@@ -2227,7 +2227,7 @@ msgstr "ფაილი ამ სახელით უკვე არსე
#: gtk/gtkmessagedialog.c:179 gtk/gtkmountoperation.c:608
#: gtk/print/gtkpagesetupunixdialog.c:282 gtk/print/gtkprintbackend.c:638
#: gtk/print/gtkprintunixdialog.c:682 gtk/print/gtkprintunixdialog.c:839
#: gtk/gtkwindow.c:6238 gtk/ui/gtkappchooserdialog.ui:48
#: gtk/gtkwindow.c:6242 gtk/ui/gtkappchooserdialog.ui:48
#: gtk/ui/gtkassistant.ui:52 gtk/ui/gtkcolorchooserdialog.ui:36
#: gtk/ui/gtkfontchooserdialog.ui:27
msgid "_Cancel"
@@ -2243,7 +2243,7 @@ msgstr "გახსნა"
msgid "_Save"
msgstr "შენახვა"
#: gtk/gtkfilechoosernativequartz.c:340 gtk/ui/gtkfilechooserwidget.ui:288
#: gtk/gtkfilechoosernativequartz.c:344 gtk/ui/gtkfilechooserwidget.ui:288
msgid "Select which types of files are shown"
msgstr "ფაილის ტიპების შერჩევა საჩვენებლად"
@@ -2315,7 +2315,7 @@ msgid "If you delete an item, it will be permanently lost."
msgstr "თუ წაშლით ელემენტს, ის სამუდამოდ დაიკარგება."
#: gtk/gtkfilechooserwidget.c:1185 gtk/gtkfilechooserwidget.c:1815
#: gtk/gtklabel.c:5693 gtk/gtktext.c:6125 gtk/gtktextview.c:9018
#: gtk/gtklabel.c:5695 gtk/gtktext.c:6145 gtk/gtktextview.c:9018
msgid "_Delete"
msgstr "წაშლა"
@@ -2456,7 +2456,7 @@ msgstr "პროგრამა"
msgid "Audio"
msgstr "აუდიო"
#: gtk/gtkfilechooserwidget.c:3872 gtk/gtkfilefilter.c:1035
#: gtk/gtkfilechooserwidget.c:3872 gtk/gtkfilefilter.c:1032
msgid "Image"
msgstr "გამოსახულება"
@@ -2566,7 +2566,7 @@ msgstr "მონიშნეთ საქაღალდეები"
msgid "Select a Folder"
msgstr "აირჩიეთ საქაღალდე"
#: gtk/gtkfilefilter.c:1048
#: gtk/gtkfilefilter.c:1045
msgid "Unspecified"
msgstr "მიუთითებელი"
@@ -2654,31 +2654,31 @@ msgstr "დახურვა"
msgid "Close the infobar"
msgstr "საინფორმაციო ზოლის დახურვა"
#: gtk/gtklabel.c:5690 gtk/gtktext.c:6113 gtk/gtktextview.c:9006
#: gtk/gtklabel.c:5692 gtk/gtktext.c:6133 gtk/gtktextview.c:9006
msgid "Cu_t"
msgstr "ამოჭრა"
#: gtk/gtklabel.c:5691 gtk/gtktext.c:6117 gtk/gtktextview.c:9010
#: gtk/gtklabel.c:5693 gtk/gtktext.c:6137 gtk/gtktextview.c:9010
msgid "_Copy"
msgstr "ასლი"
#: gtk/gtklabel.c:5692 gtk/gtktext.c:6121 gtk/gtktextview.c:9014
#: gtk/gtklabel.c:5694 gtk/gtktext.c:6141 gtk/gtktextview.c:9014
msgid "_Paste"
msgstr "ჩასმა"
#: gtk/gtklabel.c:5698 gtk/gtktext.c:6134 gtk/gtktextview.c:9039
#: gtk/gtklabel.c:5700 gtk/gtktext.c:6154 gtk/gtktextview.c:9039
msgid "Select _All"
msgstr "ყველაფრის _მონიშვნა"
#: gtk/gtklabel.c:5703
#: gtk/gtklabel.c:5705
msgid "_Open Link"
msgstr "_ბმულის გახსნა"
#: gtk/gtklabel.c:5707
#: gtk/gtklabel.c:5709
msgid "Copy _Link Address"
msgstr "დაა_კოპირე ბმულის მისამართი"
#: gtk/gtklabel.c:5751 gtk/gtktext.c:2716 gtk/gtktextview.c:9088
#: gtk/gtklabel.c:5753 gtk/gtktext.c:2716 gtk/gtktextview.c:9088
msgid "Context menu"
msgstr "კონტექსტური მენიუ"
@@ -2749,7 +2749,7 @@ msgid "Play"
msgstr "დაკვრა"
#: gtk/gtkmessagedialog.c:162 gtk/gtkmessagedialog.c:180
#: gtk/print/gtkprintbackend.c:639 gtk/gtkwindow.c:6239
#: gtk/print/gtkprintbackend.c:639 gtk/gtkwindow.c:6243
msgid "_OK"
msgstr "_დიახ"
@@ -3613,7 +3613,7 @@ msgctxt "accessibility"
msgid "Sidebar"
msgstr "გვერდითა ზოლი"
#: gtk/gtktext.c:6139 gtk/gtktextview.c:9044
#: gtk/gtktext.c:6159 gtk/gtktextview.c:9044
msgid "Insert _Emoji"
msgstr "ემოჯის _ჩასმა"
@@ -3625,12 +3625,12 @@ msgstr "_დაბრუნება"
msgid "_Redo"
msgstr "_გამეორება"
#: gtk/gtkwindow.c:6227
#: gtk/gtkwindow.c:6231
#, c-format
msgid "Do you want to use GTK Inspector?"
msgstr "გნებავთ GTK-ის ინსპექტორის გამოყენება?"
#: gtk/gtkwindow.c:6229
#: gtk/gtkwindow.c:6233
#, c-format
msgid ""
"GTK Inspector is an interactive debugger that lets you explore and modify "
@@ -3641,7 +3641,7 @@ msgstr ""
"ნებისმიერი GTK აპლიკაციის შიდა პარამეტრები დაათვალიეროთ და შეცვალოთ. მისი "
"გამოყენებით ასევე შეიძლება პროგრამა ავარიულად დასრულდეს."
#: gtk/gtkwindow.c:6234
#: gtk/gtkwindow.c:6238
msgid "Dont show this message again"
msgstr "მეტჯერ აღარ მაჩვენო ეს გაფრთხილება"
@@ -3677,7 +3677,8 @@ msgstr "როლი"
msgid "Description"
msgstr "აღწერა"
#: gtk/inspector/a11y.ui:99 gtk/inspector/misc-info.ui:297
#: gtk/inspector/a11y.ui:99 gtk/inspector/misc-info.ui:296
#: tools/gtk-path-tool-info.c:128
msgid "Bounds"
msgstr "საზღვრები"
@@ -3978,61 +3979,61 @@ msgstr "მოთხოვნის რეჟიმი"
msgid "Measure map"
msgstr "საზომი რუკა"
#: gtk/inspector/misc-info.ui:254
#: gtk/inspector/misc-info.ui:253
msgid "Expand"
msgstr "გაფართოება"
#: gtk/inspector/misc-info.ui:322
#: gtk/inspector/misc-info.ui:321
msgid "Baseline"
msgstr "საბაზისო ხაზი"
#: gtk/inspector/misc-info.ui:347
#: gtk/inspector/misc-info.ui:346
msgid "Surface"
msgstr "ზედაპირი"
#: gtk/inspector/misc-info.ui:366 gtk/inspector/misc-info.ui:401
#: gtk/inspector/misc-info.ui:436 gtk/inspector/prop-editor.c:1150
#: gtk/inspector/misc-info.ui:365 gtk/inspector/misc-info.ui:400
#: gtk/inspector/misc-info.ui:435 gtk/inspector/prop-editor.c:1150
#: gtk/inspector/prop-editor.c:1533 gtk/inspector/window.ui:396
msgid "Properties"
msgstr "თვისებები"
#: gtk/inspector/misc-info.ui:382
#: gtk/inspector/misc-info.ui:381
msgid "Renderer"
msgstr "რენდერერი"
#: gtk/inspector/misc-info.ui:417
#: gtk/inspector/misc-info.ui:416
msgid "Frame Clock"
msgstr "კადრების საათი"
#: gtk/inspector/misc-info.ui:452
#: gtk/inspector/misc-info.ui:451
msgid "Tick Callback"
msgstr "რბილი უკუგამოძახება"
#: gtk/inspector/misc-info.ui:478
#: gtk/inspector/misc-info.ui:477
msgid "Frame Count"
msgstr "კადრების რაოდენობა"
#: gtk/inspector/misc-info.ui:503
#: gtk/inspector/misc-info.ui:502
msgid "Frame Rate"
msgstr "კადრების სიხშირე"
#: gtk/inspector/misc-info.ui:528
#: gtk/inspector/misc-info.ui:527
msgid "Scale"
msgstr "მასშტაბი"
#: gtk/inspector/misc-info.ui:553
#: gtk/inspector/misc-info.ui:552
msgid "Mapped"
msgstr "მიმაგრებულია"
#: gtk/inspector/misc-info.ui:579
#: gtk/inspector/misc-info.ui:578
msgid "Realized"
msgstr "რეალიზებულია"
#: gtk/inspector/misc-info.ui:605
#: gtk/inspector/misc-info.ui:604
msgid "Is Toplevel"
msgstr "თავშია"
#: gtk/inspector/misc-info.ui:631
#: gtk/inspector/misc-info.ui:630
msgid "Child Visible"
msgstr "ხილული შვილი"
@@ -4140,7 +4141,7 @@ msgstr "წყარო:"
msgid "Defined At"
msgstr "აღწერის წერტილი"
#: gtk/inspector/recorder.c:1865
#: gtk/inspector/recorder.c:1922
#, c-format
msgid "Saving RenderNode failed"
msgstr "RenderNode-ის შენახვის შეცდომა"
@@ -6820,7 +6821,7 @@ msgstr "ავტომატური არჩევა"
#: modules/printbackends/gtkprintbackendcups.c:4616
msgctxt "printing option value"
msgid "Printer Default"
msgstr "ნაგულისხმეი პრინტერი"
msgstr "ნაგულისხმეი პრინტერი"
#. Translators: this is an option of "GhostScript"
#: modules/printbackends/gtkprintbackendcups.c:4618
@@ -6965,7 +6966,7 @@ msgstr "თარო %d"
#: modules/printbackends/gtkprintbackendcups.c:5198
msgid "Printer Default"
msgstr "ნაგულისხმეი პრინტერი"
msgstr "ნაგულისხმეი პრინტერი"
#. Translators, this string is used to label the job priority option
#. * in the print dialog
@@ -7183,7 +7184,8 @@ msgstr ""
#: tools/gtk-builder-tool-enumerate.c:56 tools/gtk-builder-tool-preview.c:179
#: tools/gtk-builder-tool-preview.c:180 tools/gtk-builder-tool-screenshot.c:360
#: tools/gtk-builder-tool-simplify.c:2529 tools/gtk-builder-tool-validate.c:261
#: tools/gtk-rendernode-tool-info.c:200 tools/gtk-rendernode-tool-show.c:102
#: tools/gtk-path-tool-render.c:62 tools/gtk-rendernode-tool-info.c:208
#: tools/gtk-rendernode-tool-show.c:102
msgid "FILE"
msgstr "FILE"
@@ -7215,8 +7217,8 @@ msgid "Use style from CSS file"
msgstr "სტილის CSS ფაილიდან გამოყენება"
#: tools/gtk-builder-tool-preview.c:187 tools/gtk-builder-tool-screenshot.c:370
#: tools/gtk-builder-tool-validate.c:268 tools/gtk-rendernode-tool-show.c:109
#: tools/gtk-rendernode-tool-render.c:204
#: tools/gtk-builder-tool-validate.c:268 tools/gtk-rendernode-tool-render.c:204
#: tools/gtk-rendernode-tool-show.c:109
#, c-format
msgid "Could not initialize windowing system\n"
msgstr "ფანჯრული სისტემის ინიციალიზაციის შეცდომა\n"
@@ -7441,6 +7443,238 @@ msgstr "%s: ასეთი აპლიკაცია არ არსებ
msgid "%s: error launching application: %s\n"
msgstr "%s: აპლიკაციის გაშვების შეცდომა: %s\n"
#: tools/gtk-path-tool.c:35
#, c-format
msgid ""
"Usage:\n"
" gtk4-path-tool [COMMAND] [OPTION…] PATH\n"
"\n"
"Perform various tasks on paths.\n"
"\n"
"Commands:\n"
" decompose Decompose the path\n"
" show Display the path in a window\n"
" render Render the path as an image\n"
" info Print information about the path\n"
"\n"
msgstr ""
"Usage:\n"
" gtk4-path-tool [ბრძანება] [პარამეტრი…] ბილიკი\n"
"\n"
"სხვადასხვა დავალებების შესრულება ბილიკებზე.\n"
"\n"
"ბრძანებები:\n"
" decompose ბილიკის დაშლა\n"
" show ბილიკის ფანჯარაში ჩვენება\n"
" render ბილიკის რენდერი გამოსახულების სახით\n"
" info ბილიკის შესახებ ინფორმაციის გამოტანა\n"
"\n"
#: tools/gtk-path-tool-decompose.c:75
msgid "Allow quadratic Bézier curves"
msgstr "კვადრატული ბეზიეს მრუდების დაშვება"
#: tools/gtk-path-tool-decompose.c:76
msgid "Allow cubic Bézier curves"
msgstr "კუბური ბეზიეს მრუდების დაშვება"
#: tools/gtk-path-tool-decompose.c:77 tools/gtk-path-tool-info.c:88
#: tools/gtk-path-tool-render.c:63 tools/gtk-path-tool-show.c:132
msgid "PATH"
msgstr "ბილიკი"
#: tools/gtk-path-tool-decompose.c:89
msgid "Decompose a path."
msgstr "ბილიკის დაშლა."
#: tools/gtk-path-tool-decompose.c:102 tools/gtk-path-tool-info.c:112
msgid "No paths given."
msgstr "ბილიკები მითითებული არაა."
#: tools/gtk-path-tool-decompose.c:128
msgid "That didn't work out."
msgstr "ამან არ იმუშავა."
#: tools/gtk-path-tool-info.c:99
msgid "Print information about a path."
msgstr "ბილიკის შესახებ ინფორმაციის ჩვენება."
#: tools/gtk-path-tool-info.c:119
msgid "Path is empty."
msgstr "ბილიკი ცარიელია."
#: tools/gtk-path-tool-info.c:125
msgid "Path is closed"
msgstr "ბილიკი დახურულია"
#: tools/gtk-path-tool-info.c:134
#, c-format
msgid "%d contours"
msgstr "%d მოხაზულობა"
#: tools/gtk-path-tool-info.c:136
#, c-format
msgid "%d operations"
msgstr "%d ოპერაცია"
#: tools/gtk-path-tool-info.c:140
#, c-format
msgid "%d lines"
msgstr "%d ხაზი"
#: tools/gtk-path-tool-info.c:145
#, c-format
msgid "%d quadratics"
msgstr "%d კვადრატი"
#: tools/gtk-path-tool-info.c:150
#, c-format
msgid "%d cubics"
msgstr "%d კუბი"
#: tools/gtk-path-tool-render.c:52 tools/gtk-path-tool-show.c:122
msgid "Fill rule (winding, even-odd)"
msgstr "შევსების წესი (winding, even-odd)"
#: tools/gtk-path-tool-render.c:52 tools/gtk-path-tool-render.c:56
#: tools/gtk-path-tool-render.c:57 tools/gtk-path-tool-render.c:58
#: tools/gtk-path-tool-render.c:59 tools/gtk-path-tool-render.c:60
#: tools/gtk-path-tool-render.c:61 tools/gtk-path-tool-show.c:122
#: tools/gtk-path-tool-show.c:126 tools/gtk-path-tool-show.c:127
#: tools/gtk-path-tool-show.c:128 tools/gtk-path-tool-show.c:129
#: tools/gtk-path-tool-show.c:130 tools/gtk-path-tool-show.c:131
msgid "VALUE"
msgstr "მნიშვნელობა"
#: tools/gtk-path-tool-render.c:53 tools/gtk-path-tool-show.c:123
msgid "Foreground color"
msgstr "წინა პლანის ფერი"
#: tools/gtk-path-tool-render.c:53 tools/gtk-path-tool-render.c:54
#: tools/gtk-path-tool-show.c:123 tools/gtk-path-tool-show.c:124
msgid "COLOR"
msgstr "ფერი"
#: tools/gtk-path-tool-render.c:54 tools/gtk-path-tool-show.c:124
msgid "Background color"
msgstr "ფონის ფერი"
#: tools/gtk-path-tool-render.c:55 tools/gtk-path-tool-show.c:125
msgid "Stroke the path instead of filling it"
msgstr "ბილიკის შემოვლება მისი შევსების მაგიერ"
#: tools/gtk-path-tool-render.c:56 tools/gtk-path-tool-show.c:126
msgid "Line width (number)"
msgstr "ხაზის სიგანე (რიცხვი)"
#: tools/gtk-path-tool-render.c:57 tools/gtk-path-tool-show.c:127
msgid "Line cap (butt, round, square)"
msgstr "ხაზის თავი (ისარი, მრგვალი, კვადრატი)"
#: tools/gtk-path-tool-render.c:58 tools/gtk-path-tool-show.c:128
msgid "Line join (miter, miter-clip, round, bevel, arcs)"
msgstr "ხაზების შეერთება (miter, miter-clip, round, bevel, arcs)"
#: tools/gtk-path-tool-render.c:59 tools/gtk-path-tool-show.c:129
msgid "Miter limit (number)"
msgstr "Miter-ის ლიმიტი (რიცხვი)"
#: tools/gtk-path-tool-render.c:60 tools/gtk-path-tool-show.c:130
msgid "Dash pattern (comma-separated numbers)"
msgstr "პუნქტირის ნიმუში (მძიმით გამოყოფილი რიცხვები)"
#: tools/gtk-path-tool-render.c:61 tools/gtk-path-tool-show.c:131
msgid "Dash offset (number)"
msgstr "პუნქტირის წანაცვლება (რიცხვი)"
#: tools/gtk-path-tool-render.c:62
msgid "The output file"
msgstr "გამოტანის ფაილი"
#: tools/gtk-path-tool-render.c:81 tools/gtk-path-tool-show.c:145
msgid "Could not initialize windowing system"
msgstr "ფანჯრული სისტემის ინიციალიზაციის შეცდომა"
#: tools/gtk-path-tool-render.c:89
msgid "Render the path to a png image."
msgstr "ბილიკის რენდერი png გამოსახულებაში."
#: tools/gtk-path-tool-render.c:102 tools/gtk-path-tool-show.c:166
msgid "No path specified"
msgstr "ბილიკი მითითებული არაა"
#: tools/gtk-path-tool-render.c:108
msgid "Can only render a single path"
msgstr "შესაძლებელია მხოლოდ ერთ ბილიკის რენდერი"
#: tools/gtk-path-tool-render.c:114 tools/gtk-path-tool-show.c:178
msgid "fill rule"
msgstr "შევსების წესი"
#: tools/gtk-path-tool-render.c:118 tools/gtk-path-tool-show.c:182
msgid "line cap"
msgstr "ხაზის თავი"
#: tools/gtk-path-tool-render.c:119 tools/gtk-path-tool-show.c:183
msgid "line join"
msgstr "ხაზების შეერთება"
#: tools/gtk-path-tool-render.c:143 tools/gtk-path-tool-show.c:207
#, c-format
msgid "Failed to parse '%s' as number"
msgstr "'%s'-ის რიცხვის სახით წაკითხვა შეუძლებელია"
#: tools/gtk-path-tool-render.c:187
#, c-format
msgid "Saving png to '%s' failed"
msgstr "PNG-ის '%s'-ში შენახვა შეუძლებელია"
#: tools/gtk-path-tool-render.c:194
#, c-format
msgid "Output written to '%s'."
msgstr "გამოტანილი ინფორმაცია ჩაწერილია %s-ში."
#: tools/gtk-path-tool-show.c:43 tools/gtk-path-tool-show.c:78
msgid "Path Preview"
msgstr "ბილიკის მინიატურა"
#: tools/gtk-path-tool-show.c:153
msgid "Display the path."
msgstr "ბილიკის ჩვენება."
#: tools/gtk-path-tool-show.c:172
msgid "Can only show a single path"
msgstr "შესაძლებელია მხოლოდ ერთი ბილიკის ჩვენება"
#: tools/gtk-path-tool-utils.c:58
#, c-format
msgid "Failed to read from standard input: %s\n"
msgstr "სტანდარტული შეყვანიდან წაკითხვა ჩავარდა: %s\n"
#: tools/gtk-path-tool-utils.c:64
#, c-format
msgid "Error reading from standard input: %s\n"
msgstr "სტანდარტული შეყვანიდან წაკითხვის შეცდომა: %s\n"
#: tools/gtk-path-tool-utils.c:83
#, c-format
msgid "Failed to parse '%s' as path.\n"
msgstr "'%s'-ის ბილიკად დამუშავება შეუძლებელია.\n"
#: tools/gtk-path-tool-utils.c:109
#, c-format
msgid "Failed to parse '%s' as %s."
msgstr "'%s'-ის '%s'-ად დამუშავება შეუძლებელია."
#: tools/gtk-path-tool-utils.c:111
msgid "Possible values: "
msgstr "შესაძლო მნიშვნელობები: "
#: tools/gtk-path-tool-utils.c:135
#, c-format
msgid "Could not parse '%s' as color"
msgstr "'%s'-ის ფერის სახით დამუშავება შეუძლებელია"
#: tools/gtk-rendernode-tool.c:35
#, c-format
msgid ""
@@ -7466,50 +7700,41 @@ msgstr ""
" render კვანძის ეკრანის ანაბეჭდის აღება\n"
"\n"
#: tools/gtk-rendernode-tool-info.c:177
#: tools/gtk-rendernode-tool-info.c:185
#, c-format
msgid "Number of nodes: %u\n"
msgstr "კვანძების რიცხვი: %u\n"
#: tools/gtk-rendernode-tool-info.c:184
#: tools/gtk-rendernode-tool-info.c:192
#, c-format
msgid "Depth: %u\n"
msgstr "სიღრმე: %u\n"
#: tools/gtk-rendernode-tool-info.c:187
#: tools/gtk-rendernode-tool-info.c:195
#, c-format
msgid "Bounds: %g x %g\n"
msgstr "საზღვრები: %g x %g\n"
#: tools/gtk-rendernode-tool-info.c:188
#: tools/gtk-rendernode-tool-info.c:196
#, c-format
msgid "Origin: %g %g\n"
msgstr "საწყისი: %g %g\n"
#: tools/gtk-rendernode-tool-info.c:209
#: tools/gtk-rendernode-tool-info.c:217
msgid "Provide information about the render node."
msgstr "შეიყვანეთ ინფორმაცია რენდერის კვანძის შესახებ."
#: tools/gtk-rendernode-tool-info.c:222 tools/gtk-rendernode-tool-show.c:130
#: tools/gtk-rendernode-tool-render.c:225
#: tools/gtk-rendernode-tool-info.c:230 tools/gtk-rendernode-tool-render.c:225
#: tools/gtk-rendernode-tool-show.c:130
#, c-format
msgid "No .node file specified\n"
msgstr ".ui ფაილი მითითებული არაა\n"
#: tools/gtk-rendernode-tool-info.c:228
#: tools/gtk-rendernode-tool-info.c:236
#, c-format
msgid "Can only accept a single .node file\n"
msgstr "შეგიძლიათ მხოლოდ ერთი .node ფაილის მიღება\n"
#: tools/gtk-rendernode-tool-show.c:117
msgid "Show the render node."
msgstr "რენდერის კვანძის ჩვენება."
#: tools/gtk-rendernode-tool-show.c:136
#, c-format
msgid "Can only preview a single .node file\n"
msgstr "შეგიძლიათ მხოლოდ ერთი .node ფაილის გადახედვა\n"
#: tools/gtk-rendernode-tool-render.c:123
#, c-format
msgid ""
@@ -7542,6 +7767,15 @@ msgstr ".ui ფაილის რენდერი გამოსახულ
msgid "Can only render a single .node file to a single output file\n"
msgstr "ერთი .node ფაილის მხოლოდ ერთ გამოტანის ფაილში რენდერი შეგიძლიათ\n"
#: tools/gtk-rendernode-tool-show.c:117
msgid "Show the render node."
msgstr "რენდერის კვანძის ჩვენება."
#: tools/gtk-rendernode-tool-show.c:136
#, c-format
msgid "Can only preview a single .node file\n"
msgstr "შეგიძლიათ მხოლოდ ერთი .node ფაილის გადახედვა\n"
#: tools/gtk-rendernode-tool-utils.c:51
#, c-format
msgid "Error at %s: %s\n"
@@ -8475,9 +8709,6 @@ msgstr ""
#~ msgid "Num Lock is on"
#~ msgstr "_მისამართის ასლი"
#~ msgid "Could not add a bookmark"
#~ msgstr "სანიშნის დამატება ვერ ხერხდება"
#~ msgid "Could not remove bookmark"
#~ msgstr "სანიშნის ამოშლა ვერ ხერხდება"
@@ -8878,9 +9109,6 @@ msgstr ""
#~ msgid "Could not get information for file '%s': %s"
#~ msgstr "ვერ მივიღე ინფორმაცია ფაილზე \"%s\": %s"
#~ msgid "Failed to open file '%s': %s"
#~ msgstr "ვერ გაიხსნა ფაილი \"%s\": %s"
#~ msgid ""
#~ "Failed to load image '%s': reason not known, probably a corrupt image file"
#~ msgstr ""
@@ -8933,9 +9161,6 @@ msgstr ""
#~ msgid "Failed to open temporary file"
#~ msgstr "დროებითი ფაილი ვერ იხსნება"
#~ msgid "Failed to read from temporary file"
#~ msgstr "დროებითი ფაილი ვერ იკითხება"
#~ msgid "Failed to open '%s' for writing: %s"
#~ msgstr "ვერ იხსნება ფაილი \"%s\" ჩასაწერად: %s"
+1369 -749
View File
File diff suppressed because it is too large Load Diff
+300 -70
View File
@@ -9,8 +9,8 @@ msgid ""
msgstr ""
"Project-Id-Version: gtk+\n"
"Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/gtk/-/issues/\n"
"POT-Creation-Date: 2023-07-31 15:14+0000\n"
"PO-Revision-Date: 2023-08-04 22:43+0300\n"
"POT-Creation-Date: 2023-08-15 19:28+0000\n"
"PO-Revision-Date: 2023-08-16 14:37+0300\n"
"Last-Translator: Yuri Chornoivan <yurchor@ukr.net>\n"
"Language-Team: Ukrainian <trans-uk@lists.fedoraproject.org>\n"
"Language: uk\n"
@@ -139,7 +139,7 @@ msgstr "У програмі не передбачено підтримки пр
#. translators: This is about OpenGL backend names, like
#. * "Trying to use X11 GLX, but EGL is already in use"
#: gdk/gdkglcontext.c:1863
#: gdk/gdkglcontext.c:1864
#, c-format
msgid "Trying to use %s, but %s is already in use"
msgstr "Намагаємося скористатися %s, але %s вже використано"
@@ -1077,13 +1077,13 @@ msgid "Pick a Color"
msgstr "Вибір кольору"
#: gtk/deprecated/gtkcolorbutton.c:502 gtk/gtkcolorchooserwidget.c:313
#: gtk/gtkcolordialogbutton.c:302
#: gtk/gtkcolordialogbutton.c:335
#, c-format
msgid "Red %d%%, Green %d%%, Blue %d%%, Alpha %d%%"
msgstr "Червоний %d%%, Зелений %d%%, Синій %d%%, Альфа %d%%"
#: gtk/deprecated/gtkcolorbutton.c:508 gtk/gtkcolorchooserwidget.c:319
#: gtk/gtkcolordialogbutton.c:308
#: gtk/gtkcolordialogbutton.c:341
#, c-format
msgid "Red %d%%, Green %d%%, Blue %d%%"
msgstr "Червоний %d%%, Зелений %d%%, Синій %d%%"
@@ -1098,11 +1098,11 @@ msgid "Pick a Font"
msgstr "Виберіть шрифт"
#: gtk/deprecated/gtkfontbutton.c:597 gtk/gtkfilechooserwidget.c:3871
#: gtk/gtkfontdialogbutton.c:115 gtk/inspector/visual.ui:169
#: gtk/gtkfontdialogbutton.c:126 gtk/inspector/visual.ui:169
msgid "Font"
msgstr "Шрифт"
#: gtk/deprecated/gtkfontbutton.c:1152 gtk/gtkfontdialogbutton.c:614
#: gtk/deprecated/gtkfontbutton.c:1152 gtk/gtkfontdialogbutton.c:652
msgctxt "font"
msgid "None"
msgstr "Немає"
@@ -2238,7 +2238,7 @@ msgstr "Файл з такою назвою вже існує"
#: gtk/gtkmessagedialog.c:179 gtk/gtkmountoperation.c:608
#: gtk/print/gtkpagesetupunixdialog.c:282 gtk/print/gtkprintbackend.c:638
#: gtk/print/gtkprintunixdialog.c:682 gtk/print/gtkprintunixdialog.c:839
#: gtk/gtkwindow.c:6238 gtk/ui/gtkappchooserdialog.ui:48
#: gtk/gtkwindow.c:6242 gtk/ui/gtkappchooserdialog.ui:48
#: gtk/ui/gtkassistant.ui:52 gtk/ui/gtkcolorchooserdialog.ui:36
#: gtk/ui/gtkfontchooserdialog.ui:27
msgid "_Cancel"
@@ -2254,7 +2254,7 @@ msgstr "_Відкрити"
msgid "_Save"
msgstr "З_берегти"
#: gtk/gtkfilechoosernativequartz.c:340 gtk/ui/gtkfilechooserwidget.ui:288
#: gtk/gtkfilechoosernativequartz.c:344 gtk/ui/gtkfilechooserwidget.ui:288
msgid "Select which types of files are shown"
msgstr "Виберіть типи файлів, які слід показувати"
@@ -2326,7 +2326,7 @@ msgid "If you delete an item, it will be permanently lost."
msgstr "Якщо вилучити об'єкт, його буде втрачено назавжди."
#: gtk/gtkfilechooserwidget.c:1185 gtk/gtkfilechooserwidget.c:1815
#: gtk/gtklabel.c:5693 gtk/gtktext.c:6125 gtk/gtktextview.c:9018
#: gtk/gtklabel.c:5695 gtk/gtktext.c:6145 gtk/gtktextview.c:9018
msgid "_Delete"
msgstr "В_илучити"
@@ -2467,7 +2467,7 @@ msgstr "Програма"
msgid "Audio"
msgstr "Звук"
#: gtk/gtkfilechooserwidget.c:3872 gtk/gtkfilefilter.c:1035
#: gtk/gtkfilechooserwidget.c:3872 gtk/gtkfilefilter.c:1032
msgid "Image"
msgstr "Картинка"
@@ -2576,7 +2576,7 @@ msgstr "Вибір тек"
msgid "Select a Folder"
msgstr "Вибір теки"
#: gtk/gtkfilefilter.c:1048
#: gtk/gtkfilefilter.c:1045
msgid "Unspecified"
msgstr "Не визначено"
@@ -2664,31 +2664,31 @@ msgstr "Закрити"
msgid "Close the infobar"
msgstr "Закрити панель відомостей"
#: gtk/gtklabel.c:5690 gtk/gtktext.c:6113 gtk/gtktextview.c:9006
#: gtk/gtklabel.c:5692 gtk/gtktext.c:6133 gtk/gtktextview.c:9006
msgid "Cu_t"
msgstr "Ви_різати"
#: gtk/gtklabel.c:5691 gtk/gtktext.c:6117 gtk/gtktextview.c:9010
#: gtk/gtklabel.c:5693 gtk/gtktext.c:6137 gtk/gtktextview.c:9010
msgid "_Copy"
msgstr "_Копіювати"
#: gtk/gtklabel.c:5692 gtk/gtktext.c:6121 gtk/gtktextview.c:9014
#: gtk/gtklabel.c:5694 gtk/gtktext.c:6141 gtk/gtktextview.c:9014
msgid "_Paste"
msgstr "Вст_авити"
#: gtk/gtklabel.c:5698 gtk/gtktext.c:6134 gtk/gtktextview.c:9039
#: gtk/gtklabel.c:5700 gtk/gtktext.c:6154 gtk/gtktextview.c:9039
msgid "Select _All"
msgstr "Виді_лити все"
#: gtk/gtklabel.c:5703
#: gtk/gtklabel.c:5705
msgid "_Open Link"
msgstr "_Відкрити посилання"
#: gtk/gtklabel.c:5707
#: gtk/gtklabel.c:5709
msgid "Copy _Link Address"
msgstr "Копіювати _адресу посилання"
#: gtk/gtklabel.c:5751 gtk/gtktext.c:2716 gtk/gtktextview.c:9088
#: gtk/gtklabel.c:5753 gtk/gtktext.c:2716 gtk/gtktextview.c:9088
msgid "Context menu"
msgstr "Контекстне меню"
@@ -2759,7 +2759,7 @@ msgid "Play"
msgstr "Пуск"
#: gtk/gtkmessagedialog.c:162 gtk/gtkmessagedialog.c:180
#: gtk/print/gtkprintbackend.c:639 gtk/gtkwindow.c:6239
#: gtk/print/gtkprintbackend.c:639 gtk/gtkwindow.c:6243
msgid "_OK"
msgstr "_Гаразд"
@@ -3628,7 +3628,7 @@ msgctxt "accessibility"
msgid "Sidebar"
msgstr "Бічна панель"
#: gtk/gtktext.c:6139 gtk/gtktextview.c:9044
#: gtk/gtktext.c:6159 gtk/gtktextview.c:9044
msgid "Insert _Emoji"
msgstr "Вставити _емодзі"
@@ -3640,12 +3640,12 @@ msgstr "_Скасувати"
msgid "_Redo"
msgstr "Пов_торити"
#: gtk/gtkwindow.c:6227
#: gtk/gtkwindow.c:6231
#, c-format
msgid "Do you want to use GTK Inspector?"
msgstr "Бажаєте використовувати інспектор GTK?"
#: gtk/gtkwindow.c:6229
#: gtk/gtkwindow.c:6233
#, c-format
msgid ""
"GTK Inspector is an interactive debugger that lets you explore and modify "
@@ -3656,7 +3656,7 @@ msgstr ""
"редагувати внутрішні частини будь-які програми GTK. Його використання може "
"спричинити збої в програмі."
#: gtk/gtkwindow.c:6234
#: gtk/gtkwindow.c:6238
msgid "Dont show this message again"
msgstr "Не показувати це повідомлення надалі"
@@ -3692,7 +3692,8 @@ msgstr "Роль"
msgid "Description"
msgstr "Опис"
#: gtk/inspector/a11y.ui:99 gtk/inspector/misc-info.ui:297
#: gtk/inspector/a11y.ui:99 gtk/inspector/misc-info.ui:296
#: tools/gtk-path-tool-info.c:128
msgid "Bounds"
msgstr "Межі"
@@ -3992,61 +3993,61 @@ msgstr "Режим запиту"
msgid "Measure map"
msgstr "Мапа вимірювання"
#: gtk/inspector/misc-info.ui:254
#: gtk/inspector/misc-info.ui:253
msgid "Expand"
msgstr "Розгорнути"
#: gtk/inspector/misc-info.ui:322
#: gtk/inspector/misc-info.ui:321
msgid "Baseline"
msgstr "Базова лінія"
#: gtk/inspector/misc-info.ui:347
#: gtk/inspector/misc-info.ui:346
msgid "Surface"
msgstr "Поверхня"
#: gtk/inspector/misc-info.ui:366 gtk/inspector/misc-info.ui:401
#: gtk/inspector/misc-info.ui:436 gtk/inspector/prop-editor.c:1150
#: gtk/inspector/misc-info.ui:365 gtk/inspector/misc-info.ui:400
#: gtk/inspector/misc-info.ui:435 gtk/inspector/prop-editor.c:1150
#: gtk/inspector/prop-editor.c:1533 gtk/inspector/window.ui:396
msgid "Properties"
msgstr "Властивості"
#: gtk/inspector/misc-info.ui:382
#: gtk/inspector/misc-info.ui:381
msgid "Renderer"
msgstr "Відтворювач"
#: gtk/inspector/misc-info.ui:417
#: gtk/inspector/misc-info.ui:416
msgid "Frame Clock"
msgstr "Годинник кадрів"
#: gtk/inspector/misc-info.ui:452
#: gtk/inspector/misc-info.ui:451
msgid "Tick Callback"
msgstr "Позначити зворотний виклик"
#: gtk/inspector/misc-info.ui:478
#: gtk/inspector/misc-info.ui:477
msgid "Frame Count"
msgstr "Підрахунок кадрів"
#: gtk/inspector/misc-info.ui:503
#: gtk/inspector/misc-info.ui:502
msgid "Frame Rate"
msgstr "Частота кадрів"
#: gtk/inspector/misc-info.ui:528
#: gtk/inspector/misc-info.ui:527
msgid "Scale"
msgstr "Масштаб"
#: gtk/inspector/misc-info.ui:553
#: gtk/inspector/misc-info.ui:552
msgid "Mapped"
msgstr "Відображення"
#: gtk/inspector/misc-info.ui:579
#: gtk/inspector/misc-info.ui:578
msgid "Realized"
msgstr "Спостереження"
#: gtk/inspector/misc-info.ui:605
#: gtk/inspector/misc-info.ui:604
msgid "Is Toplevel"
msgstr "На верхньому рівні"
#: gtk/inspector/misc-info.ui:631
#: gtk/inspector/misc-info.ui:630
msgid "Child Visible"
msgstr "Видимі діти"
@@ -4154,7 +4155,7 @@ msgstr "Джерело:"
msgid "Defined At"
msgstr "Визначено в"
#: gtk/inspector/recorder.c:1865
#: gtk/inspector/recorder.c:1922
#, c-format
msgid "Saving RenderNode failed"
msgstr "Не вдалося зберегти RenderNode"
@@ -7201,7 +7202,8 @@ msgstr ""
#: tools/gtk-builder-tool-enumerate.c:56 tools/gtk-builder-tool-preview.c:179
#: tools/gtk-builder-tool-preview.c:180 tools/gtk-builder-tool-screenshot.c:360
#: tools/gtk-builder-tool-simplify.c:2529 tools/gtk-builder-tool-validate.c:261
#: tools/gtk-rendernode-tool-info.c:200 tools/gtk-rendernode-tool-show.c:102
#: tools/gtk-path-tool-render.c:62 tools/gtk-rendernode-tool-info.c:208
#: tools/gtk-rendernode-tool-show.c:102
msgid "FILE"
msgstr "ФАЙЛ"
@@ -7233,8 +7235,8 @@ msgid "Use style from CSS file"
msgstr "Використати стиль з файла CSS"
#: tools/gtk-builder-tool-preview.c:187 tools/gtk-builder-tool-screenshot.c:370
#: tools/gtk-builder-tool-validate.c:268 tools/gtk-rendernode-tool-show.c:109
#: tools/gtk-rendernode-tool-render.c:204
#: tools/gtk-builder-tool-validate.c:268 tools/gtk-rendernode-tool-render.c:204
#: tools/gtk-rendernode-tool-show.c:109
#, c-format
msgid "Could not initialize windowing system\n"
msgstr "Не вдалося ініціалізувати систему вікон\n"
@@ -7463,6 +7465,243 @@ msgstr "%s: нема такої програми %s"
msgid "%s: error launching application: %s\n"
msgstr "%s: помилка запускання програми: %s\n"
#: tools/gtk-path-tool.c:35
#, c-format
msgid ""
"Usage:\n"
" gtk4-path-tool [COMMAND] [OPTION…] PATH\n"
"\n"
"Perform various tasks on paths.\n"
"\n"
"Commands:\n"
" decompose Decompose the path\n"
" show Display the path in a window\n"
" render Render the path as an image\n"
" info Print information about the path\n"
"\n"
msgstr ""
"Користування:\n"
" gtk4-path-tool [КОМАНДА] [ПАРАМЕТР…] КОНТУР\n"
"\n"
"Виконати різноманітні завдання щодо контурів.\n"
"\n"
"Команди:\n"
" decompose розкласти контур на частини\n"
" show показати контур у вікні\n"
" render обробити контур до зображення\n"
" info вивести відомості щодо контура\n"
"\n"
#: tools/gtk-path-tool-decompose.c:75
msgid "Allow quadratic Bézier curves"
msgstr "Дозволити квадратичні криві Безьє"
#: tools/gtk-path-tool-decompose.c:76
msgid "Allow cubic Bézier curves"
msgstr "Дозволити кубічні криві Безьє"
#: tools/gtk-path-tool-decompose.c:77 tools/gtk-path-tool-info.c:88
#: tools/gtk-path-tool-render.c:63 tools/gtk-path-tool-show.c:132
msgid "PATH"
msgstr "КОНТУР"
#: tools/gtk-path-tool-decompose.c:89
msgid "Decompose a path."
msgstr "Розкласти шлях."
#: tools/gtk-path-tool-decompose.c:102 tools/gtk-path-tool-info.c:112
msgid "No paths given."
msgstr "Не задано контурів."
#: tools/gtk-path-tool-decompose.c:128
msgid "That didn't work out."
msgstr "Не спрацювало."
#: tools/gtk-path-tool-info.c:99
msgid "Print information about a path."
msgstr "Вивести відомості щодо контура."
#: tools/gtk-path-tool-info.c:119
msgid "Path is empty."
msgstr "Порожній шлях."
#: tools/gtk-path-tool-info.c:125
msgid "Path is closed"
msgstr "Контур замкнено"
#: tools/gtk-path-tool-info.c:134
#, c-format
msgid "%d contours"
msgstr "%d контурів"
#: tools/gtk-path-tool-info.c:136
#, c-format
#| msgid "Fractions"
msgid "%d operations"
msgstr "%d дій"
#: tools/gtk-path-tool-info.c:140
#, c-format
#| msgctxt "Script"
#| msgid "Balinese"
msgid "%d lines"
msgstr "%d ліній"
#: tools/gtk-path-tool-info.c:145
#, c-format
msgid "%d quadratics"
msgstr "%d квадратних апроксимацій"
#: tools/gtk-path-tool-info.c:150
#, c-format
msgid "%d cubics"
msgstr "%d кубічних апроксимацій"
#: tools/gtk-path-tool-render.c:52 tools/gtk-path-tool-show.c:122
msgid "Fill rule (winding, even-odd)"
msgstr "Правило заповнення (віконне, парне-непарне)"
#: tools/gtk-path-tool-render.c:52 tools/gtk-path-tool-render.c:56
#: tools/gtk-path-tool-render.c:57 tools/gtk-path-tool-render.c:58
#: tools/gtk-path-tool-render.c:59 tools/gtk-path-tool-render.c:60
#: tools/gtk-path-tool-render.c:61 tools/gtk-path-tool-show.c:122
#: tools/gtk-path-tool-show.c:126 tools/gtk-path-tool-show.c:127
#: tools/gtk-path-tool-show.c:128 tools/gtk-path-tool-show.c:129
#: tools/gtk-path-tool-show.c:130 tools/gtk-path-tool-show.c:131
msgid "VALUE"
msgstr "ЗНАЧЕННЯ"
#: tools/gtk-path-tool-render.c:53 tools/gtk-path-tool-show.c:123
msgid "Foreground color"
msgstr "Колір переднього плану"
#: tools/gtk-path-tool-render.c:53 tools/gtk-path-tool-render.c:54
#: tools/gtk-path-tool-show.c:123 tools/gtk-path-tool-show.c:124
msgid "COLOR"
msgstr "КОЛІР"
#: tools/gtk-path-tool-render.c:54 tools/gtk-path-tool-show.c:124
msgid "Background color"
msgstr "Колір тла"
#: tools/gtk-path-tool-render.c:55 tools/gtk-path-tool-show.c:125
msgid "Stroke the path instead of filling it"
msgstr "Заштрихувати контур, а не заповнювати його"
#: tools/gtk-path-tool-render.c:56 tools/gtk-path-tool-show.c:126
msgid "Line width (number)"
msgstr "Товщина лінії (число)"
#: tools/gtk-path-tool-render.c:57 tools/gtk-path-tool-show.c:127
msgid "Line cap (butt, round, square)"
msgstr "Кінець лінії (торець, заокруглення, квадрат)"
#: tools/gtk-path-tool-render.c:58 tools/gtk-path-tool-show.c:128
msgid "Line join (miter, miter-clip, round, bevel, arcs)"
msgstr ""
"З'єднання лінії (під кутом, під кутом з обрізанням, заокруглення, "
"загострення, дуги)"
#: tools/gtk-path-tool-render.c:59 tools/gtk-path-tool-show.c:129
msgid "Miter limit (number)"
msgstr "Обмеження зрізу (число)"
#: tools/gtk-path-tool-render.c:60 tools/gtk-path-tool-show.c:130
msgid "Dash pattern (comma-separated numbers)"
msgstr "Взірець штриха (числа, які відокремлено комами)"
#: tools/gtk-path-tool-render.c:61 tools/gtk-path-tool-show.c:131
msgid "Dash offset (number)"
msgstr "Відступ штриха (число)"
#: tools/gtk-path-tool-render.c:62
msgid "The output file"
msgstr "Файл результатів"
#: tools/gtk-path-tool-render.c:81 tools/gtk-path-tool-show.c:145
msgid "Could not initialize windowing system"
msgstr "Не вдалося ініціалізувати систему вікон"
#: tools/gtk-path-tool-render.c:89
msgid "Render the path to a png image."
msgstr "Обробити контур до зображення png."
#: tools/gtk-path-tool-render.c:102 tools/gtk-path-tool-show.c:166
msgid "No path specified"
msgstr "Не вказано контур"
#: tools/gtk-path-tool-render.c:108
msgid "Can only render a single path"
msgstr "Можлива обробка для показу лише одного контура"
#: tools/gtk-path-tool-render.c:114 tools/gtk-path-tool-show.c:178
msgid "fill rule"
msgstr "правило заповнення"
#: tools/gtk-path-tool-render.c:118 tools/gtk-path-tool-show.c:182
msgid "line cap"
msgstr "кінчик лінії"
#: tools/gtk-path-tool-render.c:119 tools/gtk-path-tool-show.c:183
msgid "line join"
msgstr "об'єднання рядків"
#: tools/gtk-path-tool-render.c:143 tools/gtk-path-tool-show.c:207
#, c-format
msgid "Failed to parse '%s' as number"
msgstr "Не вдалося обробити «%s» як число"
#: tools/gtk-path-tool-render.c:187
#, c-format
msgid "Saving png to '%s' failed"
msgstr "Не вдалося зберегти png до «%s»"
#: tools/gtk-path-tool-render.c:194
#, c-format
msgid "Output written to '%s'."
msgstr "Результати записано до «%s»."
#: tools/gtk-path-tool-show.c:43 tools/gtk-path-tool-show.c:78
msgid "Path Preview"
msgstr "Перегляд контура"
#: tools/gtk-path-tool-show.c:153
msgid "Display the path."
msgstr "Показати контур."
#: tools/gtk-path-tool-show.c:172
msgid "Can only show a single path"
msgstr "Можливий показ лише одного контура"
#: tools/gtk-path-tool-utils.c:58
#, c-format
msgid "Failed to read from standard input: %s\n"
msgstr "Не вдалося прочитати дані зі стандартного джерела даних: %s\n"
#: tools/gtk-path-tool-utils.c:64
#, c-format
msgid "Error reading from standard input: %s\n"
msgstr "Помилка під час спроби читання зі стандартного джерела даних: %s\n"
#: tools/gtk-path-tool-utils.c:83
#, c-format
msgid "Failed to parse '%s' as path.\n"
msgstr "Не вдалося обробити «%s» як контур.\n"
#: tools/gtk-path-tool-utils.c:109
#, c-format
msgid "Failed to parse '%s' as %s."
msgstr "Не вдалося обробити «%s» як %s."
#: tools/gtk-path-tool-utils.c:111
msgid "Possible values: "
msgstr "Можливі значення:"
#: tools/gtk-path-tool-utils.c:135
#, c-format
msgid "Could not parse '%s' as color"
msgstr "Не вдалося обробити «%s» як колір"
#: tools/gtk-rendernode-tool.c:35
#, c-format
msgid ""
@@ -7488,50 +7727,41 @@ msgstr ""
" render Створити знімок вікна вузла\n"
"\n"
#: tools/gtk-rendernode-tool-info.c:177
#: tools/gtk-rendernode-tool-info.c:185
#, c-format
msgid "Number of nodes: %u\n"
msgstr "Кількість вузлів: %u\n"
#: tools/gtk-rendernode-tool-info.c:184
#: tools/gtk-rendernode-tool-info.c:192
#, c-format
msgid "Depth: %u\n"
msgstr "Глибина: %u\n"
#: tools/gtk-rendernode-tool-info.c:187
#: tools/gtk-rendernode-tool-info.c:195
#, c-format
msgid "Bounds: %g x %g\n"
msgstr "Межі: %g x %g\n"
#: tools/gtk-rendernode-tool-info.c:188
#: tools/gtk-rendernode-tool-info.c:196
#, c-format
msgid "Origin: %g %g\n"
msgstr "Початок координат: %g %g\n"
#: tools/gtk-rendernode-tool-info.c:209
#: tools/gtk-rendernode-tool-info.c:217
msgid "Provide information about the render node."
msgstr "Надати дані щодо вузла обробки."
#: tools/gtk-rendernode-tool-info.c:222 tools/gtk-rendernode-tool-show.c:130
#: tools/gtk-rendernode-tool-render.c:225
#: tools/gtk-rendernode-tool-info.c:230 tools/gtk-rendernode-tool-render.c:225
#: tools/gtk-rendernode-tool-show.c:130
#, c-format
msgid "No .node file specified\n"
msgstr "Не вказано файл .node\n"
#: tools/gtk-rendernode-tool-info.c:228
#: tools/gtk-rendernode-tool-info.c:236
#, c-format
msgid "Can only accept a single .node file\n"
msgstr "Можлива одночасна обробка лише одного файла .node\n"
#: tools/gtk-rendernode-tool-show.c:117
msgid "Show the render node."
msgstr "Показати вузол обробки."
#: tools/gtk-rendernode-tool-show.c:136
#, c-format
msgid "Can only preview a single .node file\n"
msgstr "Можливий попередній перегляд лише одного файла .node\n"
#: tools/gtk-rendernode-tool-render.c:123
#, c-format
msgid ""
@@ -7543,7 +7773,6 @@ msgstr ""
#: tools/gtk-rendernode-tool-render.c:137
#, c-format
#| msgid "Failed to save %s: %s\n"
msgid "Failed to generate SVG: %s\n"
msgstr "Не вдалося створити SVG: %s\n"
@@ -7566,6 +7795,15 @@ msgstr ""
"Одночасно можливе створення лише одного знімка вікна файла .node і виведення "
"даних лише до одного файла\n"
#: tools/gtk-rendernode-tool-show.c:117
msgid "Show the render node."
msgstr "Показати вузол обробки."
#: tools/gtk-rendernode-tool-show.c:136
#, c-format
msgid "Can only preview a single .node file\n"
msgstr "Можливий попередній перегляд лише одного файла .node\n"
#: tools/gtk-rendernode-tool-utils.c:51
#, c-format
msgid "Error at %s: %s\n"
@@ -8074,10 +8312,6 @@ msgstr ""
#~ msgid "Unknown"
#~ msgstr "невідома"
#~ msgctxt "Script"
#~ msgid "Balinese"
#~ msgstr "балійська"
#~ msgctxt "Script"
#~ msgid "Cuneiform"
#~ msgstr "клинопис"
@@ -8460,10 +8694,6 @@ msgstr ""
#~ msgid "Can't parse “%s”\n"
#~ msgstr "Не вдалося обробити «%s»\n"
#~| msgid "Failed to write header\n"
#~ msgid "Failed to parse png image"
#~ msgstr "Не вдалося обробити дані зображення png"
#~ msgid "Sandbox does not provide an OpenGL implementation"
#~ msgstr "Пісочниця не надає реалізації OpenGL"
+18
View File
@@ -145,6 +145,23 @@ test_curve_crossing (void)
}
}
static void
test_curve_length (void)
{
GskCurve c, c1, c2;
float l, l1, l2;
parse_curve (&c, "M 1462.632080 -1593.118896 C 751.533630 -74.179169 -914.280090 956.537720 -83.091866 207.213776");
gsk_curve_split (&c, 0.5, &c1, &c2);
l = gsk_curve_get_length (&c);
l1 = gsk_curve_get_length (&c1);
l2 = gsk_curve_get_length (&c2);
g_assert_cmpfloat_with_epsilon (l, l1 + l2, 0.01);
}
int
main (int argc,
char *argv[])
@@ -154,6 +171,7 @@ main (int argc,
g_test_add_func ("/curve/special/tangents", test_curve_tangents);
g_test_add_func ("/curve/special/degenerate-tangents", test_curve_degenerate_tangents);
g_test_add_func ("/curve/special/crossing", test_curve_crossing);
g_test_add_func ("/curve/special/length", test_curve_length);
return g_test_run ();
}
+246 -6
View File
@@ -423,33 +423,269 @@ test_foreach (void)
}
/* Test the basics of the path point api */
typedef struct _GskRealPathPoint GskRealPathPoint;
struct _GskRealPathPoint
{
gsize contour;
gsize idx;
float t;
};
static void
test_path_point (void)
{
GskPath *path;
GskPathPoint point;
GskRealPathPoint *rp = (GskRealPathPoint *)&point;
gboolean ret;
graphene_point_t pos, center;
graphene_vec2_t t1, t2, mx;
float curvature;
path = gsk_path_parse ("M0,0L100,0L100,100L0,100Z");
path = gsk_path_parse ("M 0 0 L 100 0 L 100 100 L 0 100 Z");
ret = gsk_path_get_start_point (path, &point);
g_assert_true (ret);
g_assert_true (rp->contour == 0);
g_assert_true (rp->idx == 1);
g_assert_true (rp->t == 0);
ret = gsk_path_get_end_point (path, &point);
g_assert_true (ret);
g_assert_true (rp->contour == 0);
g_assert_true (rp->idx == 4);
g_assert_true (rp->t == 1);
ret = gsk_path_get_closest_point (path, &GRAPHENE_POINT_INIT (200, 200), INFINITY, &point);
g_assert_true (ret);
gsk_path_point_get_position (path, &point, &pos);
gsk_path_point_get_tangent (path, &point, GSK_PATH_START, &t1);
gsk_path_point_get_tangent (path, &point, GSK_PATH_END, &t2);
curvature = gsk_path_point_get_curvature (path, &point, &center);
g_assert_true (rp->contour == 0);
g_assert_true (rp->idx == 2);
g_assert_true (rp->t == 1);
gsk_path_point_get_position (&point, path, &pos);
gsk_path_point_get_tangent (&point, path, GSK_PATH_FROM_START, &t1);
gsk_path_point_get_tangent (&point, path, GSK_PATH_TO_END, &t2);
curvature = gsk_path_point_get_curvature (&point, path, &center);
g_print ("%g %g\n", graphene_vec2_get_x (&t1), graphene_vec2_get_y (&t1));
g_assert_true (graphene_point_equal (&pos, &GRAPHENE_POINT_INIT (100, 100)));
g_assert_true (graphene_vec2_equal (&t1, graphene_vec2_y_axis ()));
graphene_vec2_negate (graphene_vec2_x_axis (), &mx);
g_assert_true (graphene_vec2_equal (&t2, &mx));
g_assert_true (curvature == 0);
ret = gsk_path_get_closest_point (path, &GRAPHENE_POINT_INIT (100, 50), INFINITY, &point);
g_assert_true (ret);
g_assert_true (rp->contour == 0);
g_assert_true (rp->idx == 2);
g_assert_true (rp->t == 0.5);
gsk_path_unref (path);
}
/* Test that gsk_path_builder_add_segment yields the expected results */
static void
test_path_segments (void)
{
struct {
const char *path;
graphene_point_t p1;
graphene_point_t p2;
const char *result;
} tests[] = {
{
"M 0 0 L 100 0 L 50 50 Z",
{ 100, 0 },
{ 50, 50 },
"M 100 0 L 50 50"
},
{
"M 0 0 L 100 0 L 50 50 Z",
{ 50, 0 },
{ 70, 0 },
"M 50 0 L 70 0"
},
{
"M 0 0 L 100 0 L 50 50 Z",
{ 70, 0 },
{ 50, 0 },
"M 70 0 L 100 0 L 50 50 L 0 0 L 50 0"
},
{
"M 0 0 L 100 0 L 50 50 Z",
{ 50, 0 },
{ 50, 50 },
"M 50 0 L 100 0 L 50 50"
},
{
"M 0 0 L 100 0 L 50 50 Z",
{ 100, 0 },
{ 100, 0 },
"M 100 0 L 50 50 L 0 0 L 100 0"
}
};
for (unsigned int i = 0; i < G_N_ELEMENTS (tests); i++)
{
GskPath *path;
GskPathPoint p1, p2;
GskPathBuilder *builder;
GskPath *result;
char *str;
path = gsk_path_parse (tests[i].path);
g_assert_true (gsk_path_get_closest_point (path, &tests[i].p1, INFINITY, &p1));
g_assert_true (gsk_path_get_closest_point (path, &tests[i].p2, INFINITY, &p2));
builder = gsk_path_builder_new ();
gsk_path_builder_add_segment (builder, path, &p1, &p2);
result = gsk_path_builder_free_to_path (builder);
str = gsk_path_to_string (result);
g_assert_cmpstr (str, ==, tests[i].result);
g_free (str);
gsk_path_unref (path);
}
}
static void
test_bad_in_fill (void)
{
GskPath *path;
gboolean inside;
/* A fat Cantarell W */
path = gsk_path_parse ("M -2 694 M 206.1748046875 704 L 390.9371337890625 704 L 551.1888427734375 99.5035400390625 L 473.0489501953125 99.5035400390625 L 649.1048583984375 704 L 828.965087890625 704 L 1028.3077392578125 10 L 857.8111572265625 10 L 710.0489501953125 621.251708984375 L 775.9720458984375 598.426513671875 L 614.5245361328125 14.0489501953125 L 430.2237548828125 14.0489501953125 L 278.6783447265625 602.230712890625 L 330.0909423828125 602.230712890625 L 195.88818359375 10 L 5.7342529296875 10 L 206.1748046875 704 Z");
/* The midpoint of the right foot of a fat Cantarell X */
inside = gsk_path_in_fill (path, &GRAPHENE_POINT_INIT (552.360107, 704.000000), GSK_FILL_RULE_WINDING);
g_assert_false (inside);
gsk_path_unref (path);
}
/* Test that path_in_fill implicitly closes contours. I think this is wrong,
* but it is what "everybody" does.
*/
static void
test_unclosed_in_fill (void)
{
GskPath *path;
path = gsk_path_parse ("M 0 0 L 0 100 L 100 100 L 100 0 Z");
g_assert_true (gsk_path_in_fill (path, &GRAPHENE_POINT_INIT (50, 50), GSK_FILL_RULE_WINDING));
gsk_path_unref (path);
path = gsk_path_parse ("M 0 0 L 0 100 L 100 100 L 100 0");
g_assert_true (gsk_path_in_fill (path, &GRAPHENE_POINT_INIT (50, 50), GSK_FILL_RULE_WINDING));
gsk_path_unref (path);
}
/* Test that all the gsk_path_builder_add methods close the current
* contour in the end and do not change the current point.
*/
static void
test_path_builder_add (void)
{
GskPathBuilder *builder;
GskPath *path, *path2;
char *s;
cairo_path_t *cpath;
cairo_surface_t *surface;
cairo_t *cr;
PangoLayout *layout;
GskPathPoint point1, point2;
#define N_ADD_METHODS 8
path = gsk_path_parse ("M 10 10 L 100 100");
gsk_path_get_closest_point (path, &GRAPHENE_POINT_INIT (50, 50), INFINITY, &point1);
gsk_path_get_end_point (path, &point2);
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 100, 100);
cr = cairo_create (surface);
cairo_move_to (cr, 10, 10);
cairo_line_to (cr, 20, 30);
cpath = cairo_copy_path (cr);
layout = pango_cairo_create_layout (cr);
pango_layout_set_text (layout, "ABC", -1);
for (unsigned int i = 0; i < N_ADD_METHODS; i++)
{
builder = gsk_path_builder_new ();
gsk_path_builder_move_to (builder, 123, 456);
switch (i)
{
case 0:
gsk_path_builder_add_path (builder, path);
break;
case 1:
gsk_path_builder_add_reverse_path (builder, path);
break;
case 2:
gsk_path_builder_add_segment (builder, path, &point1, &point2);
break;
case 3:
gsk_path_builder_add_cairo_path (builder, cpath);
break;
case 4:
gsk_path_builder_add_layout (builder, layout);
break;
case 5:
gsk_path_builder_add_rect (builder, &GRAPHENE_RECT_INIT (0, 0, 10, 10));
break;
case 6:
{
GskRoundedRect rect;
gsk_rounded_rect_init (&rect,
&GRAPHENE_RECT_INIT (0, 0, 100, 100),
&GRAPHENE_SIZE_INIT (10, 20),
&GRAPHENE_SIZE_INIT (20, 30),
&GRAPHENE_SIZE_INIT (0, 0),
&GRAPHENE_SIZE_INIT (10, 10));
gsk_path_builder_add_rounded_rect (builder, &rect);
}
break;
case 7:
gsk_path_builder_add_circle (builder, &GRAPHENE_POINT_INIT (0, 0), 10);
break;
default:
g_assert_not_reached ();
}
gsk_path_builder_rel_line_to (builder, 10, 0);
path2 = gsk_path_builder_free_to_path (builder);
s = gsk_path_to_string (path2);
g_assert_true (g_str_has_prefix (s, "M 123 456"));
g_assert_true (g_str_has_suffix (s, "M 123 456 L 133 456"));
g_free (s);
gsk_path_unref (path2);
}
g_object_unref (layout);
cairo_path_destroy (cpath);
cairo_destroy (cr);
cairo_surface_destroy (surface);
gsk_path_unref (path);
}
@@ -463,6 +699,10 @@ main (int argc, char *argv[])
g_test_add_func ("/path/rect", test_rect_path);
g_test_add_func ("/path/foreach", test_foreach);
g_test_add_func ("/path/point", test_path_point);
g_test_add_func ("/path/segments", test_path_segments);
g_test_add_func ("/path/bad-in-fill", test_bad_in_fill);
g_test_add_func ("/path/unclosed-in-fill", test_unclosed_in_fill);
g_test_add_func ("/path/builder/add", test_path_builder_add);
return g_test_run ();
}
+229
View File
@@ -582,6 +582,232 @@ test_parse (void)
}
}
#define N_PATHS 3
static void
test_in_fill_union (void)
{
GskPath *path, *paths[N_PATHS];
GskPathBuilder *builder;
guint i, j, k;
for (i = 0; i < 100; i++)
{
builder = gsk_path_builder_new ();
for (k = 0; k < N_PATHS; k++)
{
paths[k] = create_random_path (G_MAXUINT);
gsk_path_builder_add_path (builder, paths[k]);
}
path = gsk_path_builder_free_to_path (builder);
for (j = 0; j < 100; j++)
{
graphene_point_t test = GRAPHENE_POINT_INIT (g_test_rand_double_range (-1000, 1000),
g_test_rand_double_range (-1000, 1000));
GskFillRule fill_rule;
for (fill_rule = GSK_FILL_RULE_WINDING; fill_rule <= GSK_FILL_RULE_EVEN_ODD; fill_rule++)
{
guint n_in_fill = 0;
gboolean in_fill;
for (k = 0; k < N_PATHS; k++)
{
if (gsk_path_in_fill (paths[k], &test, GSK_FILL_RULE_EVEN_ODD))
n_in_fill++;
}
in_fill = gsk_path_in_fill (path, &test, GSK_FILL_RULE_EVEN_ODD);
switch (fill_rule)
{
case GSK_FILL_RULE_WINDING:
if (n_in_fill == 0)
g_assert_false (in_fill);
else if (n_in_fill == 1)
g_assert_true (in_fill);
/* else we can't say anything because the winding rule doesn't give enough info */
break;
case GSK_FILL_RULE_EVEN_ODD:
g_assert_cmpint (in_fill, ==, n_in_fill & 1);
break;
default:
g_assert_not_reached ();
break;
}
}
}
gsk_path_unref (path);
for (k = 0; k < N_PATHS; k++)
gsk_path_unref (paths[k]);
}
}
#undef N_PATHS
/* This is somewhat sucky because using foreach breaks up the contours
* (like rects and circles) and replaces everything with the standard
* contour.
* But at least it extensively tests the standard contour.
*/
static gboolean
rotate_path_cb (GskPathOperation op,
const graphene_point_t *pts,
gsize n_pts,
gpointer user_data)
{
GskPathBuilder **builders = user_data;
switch (op)
{
case GSK_PATH_MOVE:
gsk_path_builder_move_to (builders[0], pts[0].x, pts[0].y);
gsk_path_builder_move_to (builders[1], pts[0].y, -pts[0].x);
break;
case GSK_PATH_CLOSE:
gsk_path_builder_close (builders[0]);
gsk_path_builder_close (builders[1]);
break;
case GSK_PATH_LINE:
gsk_path_builder_line_to (builders[0], pts[1].x, pts[1].y);
gsk_path_builder_line_to (builders[1], pts[1].y, -pts[1].x);
break;
case GSK_PATH_QUAD:
gsk_path_builder_quad_to (builders[0], pts[1].x, pts[1].y, pts[2].x, pts[2].y);
gsk_path_builder_quad_to (builders[1], pts[1].y, -pts[1].x, pts[2].y, -pts[2].x);
break;
case GSK_PATH_CUBIC:
gsk_path_builder_cubic_to (builders[0], pts[1].x, pts[1].y, pts[2].x, pts[2].y, pts[3].x, pts[3].y);
gsk_path_builder_cubic_to (builders[1], pts[1].y, -pts[1].x, pts[2].y, -pts[2].x, pts[3].y, -pts[3].x);
break;
default:
g_assert_not_reached ();
return FALSE;
}
return TRUE;
}
static void
test_in_fill_rotated (void)
{
GskPath *path;
GskPathBuilder *builders[2];
GskPath *paths[2];
guint i, j;
#define N_FILL_RULES 2
/* if this triggers, you added a new enum value to GskFillRule, so the define above needs
* an update */
g_assert_null (g_enum_get_value (g_type_class_ref (GSK_TYPE_FILL_RULE), N_FILL_RULES));
for (i = 0; i < 100; i++)
{
path = create_random_path (G_MAXUINT);
builders[0] = gsk_path_builder_new ();
builders[1] = gsk_path_builder_new ();
/* Use -1 here because we want all the flags, even future additions */
gsk_path_foreach (path, -1, rotate_path_cb, builders);
gsk_path_unref (path);
paths[0] = gsk_path_builder_free_to_path (builders[0]);
paths[1] = gsk_path_builder_free_to_path (builders[1]);
for (j = 0; j < 100; j++)
{
GskFillRule fill_rule = g_random_int_range (0, N_FILL_RULES);
float x = g_test_rand_double_range (-1000, 1000);
float y = g_test_rand_double_range (-1000, 1000);
g_assert_cmpint (gsk_path_in_fill (paths[0], &GRAPHENE_POINT_INIT (x, y), fill_rule),
==,
gsk_path_in_fill (paths[1], &GRAPHENE_POINT_INIT (y, -x), fill_rule));
g_assert_cmpint (gsk_path_in_fill (paths[0], &GRAPHENE_POINT_INIT (y, x), fill_rule),
==,
gsk_path_in_fill (paths[1], &GRAPHENE_POINT_INIT (x, -y), fill_rule));
}
gsk_path_unref (paths[0]);
gsk_path_unref (paths[1]);
}
#undef N_FILL_RULES
}
static void
test_segment (void)
{
GskPath *path, *path1, *path2, *path3;
GskPathBuilder *builder;
guint i;
float split1, split2, epsilon, length;
GskPathPoint point0, point1, point2, point3;
if (!g_test_slow ())
{
g_test_skip ("Skipping slow test");
return;
}
for (i = 0; i < 50000; i++)
{
path = create_random_path (G_MAXUINT);
length = gsk_path_get_length (path);
/* chosen high enough to stop the testsuite from failing */
epsilon = MAX (length / 64, 1.f / 1024);
split1 = g_test_rand_double_range (0, length);
split2 = g_test_rand_double_range (split1, length);
if (!gsk_path_get_start_point (path, &point0) ||
!gsk_path_get_point (path, split1, &point1) ||
!gsk_path_get_point (path, split2, &point2) ||
!gsk_path_get_end_point (path, &point3))
{
gsk_path_unref (path);
continue;
}
if (gsk_path_point_equal (&point0, &point1) ||
gsk_path_point_equal (&point1, &point2) ||
gsk_path_point_equal (&point2, &point3))
{
gsk_path_unref (path);
continue;
}
builder = gsk_path_builder_new ();
gsk_path_builder_add_segment (builder, path, &point0, &point1);
path1 = gsk_path_builder_free_to_path (builder);
builder = gsk_path_builder_new ();
gsk_path_builder_add_segment (builder, path, &point1, &point2);
path2 = gsk_path_builder_free_to_path (builder);
builder = gsk_path_builder_new ();
gsk_path_builder_add_segment (builder, path, &point2, &point3);
path3 = gsk_path_builder_free_to_path (builder);
g_assert_cmpfloat_with_epsilon (split1, gsk_path_get_length (path1), epsilon);
g_assert_cmpfloat_with_epsilon (split2 - split1, gsk_path_get_length (path2), epsilon);
g_assert_cmpfloat_with_epsilon (length - split2, gsk_path_get_length (path3), epsilon);
gsk_path_unref (path3);
gsk_path_unref (path2);
gsk_path_unref (path1);
gsk_path_unref (path);
}
}
int
main (int argc,
char *argv[])
@@ -590,6 +816,9 @@ main (int argc,
g_test_add_func ("/path/create", test_create);
g_test_add_func ("/path/parse", test_parse);
g_test_add_func ("/path/in-fill-union", test_in_fill_union);
g_test_add_func ("/path/in-fill-rotated", test_in_fill_rotated);
g_test_add_func ("/path/segment", test_segment);
return g_test_run ();
}
+1 -1
View File
@@ -10,7 +10,7 @@ test_calendar_set_day (void)
cal = gtk_calendar_new ();
tz = g_time_zone_new_identifier ("MET");
tz = g_time_zone_new_identifier ("Europe/Brussels");
g_assert_nonnull (tz);
dt = g_date_time_new (tz, 1970, 3, 1, 0, 0, 0);
g_assert_nonnull (dt);
+131
View File
@@ -0,0 +1,131 @@
/* Copyright 2023 Red Hat, Inc.
*
* GTK+ is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* GLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with GTK+; see the file COPYING. If not,
* see <http://www.gnu.org/licenses/>.
*
* Author: Matthias Clasen
*/
#include "config.h"
#include <gtk/gtk.h>
#include "gtk-path-tool.h"
#include <glib/gi18n-lib.h>
static gboolean
foreach_cb (GskPathOperation op,
const graphene_point_t *pts,
gsize n_pts,
gpointer user_data)
{
GskPathBuilder *builder = user_data;
switch (op)
{
case GSK_PATH_MOVE:
gsk_path_builder_move_to (builder, pts[0].x, pts[0].y);
break;
case GSK_PATH_CLOSE:
gsk_path_builder_close (builder);
break;
case GSK_PATH_LINE:
gsk_path_builder_line_to (builder, pts[1].x, pts[1].y);
break;
case GSK_PATH_QUAD:
gsk_path_builder_quad_to (builder, pts[1].x, pts[1].y, pts[2].x, pts[2].y);
break;
case GSK_PATH_CUBIC:
gsk_path_builder_cubic_to (builder, pts[1].x, pts[1].y,
pts[2].x, pts[2].y,
pts[3].x, pts[3].y);
break;
default:
g_assert_not_reached ();
}
return TRUE;
}
void
do_decompose (int *argc, const char ***argv)
{
GError *error = NULL;
gboolean allow_quad = FALSE;
gboolean allow_curve = FALSE;
char **args = NULL;
GOptionContext *context;
GOptionEntry entries[] = {
{ "allow-quad", 0, 0, G_OPTION_ARG_NONE, &allow_quad, N_("Allow quadratic Bézier curves"), NULL },
{ "allow-cubic", 0, 0, G_OPTION_ARG_NONE, &allow_curve, N_("Allow cubic Bézier curves"), NULL },
{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &args, NULL, N_("PATH") },
{ NULL, },
};
GskPathForeachFlags flags;
GskPath *path, *result;
GskPathBuilder *builder;
g_set_prgname ("gtk4-path-tool decompose");
context = g_option_context_new (NULL);
g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
g_option_context_add_main_entries (context, entries, NULL);
g_option_context_set_summary (context, _("Decompose a path."));
if (!g_option_context_parse (context, argc, (char ***)argv, &error))
{
g_printerr ("%s\n", error->message);
g_error_free (error);
exit (1);
}
g_option_context_free (context);
if (args == NULL)
{
g_printerr ("%s\n", _("No paths given."));
exit (1);
}
path = get_path (args[0]);
flags = 0;
if (allow_quad)
flags |= GSK_PATH_FOREACH_ALLOW_QUAD;
if (allow_curve)
flags |= GSK_PATH_FOREACH_ALLOW_CUBIC;
builder = gsk_path_builder_new ();
gsk_path_foreach (path, flags, foreach_cb, builder);
result = gsk_path_builder_free_to_path (builder);
if (result)
{
char *str = gsk_path_to_string (result);
g_print ("%s\n", str);
g_free (str);
}
else
{
g_printerr ("%s\n", _("That didn't work out."));
exit (1);
}
}
+154
View File
@@ -0,0 +1,154 @@
/* Copyright 2023 Red Hat, Inc.
*
* GTK+ is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* GLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with GTK+; see the file COPYING. If not,
* see <http://www.gnu.org/licenses/>.
*
* Author: Matthias Clasen
*/
#include "config.h"
#include <gtk/gtk.h>
#include "gtk-path-tool.h"
#include <glib/gi18n-lib.h>
typedef struct
{
int contours;
int ops;
int lines;
int quads;
int cubics;
} Statistics;
static gboolean
stats_cb (GskPathOperation op,
const graphene_point_t *pts,
gsize n_pts,
gpointer user_data)
{
Statistics *stats = user_data;
stats->ops++;
switch (op)
{
case GSK_PATH_MOVE:
stats->contours++;
break;
case GSK_PATH_CLOSE:
case GSK_PATH_LINE:
stats->lines++;
break;
case GSK_PATH_QUAD:
stats->quads++;
break;
case GSK_PATH_CUBIC:
stats->cubics++;
break;
default:
g_assert_not_reached ();
}
return TRUE;
}
static void
collect_statistics (GskPath *path,
Statistics *stats)
{
stats->contours = 0;
stats->ops = 0;
stats->lines = 0;
stats->quads = 0;
stats->cubics = 0;
gsk_path_foreach (path, -1, stats_cb, stats);
}
void
do_info (int *argc, const char ***argv)
{
GError *error = NULL;
char **args = NULL;
GOptionContext *context;
GOptionEntry entries[] = {
{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &args, NULL, N_("PATH") },
{ NULL, },
};
GskPath *path;
graphene_rect_t bounds;
g_set_prgname ("gtk4-path-tool info");
context = g_option_context_new (NULL);
g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
g_option_context_add_main_entries (context, entries, NULL);
g_option_context_set_summary (context, _("Print information about a path."));
if (!g_option_context_parse (context, argc, (char ***)argv, &error))
{
g_printerr ("%s\n", error->message);
g_error_free (error);
exit (1);
}
g_option_context_free (context);
if (args == NULL)
{
g_printerr ("%s\n", _("No paths given."));
exit (1);
}
path = get_path (args[0]);
if (gsk_path_is_empty (path))
g_print ("%s\n", _("Path is empty."));
else
{
Statistics stats;
if (gsk_path_is_closed (path))
g_print ("%s\n", _("Path is closed"));
if (gsk_path_get_bounds (path, &bounds))
g_print ("%s: %g %g %g %g\n", _("Bounds"),
bounds.origin.x, bounds.origin.y,
bounds.size.width, bounds.size.height);
collect_statistics (path, &stats);
g_print (_("%d contours"), stats.contours);
g_print ("\n");
g_print (_("%d operations"), stats.ops);
g_print ("\n");
if (stats.lines)
{
g_print (_("%d lines"), stats.lines);
g_print ("\n");
}
if (stats.quads)
{
g_print (_("%d quadratics"), stats.quads);
g_print ("\n");
}
if (stats.cubics)
{
g_print (_("%d cubics"), stats.cubics);
g_print ("\n");
}
}
}
+208
View File
@@ -0,0 +1,208 @@
/* Copyright 2023 Red Hat, Inc.
*
* GTK+ is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* GLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with GTK+; see the file COPYING. If not,
* see <http://www.gnu.org/licenses/>.
*
* Author: Matthias Clasen
*/
#include "config.h"
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <glib/gi18n-lib.h>
#include <glib/gprintf.h>
#include <glib/gstdio.h>
#include <gtk/gtk.h>
#include "gtk-path-tool.h"
void
do_render (int *argc,
const char ***argv)
{
GError *error = NULL;
const char *fill = "winding";
const char *fg_color = "black";
const char *bg_color = "white";
gboolean do_stroke = FALSE;
double line_width = 1;
const char *cap = "butt";
const char *join = "miter";
double miter_limit = 4;
const char *dashes = NULL;
double dash_offset = 0;
const char *output_file = NULL;
char **args = NULL;
GOptionContext *context;
const GOptionEntry entries[] = {
{ "fill-rule", 0, 0, G_OPTION_ARG_STRING, &fill, N_("Fill rule (winding, even-odd)"), N_("VALUE") },
{ "fg-color", 0, 0, G_OPTION_ARG_STRING, &fg_color, N_("Foreground color"), N_("COLOR") },
{ "bg-color", 0, 0, G_OPTION_ARG_STRING, &bg_color, N_("Background color"), N_("COLOR") },
{ "stroke", 0, 0, G_OPTION_ARG_NONE, &do_stroke, N_("Stroke the path instead of filling it"), NULL },
{ "line-width", 0, 0, G_OPTION_ARG_DOUBLE, &line_width, N_("Line width (number)"), N_("VALUE") },
{ "line-cap", 0, 0, G_OPTION_ARG_STRING, &cap, N_("Line cap (butt, round, square)"), N_("VALUE") },
{ "line-join", 0, 0, G_OPTION_ARG_STRING, &join, N_("Line join (miter, miter-clip, round, bevel, arcs)"), N_("VALUE") },
{ "miter-limit", 0, 0, G_OPTION_ARG_DOUBLE, &miter_limit, N_("Miter limit (number)"), N_("VALUE") },
{ "dashes", 0, 0, G_OPTION_ARG_STRING, &dashes, N_("Dash pattern (comma-separated numbers)"), N_("VALUE") },
{ "dash-offset", 0, 0, G_OPTION_ARG_DOUBLE, &dash_offset, N_("Dash offset (number)"), N_("VALUE") },
{ "output", 0, 0, G_OPTION_ARG_FILENAME, &output_file, N_("The output file"), N_("FILE") },
{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &args, NULL, N_("PATH") },
{ NULL, }
};
GskPath *path;
GskFillRule fill_rule;
GdkRGBA fg, bg;
graphene_rect_t bounds;
GskRenderNode *fg_node, *nodes[2], *node;
GdkSurface *surface;
GskRenderer *renderer;
GdkTexture *texture;
const char *filename;
GskLineCap line_cap;
GskLineJoin line_join;
GskStroke *stroke;
if (gdk_display_get_default () == NULL)
{
g_printerr ("%s\n", _("Could not initialize windowing system"));
exit (1);
}
g_set_prgname ("gtk4-path-tool render");
context = g_option_context_new (NULL);
g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
g_option_context_add_main_entries (context, entries, NULL);
g_option_context_set_summary (context, _("Render the path to a png image."));
if (!g_option_context_parse (context, argc, (char ***)argv, &error))
{
g_printerr ("%s\n", error->message);
g_error_free (error);
exit (1);
}
g_option_context_free (context);
if (args == NULL)
{
g_printerr ("%s\n", _("No path specified"));
exit (1);
}
if (g_strv_length (args) > 1)
{
g_printerr ("%s\n", _("Can only render a single path"));
exit (1);
}
path = get_path (args[0]);
fill_rule = get_enum_value (GSK_TYPE_FILL_RULE, _("fill rule"), fill);
get_color (&fg, fg_color);
get_color (&bg, bg_color);
line_cap = get_enum_value (GSK_TYPE_LINE_CAP, _("line cap"), cap);
line_join = get_enum_value (GSK_TYPE_LINE_JOIN, _("line join"), join);
stroke = gsk_stroke_new (line_width);
gsk_stroke_set_line_cap (stroke, line_cap);
gsk_stroke_set_line_join (stroke, line_join);
gsk_stroke_set_miter_limit (stroke, miter_limit);
if (dashes != NULL)
{
GArray *d = g_array_new (FALSE, FALSE, sizeof (float));
char **strings;
strings = g_strsplit (dashes, ",", 0);
for (unsigned int i = 0; strings[i]; i++)
{
char *end = NULL;
float f;
f = (float) g_ascii_strtod (strings[i], &end);
if (*end != '\0')
{
char *msg = g_strdup_printf (_("Failed to parse '%s' as number"), strings[i]);
g_printerr ("%s\n", msg);
exit (1);
}
g_array_append_val (d, f);
}
g_strfreev (strings);
gsk_stroke_set_dash (stroke, (const float *)d->data, d->len);
g_array_unref (d);
}
gsk_stroke_set_dash_offset (stroke, dash_offset);
if (do_stroke)
gsk_path_get_stroke_bounds (path, stroke, &bounds);
else
gsk_path_get_bounds (path, &bounds);
graphene_rect_inset (&bounds, -10, -10);
nodes[0] = gsk_color_node_new (&bg, &bounds);
fg_node = gsk_color_node_new (&fg, &bounds);
if (do_stroke)
nodes[1] = gsk_stroke_node_new (fg_node, path, stroke);
else
nodes[1] = gsk_fill_node_new (fg_node, path, fill_rule);
node = gsk_container_node_new (nodes, 2);
gsk_render_node_unref (fg_node);
gsk_render_node_unref (nodes[0]);
gsk_render_node_unref (nodes[1]);
surface = gdk_surface_new_toplevel (gdk_display_get_default ());
renderer = gsk_renderer_new_for_surface (surface);
texture = gsk_renderer_render_texture (renderer, node, &bounds);
filename = output_file ? output_file : "path.png";
if (!gdk_texture_save_to_png (texture, filename))
{
char *msg = g_strdup_printf (_("Saving png to '%s' failed"), filename);
g_printerr ("%s\n", msg);
exit (1);
}
if (output_file == NULL)
{
char *msg = g_strdup_printf (_("Output written to '%s'."), filename);
g_print ("%s\n", msg);
g_free (msg);
}
g_object_unref (texture);
gsk_renderer_unrealize (renderer);
g_object_unref (renderer);
g_object_unref (surface);
gsk_render_node_unref (node);
gsk_path_unref (path);
g_strfreev (args);
}
+232
View File
@@ -0,0 +1,232 @@
/* Copyright 2023 Red Hat, Inc.
*
* GTK+ is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* GLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with GTK+; see the file COPYING. If not,
* see <http://www.gnu.org/licenses/>.
*
* Author: Matthias Clasen
*/
#include "config.h"
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <glib/gi18n-lib.h>
#include <glib/gprintf.h>
#include <glib/gstdio.h>
#include <gtk/gtk.h>
#include "gtk-path-tool.h"
#include "path-view.h"
static void
show_path_fill (GskPath *path,
GskFillRule fill_rule,
const GdkRGBA *fg_color,
const GdkRGBA *bg_color)
{
GtkWidget *window, *sw, *child;
window = gtk_window_new ();
gtk_window_set_title (GTK_WINDOW (window), _("Path Preview"));
// gtk_window_set_default_size (GTK_WINDOW (window), 700, 500);
sw = gtk_scrolled_window_new ();
gtk_scrolled_window_set_propagate_natural_width (GTK_SCROLLED_WINDOW (sw), TRUE);
gtk_scrolled_window_set_propagate_natural_height (GTK_SCROLLED_WINDOW (sw), TRUE);
gtk_window_set_child (GTK_WINDOW (window), sw);
child = path_view_new (path);
g_object_set (child,
"do-fill", TRUE,
"fill-rule", fill_rule,
"fg-color", fg_color,
"bg-color", bg_color,
NULL);
gtk_widget_set_hexpand (child, TRUE);
gtk_widget_set_vexpand (child, TRUE);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), child);
gtk_window_present (GTK_WINDOW (window));
while (g_list_model_get_n_items (gtk_window_get_toplevels ()) > 0)
g_main_context_iteration (NULL, TRUE);
}
static void
show_path_stroke (GskPath *path,
GskStroke *stroke,
const GdkRGBA *fg_color,
const GdkRGBA *bg_color)
{
GtkWidget *window, *sw, *child;
window = gtk_window_new ();
gtk_window_set_title (GTK_WINDOW (window), _("Path Preview"));
// gtk_window_set_default_size (GTK_WINDOW (window), 700, 500);
sw = gtk_scrolled_window_new ();
gtk_scrolled_window_set_propagate_natural_width (GTK_SCROLLED_WINDOW (sw), TRUE);
gtk_scrolled_window_set_propagate_natural_height (GTK_SCROLLED_WINDOW (sw), TRUE);
gtk_window_set_child (GTK_WINDOW (window), sw);
child = path_view_new (path);
g_object_set (child,
"do-fill", FALSE,
"stroke", stroke,
"fg-color", fg_color,
"bg-color", bg_color,
NULL);
gtk_widget_set_hexpand (child, TRUE);
gtk_widget_set_vexpand (child, TRUE);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), child);
gtk_window_present (GTK_WINDOW (window));
while (g_list_model_get_n_items (gtk_window_get_toplevels ()) > 0)
g_main_context_iteration (NULL, TRUE);
}
void
do_show (int *argc,
const char ***argv)
{
GError *error = NULL;
gboolean do_stroke = FALSE;
const char *fill = "winding";
const char *fg_color = "black";
const char *bg_color = "white";
double line_width = 1;
const char *cap = "butt";
const char *join = "miter";
double miter_limit = 4;
const char *dashes = NULL;
double dash_offset = 0;
char **args = NULL;
GOptionContext *context;
const GOptionEntry entries[] = {
{ "fill-rule", 0, 0, G_OPTION_ARG_STRING, &fill, N_("Fill rule (winding, even-odd)"), N_("VALUE") },
{ "fg-color", 0, 0, G_OPTION_ARG_STRING, &fg_color, N_("Foreground color"), N_("COLOR") },
{ "bg-color", 0, 0, G_OPTION_ARG_STRING, &bg_color, N_("Background color"), N_("COLOR") },
{ "stroke", 0, 0, G_OPTION_ARG_NONE, &do_stroke, N_("Stroke the path instead of filling it"), NULL },
{ "line-width", 0, 0, G_OPTION_ARG_DOUBLE, &line_width, N_("Line width (number)"), N_("VALUE") },
{ "line-cap", 0, 0, G_OPTION_ARG_STRING, &cap, N_("Line cap (butt, round, square)"), N_("VALUE") },
{ "line-join", 0, 0, G_OPTION_ARG_STRING, &join, N_("Line join (miter, miter-clip, round, bevel, arcs)"), N_("VALUE") },
{ "miter-limit", 0, 0, G_OPTION_ARG_DOUBLE, &miter_limit, N_("Miter limit (number)"), N_("VALUE") },
{ "dashes", 0, 0, G_OPTION_ARG_STRING, &dashes, N_("Dash pattern (comma-separated numbers)"), N_("VALUE") },
{ "dash-offset", 0, 0, G_OPTION_ARG_DOUBLE, &dash_offset, N_("Dash offset (number)"), N_("VALUE") },
{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &args, NULL, N_("PATH") },
{ NULL, }
};
GskPath *path;
GskFillRule fill_rule;
GdkRGBA fg;
GdkRGBA bg;
GskLineCap line_cap;
GskLineJoin line_join;
GskStroke *stroke;
if (gdk_display_get_default () == NULL)
{
g_printerr ("%s\n", _("Could not initialize windowing system"));
exit (1);
}
g_set_prgname ("gtk4-path-tool show");
context = g_option_context_new (NULL);
g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
g_option_context_add_main_entries (context, entries, NULL);
g_option_context_set_summary (context, _("Display the path."));
if (!g_option_context_parse (context, argc, (char ***)argv, &error))
{
g_printerr ("%s\n", error->message);
g_error_free (error);
exit (1);
}
g_option_context_free (context);
if (args == NULL)
{
g_printerr ("%s\n", _("No path specified"));
exit (1);
}
if (g_strv_length (args) > 1)
{
g_printerr ("%s\n", _("Can only show a single path"));
exit (1);
}
path = get_path (args[0]);
fill_rule = get_enum_value (GSK_TYPE_FILL_RULE, _("fill rule"), fill);
get_color (&fg, fg_color);
get_color (&bg, bg_color);
line_cap = get_enum_value (GSK_TYPE_LINE_CAP, _("line cap"), cap);
line_join = get_enum_value (GSK_TYPE_LINE_JOIN, _("line join"), join);
stroke = gsk_stroke_new (line_width);
gsk_stroke_set_line_cap (stroke, line_cap);
gsk_stroke_set_line_join (stroke, line_join);
gsk_stroke_set_miter_limit (stroke, miter_limit);
if (dashes != NULL)
{
GArray *d = g_array_new (FALSE, FALSE, sizeof (float));
char **strings;
strings = g_strsplit (dashes, ",", 0);
for (unsigned int i = 0; strings[i]; i++)
{
char *end = NULL;
float f;
f = (float) g_ascii_strtod (strings[i], &end);
if (*end != '\0')
{
char *msg = g_strdup_printf (_("Failed to parse '%s' as number"), strings[i]);
g_printerr ("%s\n", msg);
exit (1);
}
g_array_append_val (d, f);
}
g_strfreev (strings);
gsk_stroke_set_dash (stroke, (const float *)d->data, d->len);
g_array_unref (d);
}
gsk_stroke_set_dash_offset (stroke, dash_offset);
if (do_stroke)
show_path_stroke (path, stroke, &fg, &bg);
else
show_path_fill (path, fill_rule, &fg, &bg);
gsk_path_unref (path);
g_strfreev (args);
}
+139
View File
@@ -0,0 +1,139 @@
/* Copyright 2023 Red Hat, Inc.
*
* GTK+ is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* GLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with GTK+; see the file COPYING. If not,
* see <http://www.gnu.org/licenses/>.
*
* Author: Matthias Clasen
*/
#include "config.h"
#include <gtk/gtk.h>
#include <gio/gio.h>
#ifdef G_OS_UNIX
#include <gio/gunixinputstream.h>
#endif
#include "gtk-path-tool.h"
#include <glib/gi18n-lib.h>
GskPath *
get_path (const char *arg)
{
char *buffer = NULL;
gsize len;
GError *error = NULL;
GskPath *path;
if (arg[0] == '.' || arg[0] == '/')
{
if (!g_file_get_contents (arg, &buffer, &len, &error))
{
g_printerr ("%s\n", error->message);
exit (1);
}
}
#ifdef G_OS_UNIX
else if (strcmp (arg, "-") == 0)
{
GInputStream *in;
GOutputStream *out;
in = g_unix_input_stream_new (0, FALSE);
out = g_memory_output_stream_new (NULL, 0, g_realloc, g_free);
if (g_output_stream_splice (out, in, 0, NULL, &error) < 0)
{
g_printerr (_("Failed to read from standard input: %s\n"), error->message);
exit (1);
}
if (!g_output_stream_close (out, NULL, &error))
{
g_printerr (_("Error reading from standard input: %s\n"), error->message);
exit (1);
}
buffer = g_memory_output_stream_steal_data (G_MEMORY_OUTPUT_STREAM (out));
g_object_unref (out);
g_object_unref (in);
}
#endif
else
buffer = g_strdup (arg);
g_strstrip (buffer);
path = gsk_path_parse (buffer);
if (path == NULL)
{
g_printerr (_("Failed to parse '%s' as path.\n"), arg);
exit (1);
}
g_free (buffer);
return path;
}
int
get_enum_value (GType type,
const char *type_nick,
const char *str)
{
GEnumClass *class = g_type_class_ref (type);
GEnumValue *value;
int val;
value = g_enum_get_value_by_nick (class, str);
if (value)
val = value->value;
else
{
GString *s;
s = g_string_new ("");
g_string_append_printf (s, _("Failed to parse '%s' as %s."), str, type_nick);
g_string_append (s, "\n");
g_string_append (s, _("Possible values: "));
for (unsigned int i = 0; i < class->n_values; i++)
{
if (i > 0)
g_string_append (s, ", ");
g_string_append (s, class->values[i].value_nick);
}
g_printerr ("%s\n", s->str);
g_string_free (s, TRUE);
exit (1);
}
g_type_class_unref (class);
return val;
}
void
get_color (GdkRGBA *rgba,
const char *str)
{
if (!gdk_rgba_parse (rgba, str))
{
char *msg = g_strdup_printf (_("Could not parse '%s' as color"), str);
g_printerr ("%s\n", msg);
exit (1);
}
}
+139
View File
@@ -0,0 +1,139 @@
/* Copyright 2023 Red Hat, Inc.
*
* GTK+ is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* GLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with GTK+; see the file COPYING. If not,
* see <http://www.gnu.org/licenses/>.
*
* Author: Matthias Clasen
*/
#include "config.h"
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <glib/gi18n-lib.h>
#include <glib/gprintf.h>
#include <glib/gstdio.h>
#include <gtk/gtk.h>
#include "gtk-path-tool.h"
static void G_GNUC_NORETURN
usage (void)
{
g_print (_("Usage:\n"
" gtk4-path-tool [COMMAND] [OPTION…] PATH\n"
"\n"
"Perform various tasks on paths.\n"
"\n"
"Commands:\n"
" decompose Decompose the path\n"
" show Display the path in a window\n"
" render Render the path as an image\n"
" info Print information about the path\n"
"\n"));
exit (1);
}
/* A simplified version of g_log_writer_default_would_drop(), to avoid
* bumping up the required version of GLib to 2.68
*/
static gboolean
would_drop (GLogLevelFlags level,
const char *domain)
{
#if GLIB_CHECK_VERSION (2, 68, 0)
return g_log_writer_default_would_drop (level, domain);
#else
return (level & (G_LOG_LEVEL_ERROR |
G_LOG_LEVEL_CRITICAL |
G_LOG_LEVEL_WARNING)) == 0;
#endif
}
static GLogWriterOutput
log_writer_func (GLogLevelFlags level,
const GLogField *fields,
gsize n_fields,
gpointer user_data)
{
gsize i;
const char *domain = NULL;
const char *message = NULL;
for (i = 0; i < n_fields; i++)
{
if (g_strcmp0 (fields[i].key, "GLIB_DOMAIN") == 0)
domain = fields[i].value;
else if (g_strcmp0 (fields[i].key, "MESSAGE") == 0)
message = fields[i].value;
}
if (message != NULL && !would_drop (level, domain))
{
const char *prefix;
switch (level & G_LOG_LEVEL_MASK)
{
case G_LOG_LEVEL_ERROR:
prefix = "ERROR";
break;
case G_LOG_LEVEL_CRITICAL:
prefix = "CRITICAL";
break;
case G_LOG_LEVEL_WARNING:
prefix = "WARNING";
break;
default:
prefix = "INFO";
break;
}
g_printerr ("%s-%s: %s\n", domain, prefix, message);
}
return G_LOG_WRITER_HANDLED;
}
int
main (int argc, const char *argv[])
{
g_set_prgname ("gtk4-path-tool");
g_log_set_writer_func (log_writer_func, NULL, NULL);
gtk_init_check ();
gtk_test_register_all_types ();
if (argc < 2)
usage ();
if (strcmp (argv[1], "--help") == 0)
usage ();
argv++;
argc--;
if (strcmp (argv[0], "decompose") == 0)
do_decompose (&argc, &argv);
else if (strcmp (argv[0], "info") == 0)
do_info (&argc, &argv);
else if (strcmp (argv[0], "render") == 0)
do_render (&argc, &argv);
else if (strcmp (argv[0], "show") == 0)
do_show (&argc, &argv);
else
usage ();
return 0;
}
+13
View File
@@ -0,0 +1,13 @@
#pragma once
void do_info (int *argc, const char ***argv);
void do_decompose (int *argc, const char ***argv);
void do_render (int *argc, const char ***argv);
void do_show (int *argc, const char ***argv);
GskPath *get_path (const char *arg);
int get_enum_value (GType type,
const char *type_nick,
const char *str);
void get_color (GdkRGBA *rgba,
const char *str);
+7
View File
@@ -23,6 +23,13 @@ if win32_enabled
endif
gtk_tools = [
['gtk4-path-tool', ['gtk-path-tool.c',
'gtk-path-tool-decompose.c',
'gtk-path-tool-info.c',
'gtk-path-tool-render.c',
'gtk-path-tool-show.c',
'gtk-path-tool-utils.c',
'path-view.c'], [libgtk_dep]],
['gtk4-query-settings', ['gtk-query-settings.c'], [libgtk_dep]],
['gtk4-builder-tool', ['gtk-builder-tool.c',
'gtk-builder-tool-simplify.c',
+271
View File
@@ -0,0 +1,271 @@
/* Copyright 2023 Red Hat, Inc.
*
* GTK+ is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* GLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with GTK+; see the file COPYING. If not,
* see <http://www.gnu.org/licenses/>.
*
* Author: Matthias Clasen
*/
#include "config.h"
#include "path-view.h"
struct _PathView
{
GtkWidget parent_instance;
GskPath *path;
GskStroke *stroke;
graphene_rect_t bounds;
GskFillRule fill_rule;
GdkRGBA fg;
GdkRGBA bg;
int padding;
gboolean do_fill;
};
enum {
PROP_PATH = 1,
PROP_DO_FILL,
PROP_STROKE,
PROP_FILL_RULE,
PROP_FG_COLOR,
PROP_BG_COLOR,
N_PROPERTIES
};
static GParamSpec *properties[N_PROPERTIES] = { NULL, };
struct _PathViewClass
{
GtkWidgetClass parent_class;
};
G_DEFINE_TYPE (PathView, path_view, GTK_TYPE_WIDGET)
static void
path_view_init (PathView *self)
{
self->do_fill = TRUE;
self->stroke = gsk_stroke_new (1);
self->fill_rule = GSK_FILL_RULE_WINDING;
self->fg = (GdkRGBA) { 0, 0, 0, 1};
self->bg = (GdkRGBA) { 1, 1, 1, 1};
self->padding = 10;
}
static void
path_view_dispose (GObject *object)
{
PathView *self = PATH_VIEW (object);
g_clear_pointer (&self->path, gsk_path_unref);
g_clear_pointer (&self->stroke, gsk_stroke_free);
G_OBJECT_CLASS (path_view_parent_class)->dispose (object);
}
static void
path_view_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
PathView *self = PATH_VIEW (object);
switch (prop_id)
{
case PROP_PATH:
g_value_set_boxed (value, self->path);
break;
case PROP_DO_FILL:
g_value_set_boolean (value, self->do_fill);
break;
case PROP_STROKE:
g_value_set_boxed (value, self->stroke);
break;
case PROP_FILL_RULE:
g_value_set_enum (value, self->fill_rule);
break;
case PROP_FG_COLOR:
g_value_set_boxed (value, &self->fg);
break;
case PROP_BG_COLOR:
g_value_set_boxed (value, &self->bg);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
update_bounds (PathView *self)
{
if (self->do_fill)
gsk_path_get_bounds (self->path, &self->bounds);
else
gsk_path_get_stroke_bounds (self->path, self->stroke, &self->bounds);
}
static void
path_view_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
PathView *self = PATH_VIEW (object);
switch (prop_id)
{
case PROP_PATH:
g_clear_pointer (&self->path, gsk_path_unref);
self->path = g_value_dup_boxed (value);
update_bounds (self);
gtk_widget_queue_resize (GTK_WIDGET (self));
break;
case PROP_DO_FILL:
self->do_fill = g_value_get_boolean (value);
update_bounds (self);
gtk_widget_queue_resize (GTK_WIDGET (self));
break;
case PROP_STROKE:
gsk_stroke_free (self->stroke);
self->stroke = g_value_get_boxed (value);
update_bounds (self);
gtk_widget_queue_resize (GTK_WIDGET (self));
break;
case PROP_FILL_RULE:
self->fill_rule = g_value_get_enum (value);
gtk_widget_queue_draw (GTK_WIDGET (self));
break;
case PROP_FG_COLOR:
self->fg = *(GdkRGBA *) g_value_get_boxed (value);
gtk_widget_queue_draw (GTK_WIDGET (self));
break;
case PROP_BG_COLOR:
self->bg = *(GdkRGBA *) g_value_get_boxed (value);
gtk_widget_queue_draw (GTK_WIDGET (self));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
path_view_measure (GtkWidget *widget,
GtkOrientation orientation,
int for_size,
int *minimum,
int *natural,
int *minimum_baseline,
int *natural_baseline)
{
PathView *self = PATH_VIEW (widget);
if (orientation == GTK_ORIENTATION_HORIZONTAL)
*minimum = *natural = (int) ceilf (self->bounds.size.width) + 2 * self->padding;
else
*minimum = *natural = (int) ceilf (self->bounds.size.height) + 2 * self->padding;
}
static void
path_view_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot)
{
PathView *self = PATH_VIEW (widget);
graphene_rect_t bounds = self->bounds;
graphene_rect_inset (&bounds, - self->padding, - self->padding);
gtk_snapshot_save (snapshot);
gtk_snapshot_append_color (snapshot, &self->bg, &self->bounds);
gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (self->padding, self->padding));
if (self->do_fill)
gtk_snapshot_push_fill (snapshot, self->path, self->fill_rule);
else
gtk_snapshot_push_stroke (snapshot, self->path, self->stroke);
gtk_snapshot_append_color (snapshot, &self->fg, &self->bounds);
gtk_snapshot_pop (snapshot);
gtk_snapshot_restore (snapshot);
}
static void
path_view_class_init (PathViewClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
object_class->dispose = path_view_dispose;
object_class->get_property = path_view_get_property;
object_class->set_property = path_view_set_property;
widget_class->measure = path_view_measure;
widget_class->snapshot = path_view_snapshot;
properties[PROP_PATH]
= g_param_spec_boxed ("path", NULL, NULL,
GSK_TYPE_PATH,
G_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
properties[PROP_DO_FILL]
= g_param_spec_boolean ("do-fill", NULL, NULL,
TRUE,
G_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
properties[PROP_STROKE]
= g_param_spec_boxed ("stroke", NULL, NULL,
GSK_TYPE_STROKE,
G_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
properties[PROP_FILL_RULE]
= g_param_spec_enum ("fill-rule", NULL, NULL,
GSK_TYPE_FILL_RULE,
GSK_FILL_RULE_WINDING,
G_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
properties[PROP_FG_COLOR]
= g_param_spec_boxed ("fg-color", NULL, NULL,
GDK_TYPE_RGBA,
G_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
properties[PROP_BG_COLOR]
= g_param_spec_boxed ("bg-color", NULL, NULL,
GDK_TYPE_RGBA,
G_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
g_object_class_install_properties (object_class, N_PROPERTIES, properties);
}
GtkWidget *
path_view_new (GskPath *path)
{
return g_object_new (PATH_TYPE_VIEW,
"path", path,
NULL);
}
+9
View File
@@ -0,0 +1,9 @@
#pragma once
#include <gtk/gtk.h>
#define PATH_TYPE_VIEW (path_view_get_type ())
G_DECLARE_FINAL_TYPE (PathView, path_view, PATH, VIEW, GtkWidget)
GtkWidget * path_view_new (GskPath *path);