1// Package gsk was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gsk
3
4import (
5 "github.com/ebitengine/purego"
6
7 "github.com/bnema/puregotk/pkg/core"
8 "github.com/bnema/puregotk/v4/gobject/types"
9 "github.com/bnema/puregotk/v4/graphene"
10)
11
12// Type of the callback to iterate through the operations of a path.
13//
14// For each operation, the callback is given the @op itself, the points
15// that the operation is applied to in @pts, and a @weight for conic
16// curves. The @n_pts argument is somewhat redundant, since the number
17// of points can be inferred from the operation.
18//
19// Each contour of the path starts with a @GSK_PATH_MOVE operation.
20// Closed contours end with a @GSK_PATH_CLOSE operation.
21type PathForeachFunc func(PathOperation, []graphene.Point, uint, float32, uintptr) bool
22
23// Prototype of the callback to iterate through the
24// intersections of two paths.
25type PathIntersectionFunc func(*Path, *PathPoint, *Path, *PathPoint, PathIntersection, uintptr) bool
26
27// Flags that can be passed to gsk_path_foreach() to influence what
28// kinds of operations the path is decomposed into.
29//
30// By default, [method@Gsk.Path.foreach] will only emit a path with all
31// operations flattened to straight lines to allow for maximum compatibility.
32// The only operations emitted will be `GSK_PATH_MOVE`, `GSK_PATH_LINE` and
33// `GSK_PATH_CLOSE`.
34type PathForeachFlags int
35
36var xPathForeachFlagsGLibType func() types.GType
37
38func PathForeachFlagsGLibType() types.GType {
39 return xPathForeachFlagsGLibType()
40}
41
42const (
43
44 // The default behavior, only allow lines.
45 PathForeachAllowOnlyLinesValue PathForeachFlags = 0
46 // Allow emission of `GSK_PATH_QUAD` operations
47 PathForeachAllowQuadValue PathForeachFlags = 1
48 // Allow emission of `GSK_PATH_CUBIC` operations.
49 PathForeachAllowCubicValue PathForeachFlags = 2
50 // Allow emission of `GSK_PATH_CONIC` operations.
51 PathForeachAllowConicValue PathForeachFlags = 4
52)
53
54// The values of this enumeration classify intersections
55// between paths.
56type PathIntersection int
57
58var xPathIntersectionGLibType func() types.GType
59
60func PathIntersectionGLibType() types.GType {
61 return xPathIntersectionGLibType()
62}
63
64const (
65
66 // No intersection
67 PathIntersectionNoneValue PathIntersection = 0
68 // A normal intersection, where the two paths
69 // cross each other
70 PathIntersectionNormalValue PathIntersection = 1
71 // The start of a segment where the two paths coincide
72 PathIntersectionStartValue PathIntersection = 2
73 // The end of a segment where the two paths coincide
74 PathIntersectionEndValue PathIntersection = 3
75)
76
77var xPathParse func(string) *Path
78
79// Constructs a path from a serialized form.
80//
81// The string is expected to be in (a superset of)
82// [SVG path syntax](https://www.w3.org/TR/SVG11/paths.html#PathData),
83// as e.g. produced by [method@Gsk.Path.to_string].
84//
85// A high-level summary of the syntax:
86//
87// - `M x y` Move to `(x, y)`
88// - `L x y` Add a line from the current point to `(x, y)`
89// - `Q x1 y1 x2 y2` Add a quadratic Bézier from the current point to `(x2, y2)`, with control point `(x1, y1)`
90// - `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)`
91// - `Z` Close the contour by drawing a line back to the start point
92// - `H x` Add a horizontal line from the current point to the given x value
93// - `V y` Add a vertical line from the current point to the given y value
94// - `T x2 y2` Add a quadratic Bézier, using the reflection of the previous segments' control point as control point
95// - `S x2 y2 x3 y3` Add a cubic Bézier, using the reflection of the previous segments' second control point as first control point
96// - `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.
97// - `O x1 y1 x2 y2 w` Add a rational quadratic Bézier from the current point to `(x2, y2)` with control point `(x1, y1)` and weight `w`.
98//
99// All the commands have lowercase variants that interpret coordinates
100// relative to the current point.
101//
102// The `O` command is an extension that is not supported in SVG.
103func PathParse(StringVar string) *Path {
104
105 cret := xPathParse(StringVar)
106 return cret
107}
108
109func init() {
110 core.SetPackageName("GSK", "gtk4")
111 core.SetSharedLibraries("GSK", []string{"libgtk-4.so.1"})
112 var libs []uintptr
113 for _, libPath := range core.GetPaths("GSK") {
114 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
115 if err != nil {
116 panic(err)
117 }
118 libs = append(libs, lib)
119 }
120
121 core.PuregoSafeRegister(&xPathForeachFlagsGLibType, libs, "gsk_path_foreach_flags_get_type")
122
123 core.PuregoSafeRegister(&xPathIntersectionGLibType, libs, "gsk_path_intersection_get_type")
124
125 core.PuregoSafeRegister(&xPathParse, libs, "gsk_path_parse")
126
127}