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// The location and size of a rectangle region.
15//
16// The width and height of a #graphene_rect_t can be negative; for instance,
17// a #graphene_rect_t with an origin of [ 0, 0 ] and a size of [ 10, 10 ] is
18// equivalent to a #graphene_rect_t with an origin of [ 10, 10 ] and a size
19// of [ -10, -10 ].
20//
21// Application code can normalize rectangles using graphene_rect_normalize();
22// this function will ensure that the width and height of a rectangle are
23// positive values. All functions taking a #graphene_rect_t as an argument
24// will internally operate on a normalized copy; all functions returning a
25// #graphene_rect_t will always return a normalized rectangle.
26type Rect struct {
27 _ structs.HostLayout
28
29 Origin uintptr
30
31 Size uintptr
32}
33
34var xRectGLibType func() types.GType
35
36func RectGLibType() types.GType {
37 return xRectGLibType()
38}
39
40func (x *Rect) GoPointer() uintptr {
41 return uintptr(unsafe.Pointer(x))
42}
43
44var xRectContainsPoint func(uintptr, *Point) bool
45
46// Checks whether a #graphene_rect_t contains the given coordinates.
47func (x *Rect) ContainsPoint(PVar *Point) bool {
48
49 cret := xRectContainsPoint(x.GoPointer(), PVar)
50 return cret
51}
52
53var xRectContainsRect func(uintptr, *Rect) bool
54
55// Checks whether a #graphene_rect_t fully contains the given
56// rectangle.
57func (x *Rect) ContainsRect(BVar *Rect) bool {
58
59 cret := xRectContainsRect(x.GoPointer(), BVar)
60 return cret
61}
62
63var xRectEqual func(uintptr, *Rect) bool
64
65// Checks whether the two given rectangle are equal.
66func (x *Rect) Equal(BVar *Rect) bool {
67
68 cret := xRectEqual(x.GoPointer(), BVar)
69 return cret
70}
71
72var xRectExpand func(uintptr, *Point, *Rect)
73
74// Expands a #graphene_rect_t to contain the given #graphene_point_t.
75func (x *Rect) Expand(PVar *Point, ResVar *Rect) {
76
77 xRectExpand(x.GoPointer(), PVar, ResVar)
78
79}
80
81var xRectFree func(uintptr)
82
83// Frees the resources allocated by graphene_rect_alloc().
84func (x *Rect) Free() {
85
86 xRectFree(x.GoPointer())
87
88}
89
90var xRectGetArea func(uintptr) float32
91
92// Compute the area of given normalized rectangle.
93func (x *Rect) GetArea() float32 {
94
95 cret := xRectGetArea(x.GoPointer())
96 return cret
97}
98
99var xRectGetBottomLeft func(uintptr, *Point)
100
101// Retrieves the coordinates of the bottom-left corner of the given rectangle.
102func (x *Rect) GetBottomLeft(PVar *Point) {
103
104 xRectGetBottomLeft(x.GoPointer(), PVar)
105
106}
107
108var xRectGetBottomRight func(uintptr, *Point)
109
110// Retrieves the coordinates of the bottom-right corner of the given rectangle.
111func (x *Rect) GetBottomRight(PVar *Point) {
112
113 xRectGetBottomRight(x.GoPointer(), PVar)
114
115}
116
117var xRectGetCenter func(uintptr, *Point)
118
119// Retrieves the coordinates of the center of the given rectangle.
120func (x *Rect) GetCenter(PVar *Point) {
121
122 xRectGetCenter(x.GoPointer(), PVar)
123
124}
125
126var xRectGetHeight func(uintptr) float32
127
128// Retrieves the normalized height of the given rectangle.
129func (x *Rect) GetHeight() float32 {
130
131 cret := xRectGetHeight(x.GoPointer())
132 return cret
133}
134
135var xRectGetTopLeft func(uintptr, *Point)
136
137// Retrieves the coordinates of the top-left corner of the given rectangle.
138func (x *Rect) GetTopLeft(PVar *Point) {
139
140 xRectGetTopLeft(x.GoPointer(), PVar)
141
142}
143
144var xRectGetTopRight func(uintptr, *Point)
145
146// Retrieves the coordinates of the top-right corner of the given rectangle.
147func (x *Rect) GetTopRight(PVar *Point) {
148
149 xRectGetTopRight(x.GoPointer(), PVar)
150
151}
152
153var xRectGetVertices func(uintptr, *[4]Vec2)
154
155// Computes the four vertices of a #graphene_rect_t.
156func (x *Rect) GetVertices(VerticesVar *[4]Vec2) {
157
158 xRectGetVertices(x.GoPointer(), VerticesVar)
159
160}
161
162var xRectGetWidth func(uintptr) float32
163
164// Retrieves the normalized width of the given rectangle.
165func (x *Rect) GetWidth() float32 {
166
167 cret := xRectGetWidth(x.GoPointer())
168 return cret
169}
170
171var xRectGetX func(uintptr) float32
172
173// Retrieves the normalized X coordinate of the origin of the given
174// rectangle.
175func (x *Rect) GetX() float32 {
176
177 cret := xRectGetX(x.GoPointer())
178 return cret
179}
180
181var xRectGetY func(uintptr) float32
182
183// Retrieves the normalized Y coordinate of the origin of the given
184// rectangle.
185func (x *Rect) GetY() float32 {
186
187 cret := xRectGetY(x.GoPointer())
188 return cret
189}
190
191var xRectInit func(uintptr, float32, float32, float32, float32) *Rect
192
193// Initializes the given #graphene_rect_t with the given values.
194//
195// This function will implicitly normalize the #graphene_rect_t
196// before returning.
197func (x *Rect) Init(XVar float32, YVar float32, WidthVar float32, HeightVar float32) *Rect {
198
199 cret := xRectInit(x.GoPointer(), XVar, YVar, WidthVar, HeightVar)
200 return cret
201}
202
203var xRectInitFromRect func(uintptr, *Rect) *Rect
204
205// Initializes @r using the given @src rectangle.
206//
207// This function will implicitly normalize the #graphene_rect_t
208// before returning.
209func (x *Rect) InitFromRect(SrcVar *Rect) *Rect {
210
211 cret := xRectInitFromRect(x.GoPointer(), SrcVar)
212 return cret
213}
214
215var xRectInset func(uintptr, float32, float32) *Rect
216
217// Changes the given rectangle to be smaller, or larger depending on the
218// given inset parameters.
219//
220// To create an inset rectangle, use positive @d_x or @d_y values; to
221// create a larger, encompassing rectangle, use negative @d_x or @d_y
222// values.
223//
224// The origin of the rectangle is offset by @d_x and @d_y, while the size
225// is adjusted by `(2 * @d_x, 2 * @d_y)`. If @d_x and @d_y are positive
226// values, the size of the rectangle is decreased; if @d_x and @d_y are
227// negative values, the size of the rectangle is increased.
228//
229// If the size of the resulting inset rectangle has a negative width or
230// height then the size will be set to zero.
231func (x *Rect) Inset(DXVar float32, DYVar float32) *Rect {
232
233 cret := xRectInset(x.GoPointer(), DXVar, DYVar)
234 return cret
235}
236
237var xRectInsetR func(uintptr, float32, float32, *Rect)
238
239// Changes the given rectangle to be smaller, or larger depending on the
240// given inset parameters.
241//
242// To create an inset rectangle, use positive @d_x or @d_y values; to
243// create a larger, encompassing rectangle, use negative @d_x or @d_y
244// values.
245//
246// The origin of the rectangle is offset by @d_x and @d_y, while the size
247// is adjusted by `(2 * @d_x, 2 * @d_y)`. If @d_x and @d_y are positive
248// values, the size of the rectangle is decreased; if @d_x and @d_y are
249// negative values, the size of the rectangle is increased.
250//
251// If the size of the resulting inset rectangle has a negative width or
252// height then the size will be set to zero.
253func (x *Rect) InsetR(DXVar float32, DYVar float32, ResVar *Rect) {
254
255 xRectInsetR(x.GoPointer(), DXVar, DYVar, ResVar)
256
257}
258
259var xRectInterpolate func(uintptr, *Rect, float64, *Rect)
260
261// Linearly interpolates the origin and size of the two given
262// rectangles.
263func (x *Rect) Interpolate(BVar *Rect, FactorVar float64, ResVar *Rect) {
264
265 xRectInterpolate(x.GoPointer(), BVar, FactorVar, ResVar)
266
267}
268
269var xRectIntersection func(uintptr, *Rect, *Rect) bool
270
271// Computes the intersection of the two given rectangles.
272//
273// 
274//
275// The intersection in the image above is the blue outline.
276//
277// If the two rectangles do not intersect, @res will contain
278// a degenerate rectangle with origin in (0, 0) and a size of 0.
279func (x *Rect) Intersection(BVar *Rect, ResVar *Rect) bool {
280
281 cret := xRectIntersection(x.GoPointer(), BVar, ResVar)
282 return cret
283}
284
285var xRectNormalize func(uintptr) *Rect
286
287// Normalizes the passed rectangle.
288//
289// This function ensures that the size of the rectangle is made of
290// positive values, and that the origin is the top-left corner of
291// the rectangle.
292func (x *Rect) Normalize() *Rect {
293
294 cret := xRectNormalize(x.GoPointer())
295 return cret
296}
297
298var xRectNormalizeR func(uintptr, *Rect)
299
300// Normalizes the passed rectangle.
301//
302// This function ensures that the size of the rectangle is made of
303// positive values, and that the origin is in the top-left corner
304// of the rectangle.
305func (x *Rect) NormalizeR(ResVar *Rect) {
306
307 xRectNormalizeR(x.GoPointer(), ResVar)
308
309}
310
311var xRectOffset func(uintptr, float32, float32) *Rect
312
313// Offsets the origin by @d_x and @d_y.
314//
315// The size of the rectangle is unchanged.
316func (x *Rect) Offset(DXVar float32, DYVar float32) *Rect {
317
318 cret := xRectOffset(x.GoPointer(), DXVar, DYVar)
319 return cret
320}
321
322var xRectOffsetR func(uintptr, float32, float32, *Rect)
323
324// Offsets the origin of the given rectangle by @d_x and @d_y.
325//
326// The size of the rectangle is left unchanged.
327func (x *Rect) OffsetR(DXVar float32, DYVar float32, ResVar *Rect) {
328
329 xRectOffsetR(x.GoPointer(), DXVar, DYVar, ResVar)
330
331}
332
333var xRectRound func(uintptr, *Rect)
334
335// Rounds the origin and size of the given rectangle to
336// their nearest integer values; the rounding is guaranteed
337// to be large enough to have an area bigger or equal to the
338// original rectangle, but might not fully contain its extents.
339// Use graphene_rect_round_extents() in case you need to round
340// to a rectangle that covers fully the original one.
341//
342// This function is the equivalent of calling `floor` on
343// the coordinates of the origin, and `ceil` on the size.
344func (x *Rect) Round(ResVar *Rect) {
345
346 xRectRound(x.GoPointer(), ResVar)
347
348}
349
350var xRectRoundExtents func(uintptr, *Rect)
351
352// Rounds the origin of the given rectangle to its nearest
353// integer value and and recompute the size so that the
354// rectangle is large enough to contain all the conrners
355// of the original rectangle.
356//
357// This function is the equivalent of calling `floor` on
358// the coordinates of the origin, and recomputing the size
359// calling `ceil` on the bottom-right coordinates.
360//
361// If you want to be sure that the rounded rectangle
362// completely covers the area that was covered by the
363// original rectangle — i.e. you want to cover the area
364// including all its corners — this function will make sure
365// that the size is recomputed taking into account the ceiling
366// of the coordinates of the bottom-right corner.
367// If the difference between the original coordinates and the
368// coordinates of the rounded rectangle is greater than the
369// difference between the original size and and the rounded
370// size, then the move of the origin would not be compensated
371// by a move in the anti-origin, leaving the corners of the
372// original rectangle outside the rounded one.
373func (x *Rect) RoundExtents(ResVar *Rect) {
374
375 xRectRoundExtents(x.GoPointer(), ResVar)
376
377}
378
379var xRectRoundToPixel func(uintptr) *Rect
380
381// Rounds the origin and the size of the given rectangle to
382// their nearest integer values; the rounding is guaranteed
383// to be large enough to contain the original rectangle.
384func (x *Rect) RoundToPixel() *Rect {
385
386 cret := xRectRoundToPixel(x.GoPointer())
387 return cret
388}
389
390var xRectScale func(uintptr, float32, float32, *Rect)
391
392// Scales the size and origin of a rectangle horizontaly by @s_h,
393// and vertically by @s_v. The result @res is normalized.
394func (x *Rect) Scale(SHVar float32, SVVar float32, ResVar *Rect) {
395
396 xRectScale(x.GoPointer(), SHVar, SVVar, ResVar)
397
398}
399
400var xRectUnion func(uintptr, *Rect, *Rect)
401
402// Computes the union of the two given rectangles.
403//
404// 
405//
406// The union in the image above is the blue outline.
407func (x *Rect) Union(BVar *Rect, ResVar *Rect) {
408
409 xRectUnion(x.GoPointer(), BVar, ResVar)
410
411}
412
413var xRectAlloc func() *Rect
414
415// Allocates a new #graphene_rect_t.
416//
417// The contents of the returned rectangle are undefined.
418func RectAlloc() *Rect {
419
420 cret := xRectAlloc()
421 return cret
422}
423
424var xRectZero func() *Rect
425
426// Returns a degenerate rectangle with origin fixed at (0, 0) and
427// a size of 0, 0.
428func RectZero() *Rect {
429
430 cret := xRectZero()
431 return cret
432}
433
434func init() {
435 core.SetPackageName("GRAPHENE", "graphene-gobject-1.0")
436 core.SetSharedLibraries("GRAPHENE", []string{"libgraphene-1.0.so.0"})
437 var libs []uintptr
438 for _, libPath := range core.GetPaths("GRAPHENE") {
439 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
440 if err != nil {
441 panic(err)
442 }
443 libs = append(libs, lib)
444 }
445
446 core.PuregoSafeRegister(&xRectAlloc, libs, "graphene_rect_alloc")
447 core.PuregoSafeRegister(&xRectZero, libs, "graphene_rect_zero")
448
449 core.PuregoSafeRegister(&xRectGLibType, libs, "graphene_rect_get_type")
450
451 core.PuregoSafeRegister(&xRectContainsPoint, libs, "graphene_rect_contains_point")
452 core.PuregoSafeRegister(&xRectContainsRect, libs, "graphene_rect_contains_rect")
453 core.PuregoSafeRegister(&xRectEqual, libs, "graphene_rect_equal")
454 core.PuregoSafeRegister(&xRectExpand, libs, "graphene_rect_expand")
455 core.PuregoSafeRegister(&xRectFree, libs, "graphene_rect_free")
456 core.PuregoSafeRegister(&xRectGetArea, libs, "graphene_rect_get_area")
457 core.PuregoSafeRegister(&xRectGetBottomLeft, libs, "graphene_rect_get_bottom_left")
458 core.PuregoSafeRegister(&xRectGetBottomRight, libs, "graphene_rect_get_bottom_right")
459 core.PuregoSafeRegister(&xRectGetCenter, libs, "graphene_rect_get_center")
460 core.PuregoSafeRegister(&xRectGetHeight, libs, "graphene_rect_get_height")
461 core.PuregoSafeRegister(&xRectGetTopLeft, libs, "graphene_rect_get_top_left")
462 core.PuregoSafeRegister(&xRectGetTopRight, libs, "graphene_rect_get_top_right")
463 core.PuregoSafeRegister(&xRectGetVertices, libs, "graphene_rect_get_vertices")
464 core.PuregoSafeRegister(&xRectGetWidth, libs, "graphene_rect_get_width")
465 core.PuregoSafeRegister(&xRectGetX, libs, "graphene_rect_get_x")
466 core.PuregoSafeRegister(&xRectGetY, libs, "graphene_rect_get_y")
467 core.PuregoSafeRegister(&xRectInit, libs, "graphene_rect_init")
468 core.PuregoSafeRegister(&xRectInitFromRect, libs, "graphene_rect_init_from_rect")
469 core.PuregoSafeRegister(&xRectInset, libs, "graphene_rect_inset")
470 core.PuregoSafeRegister(&xRectInsetR, libs, "graphene_rect_inset_r")
471 core.PuregoSafeRegister(&xRectInterpolate, libs, "graphene_rect_interpolate")
472 core.PuregoSafeRegister(&xRectIntersection, libs, "graphene_rect_intersection")
473 core.PuregoSafeRegister(&xRectNormalize, libs, "graphene_rect_normalize")
474 core.PuregoSafeRegister(&xRectNormalizeR, libs, "graphene_rect_normalize_r")
475 core.PuregoSafeRegister(&xRectOffset, libs, "graphene_rect_offset")
476 core.PuregoSafeRegister(&xRectOffsetR, libs, "graphene_rect_offset_r")
477 core.PuregoSafeRegister(&xRectRound, libs, "graphene_rect_round")
478 core.PuregoSafeRegister(&xRectRoundExtents, libs, "graphene_rect_round_extents")
479 core.PuregoSafeRegister(&xRectRoundToPixel, libs, "graphene_rect_round_to_pixel")
480 core.PuregoSafeRegister(&xRectScale, libs, "graphene_rect_scale")
481 core.PuregoSafeRegister(&xRectUnion, libs, "graphene_rect_union")
482
483}