1// Package graphene was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package graphene
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)
13
14// A point with two coordinates.
15type Point struct {
16 _ structs.HostLayout
17
18 X float32
19
20 Y float32
21}
22
23var xPointGLibType func() types.GType
24
25func PointGLibType() types.GType {
26 return xPointGLibType()
27}
28
29func (x *Point) GoPointer() uintptr {
30 return uintptr(unsafe.Pointer(x))
31}
32
33var xPointAlloc func() *Point
34
35// Allocates a new #graphene_point_t structure.
36//
37// The coordinates of the returned point are (0, 0).
38//
39// It's possible to chain this function with graphene_point_init()
40// or graphene_point_init_from_point(), e.g.:
41//
42// |[<!-- language="C" -->
43//
44// graphene_point_t *
45// point_new (float x, float y)
46// {
47// return graphene_point_init (graphene_point_alloc (), x, y);
48// }
49//
50// graphene_point_t *
51// point_copy (const graphene_point_t *p)
52// {
53// return graphene_point_init_from_point (graphene_point_alloc (), p);
54// }
55//
56// ]|
57func PointAlloc() *Point {
58
59 cret := xPointAlloc()
60 return cret
61}
62
63var xPointDistance func(uintptr, *Point, *float32, *float32) float32
64
65// Computes the distance between @a and @b.
66func (x *Point) Distance(BVar *Point, DXVar *float32, DYVar *float32) float32 {
67
68 cret := xPointDistance(x.GoPointer(), BVar, DXVar, DYVar)
69 return cret
70}
71
72var xPointEqual func(uintptr, *Point) bool
73
74// Checks if the two points @a and @b point to the same
75// coordinates.
76//
77// This function accounts for floating point fluctuations; if
78// you want to control the fuzziness of the match, you can use
79// graphene_point_near() instead.
80func (x *Point) Equal(BVar *Point) bool {
81
82 cret := xPointEqual(x.GoPointer(), BVar)
83 return cret
84}
85
86var xPointFree func(uintptr)
87
88// Frees the resources allocated by graphene_point_alloc().
89func (x *Point) Free() {
90
91 xPointFree(x.GoPointer())
92
93}
94
95var xPointInit func(uintptr, float32, float32) *Point
96
97// Initializes @p to the given @x and @y coordinates.
98//
99// It's safe to call this function multiple times.
100func (x *Point) Init(XVar float32, YVar float32) *Point {
101
102 cret := xPointInit(x.GoPointer(), XVar, YVar)
103 return cret
104}
105
106var xPointInitFromPoint func(uintptr, *Point) *Point
107
108// Initializes @p with the same coordinates of @src.
109func (x *Point) InitFromPoint(SrcVar *Point) *Point {
110
111 cret := xPointInitFromPoint(x.GoPointer(), SrcVar)
112 return cret
113}
114
115var xPointInitFromVec2 func(uintptr, *Vec2) *Point
116
117// Initializes @p with the coordinates inside the given #graphene_vec2_t.
118func (x *Point) InitFromVec2(SrcVar *Vec2) *Point {
119
120 cret := xPointInitFromVec2(x.GoPointer(), SrcVar)
121 return cret
122}
123
124var xPointInterpolate func(uintptr, *Point, float64, *Point)
125
126// Linearly interpolates the coordinates of @a and @b using the
127// given @factor.
128func (x *Point) Interpolate(BVar *Point, FactorVar float64, ResVar *Point) {
129
130 xPointInterpolate(x.GoPointer(), BVar, FactorVar, ResVar)
131
132}
133
134var xPointNear func(uintptr, *Point, float32) bool
135
136// Checks whether the two points @a and @b are within
137// the threshold of @epsilon.
138func (x *Point) Near(BVar *Point, EpsilonVar float32) bool {
139
140 cret := xPointNear(x.GoPointer(), BVar, EpsilonVar)
141 return cret
142}
143
144var xPointToVec2 func(uintptr, *Vec2)
145
146// Stores the coordinates of the given #graphene_point_t into a
147// #graphene_vec2_t.
148func (x *Point) ToVec2(VVar *Vec2) {
149
150 xPointToVec2(x.GoPointer(), VVar)
151
152}
153
154var xPointZero func() *Point
155
156// Returns a point fixed at (0, 0).
157func PointZero() *Point {
158
159 cret := xPointZero()
160 return cret
161}
162
163func init() {
164 core.SetPackageName("GRAPHENE", "graphene-gobject-1.0")
165 core.SetSharedLibraries("GRAPHENE", []string{"libgraphene-1.0.so.0"})
166 var libs []uintptr
167 for _, libPath := range core.GetPaths("GRAPHENE") {
168 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
169 if err != nil {
170 panic(err)
171 }
172 libs = append(libs, lib)
173 }
174
175 core.PuregoSafeRegister(&xPointZero, libs, "graphene_point_zero")
176
177 core.PuregoSafeRegister(&xPointGLibType, libs, "graphene_point_get_type")
178
179 core.PuregoSafeRegister(&xPointAlloc, libs, "graphene_point_alloc")
180
181 core.PuregoSafeRegister(&xPointDistance, libs, "graphene_point_distance")
182 core.PuregoSafeRegister(&xPointEqual, libs, "graphene_point_equal")
183 core.PuregoSafeRegister(&xPointFree, libs, "graphene_point_free")
184 core.PuregoSafeRegister(&xPointInit, libs, "graphene_point_init")
185 core.PuregoSafeRegister(&xPointInitFromPoint, libs, "graphene_point_init_from_point")
186 core.PuregoSafeRegister(&xPointInitFromVec2, libs, "graphene_point_init_from_vec2")
187 core.PuregoSafeRegister(&xPointInterpolate, libs, "graphene_point_interpolate")
188 core.PuregoSafeRegister(&xPointNear, libs, "graphene_point_near")
189 core.PuregoSafeRegister(&xPointToVec2, libs, "graphene_point_to_vec2")
190
191}