v0.2.1 c0399be

gskpathpoint.go RawHistoryFolder

1// Package gsk was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gsk
3
4import (
5	"structs"
6	"unsafe"
7
8	"github.com/ebitengine/purego"
9
10	"github.com/bnema/puregotk/pkg/core"
11	"github.com/bnema/puregotk/v4/gobject/types"
12	"github.com/bnema/puregotk/v4/graphene"
13)
14
15// Represents a point on a path.
16//
17// It can be queried for properties of the path at that point,
18// such as its tangent or its curvature.
19//
20// To obtain a `GskPathPoint`, use [method@Gsk.Path.get_closest_point],
21// [method@Gsk.Path.get_start_point], [method@Gsk.Path.get_end_point]
22// or [method@Gsk.PathMeasure.get_point].
23//
24// Note that `GskPathPoint` structs are meant to be stack-allocated,
25// and don't hold a reference to the path object they are obtained from.
26// It is the callers responsibility to keep a reference to the path
27// as long as the `GskPathPoint` is used.
28type PathPoint struct {
29	_ structs.HostLayout
30}
31
32var xPathPointGLibType func() types.GType
33
34func PathPointGLibType() types.GType {
35	return xPathPointGLibType()
36}
37
38func (x *PathPoint) GoPointer() uintptr {
39	return uintptr(unsafe.Pointer(x))
40}
41
42var xPathPointCompare func(uintptr, *PathPoint) int
43
44// Returns whether @point1 is before or after @point2.
45func (x *PathPoint) Compare(Point2Var *PathPoint) int {
46
47	cret := xPathPointCompare(x.GoPointer(), Point2Var)
48	return cret
49}
50
51var xPathPointCopy func(uintptr) *PathPoint
52
53// Copies a path point.
54func (x *PathPoint) Copy() *PathPoint {
55
56	cret := xPathPointCopy(x.GoPointer())
57	return cret
58}
59
60var xPathPointEqual func(uintptr, *PathPoint) bool
61
62// Returns whether the two path points refer to the same
63// location on all paths.
64//
65// Note that the start- and endpoint of a closed contour
66// will compare nonequal according to this definition.
67// Use [method@Gsk.Path.is_closed] to find out if the
68// start- and endpoint of a concrete path refer to the
69// same location.
70func (x *PathPoint) Equal(Point2Var *PathPoint) bool {
71
72	cret := xPathPointEqual(x.GoPointer(), Point2Var)
73	return cret
74}
75
76var xPathPointFree func(uintptr)
77
78// Frees a path point copied by [method@Gsk.PathPoint.copy].
79func (x *PathPoint) Free() {
80
81	xPathPointFree(x.GoPointer())
82
83}
84
85var xPathPointGetCurvature func(uintptr, *Path, PathDirection, *graphene.Point) float32
86
87// Calculates the curvature of the path at the point.
88//
89// Optionally, returns the center of the osculating circle as well.
90// The curvature is the inverse of the radius of the osculating circle.
91//
92// Lines have a curvature of zero (indicating an osculating circle of
93// infinite radius). In this case, the @center is not modified.
94//
95// # Circles with a radius of zero have `INFINITY` as curvature
96//
97// Note that certain points on a path may not have a single curvature,
98// such as sharp turns. At such points, there are two curvatures — the
99// (limit of) the curvature of the path going into the point, and the
100// (limit of) the curvature of the path coming out of it. The @direction
101// argument lets you choose which one to get.
102//
103// <picture>
104//
105//	<source srcset="curvature-dark.png" media="(prefers-color-scheme: dark)">
106//	<img alt="Osculating circle" src="curvature-light.png">
107//
108// </picture>
109func (x *PathPoint) GetCurvature(PathVar *Path, DirectionVar PathDirection, CenterVar *graphene.Point) float32 {
110
111	cret := xPathPointGetCurvature(x.GoPointer(), PathVar, DirectionVar, CenterVar)
112	return cret
113}
114
115var xPathPointGetDistance func(uintptr, *PathMeasure) float32
116
117// Returns the distance from the beginning of the path
118// to the point.
119func (x *PathPoint) GetDistance(MeasureVar *PathMeasure) float32 {
120
121	cret := xPathPointGetDistance(x.GoPointer(), MeasureVar)
122	return cret
123}
124
125var xPathPointGetPosition func(uintptr, *Path, *graphene.Point)
126
127// Gets the position of the point.
128func (x *PathPoint) GetPosition(PathVar *Path, PositionVar *graphene.Point) {
129
130	xPathPointGetPosition(x.GoPointer(), PathVar, PositionVar)
131
132}
133
134var xPathPointGetRotation func(uintptr, *Path, PathDirection) float32
135
136// Gets the direction of the tangent at a given point.
137//
138// This is a convenience variant of [method@Gsk.PathPoint.get_tangent]
139// that returns the angle between the tangent and the X axis. The angle
140// can e.g. be used in
141// [gtk_snapshot_rotate()](../gtk4/method.Snapshot.rotate.html).
142func (x *PathPoint) GetRotation(PathVar *Path, DirectionVar PathDirection) float32 {
143
144	cret := xPathPointGetRotation(x.GoPointer(), PathVar, DirectionVar)
145	return cret
146}
147
148var xPathPointGetTangent func(uintptr, *Path, PathDirection, *graphene.Vec2)
149
150// Gets the tangent of the path at the point.
151//
152// Note that certain points on a path may not have a single
153// tangent, such as sharp turns. At such points, there are
154// two tangents — the direction of the path going into the
155// point, and the direction coming out of it. The @direction
156// argument lets you choose which one to get.
157//
158// If the path is just a single point (e.g. a circle with
159// radius zero), then the tangent is set to `0, 0`.
160//
161// If you want to orient something in the direction of the
162// path, [method@Gsk.PathPoint.get_rotation] may be more
163// convenient to use.
164func (x *PathPoint) GetTangent(PathVar *Path, DirectionVar PathDirection, TangentVar *graphene.Vec2) {
165
166	xPathPointGetTangent(x.GoPointer(), PathVar, DirectionVar, TangentVar)
167
168}
169
170func init() {
171	core.SetPackageName("GSK", "gtk4")
172	core.SetSharedLibraries("GSK", []string{"libgtk-4.so.1"})
173	var libs []uintptr
174	for _, libPath := range core.GetPaths("GSK") {
175		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
176		if err != nil {
177			panic(err)
178		}
179		libs = append(libs, lib)
180	}
181
182	core.PuregoSafeRegister(&xPathPointGLibType, libs, "gsk_path_point_get_type")
183
184	core.PuregoSafeRegister(&xPathPointCompare, libs, "gsk_path_point_compare")
185	core.PuregoSafeRegister(&xPathPointCopy, libs, "gsk_path_point_copy")
186	core.PuregoSafeRegister(&xPathPointEqual, libs, "gsk_path_point_equal")
187	core.PuregoSafeRegister(&xPathPointFree, libs, "gsk_path_point_free")
188	core.PuregoSafeRegister(&xPathPointGetCurvature, libs, "gsk_path_point_get_curvature")
189	core.PuregoSafeRegister(&xPathPointGetDistance, libs, "gsk_path_point_get_distance")
190	core.PuregoSafeRegister(&xPathPointGetPosition, libs, "gsk_path_point_get_position")
191	core.PuregoSafeRegister(&xPathPointGetRotation, libs, "gsk_path_point_get_rotation")
192	core.PuregoSafeRegister(&xPathPointGetTangent, libs, "gsk_path_point_get_tangent")
193
194}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 102

↑↓ moveenter openesc close