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/graphene"
12)
13
14// A rectangular region with rounded corners.
15//
16// Application code should normalize rectangles using
17// [method@Gsk.RoundedRect.normalize]; this function will ensure that
18// the bounds of the rectangle are normalized and ensure that the corner
19// values are positive and the corners do not overlap.
20//
21// All functions taking a `GskRoundedRect` as an argument will internally
22// operate on a normalized copy; all functions returning a `GskRoundedRect`
23// will always return a normalized one.
24//
25// The algorithm used for normalizing corner sizes is described in
26// [the CSS specification](https://drafts.csswg.org/css-backgrounds-3/#border-radius).
27type RoundedRect struct {
28 _ structs.HostLayout
29
30 Bounds uintptr
31
32 Corner [4]graphene.Size
33}
34
35func (x *RoundedRect) GoPointer() uintptr {
36 return uintptr(unsafe.Pointer(x))
37}
38
39var xRoundedRectContainsPoint func(uintptr, *graphene.Point) bool
40
41// Checks if the given point is inside the rounded rectangle.
42func (x *RoundedRect) ContainsPoint(PointVar *graphene.Point) bool {
43
44 cret := xRoundedRectContainsPoint(x.GoPointer(), PointVar)
45 return cret
46}
47
48var xRoundedRectContainsRect func(uintptr, *graphene.Rect) bool
49
50// Checks if the given rectangle is contained inside the rounded rectangle.
51func (x *RoundedRect) ContainsRect(RectVar *graphene.Rect) bool {
52
53 cret := xRoundedRectContainsRect(x.GoPointer(), RectVar)
54 return cret
55}
56
57var xRoundedRectInit func(uintptr, *graphene.Rect, *graphene.Size, *graphene.Size, *graphene.Size, *graphene.Size) *RoundedRect
58
59// Initializes a rounded rectangle with the given values.
60//
61// This function will implicitly normalize the rounded rectangle
62// before returning.
63func (x *RoundedRect) Init(BoundsVar *graphene.Rect, TopLeftVar *graphene.Size, TopRightVar *graphene.Size, BottomRightVar *graphene.Size, BottomLeftVar *graphene.Size) *RoundedRect {
64
65 cret := xRoundedRectInit(x.GoPointer(), BoundsVar, TopLeftVar, TopRightVar, BottomRightVar, BottomLeftVar)
66 return cret
67}
68
69var xRoundedRectInitCopy func(uintptr, *RoundedRect) *RoundedRect
70
71// Initializes a rounded rectangle with a copy.
72//
73// This function will not normalize the rounded rectangle,
74// so make sure the source is normalized.
75func (x *RoundedRect) InitCopy(SrcVar *RoundedRect) *RoundedRect {
76
77 cret := xRoundedRectInitCopy(x.GoPointer(), SrcVar)
78 return cret
79}
80
81var xRoundedRectInitFromRect func(uintptr, *graphene.Rect, float32) *RoundedRect
82
83// Initializes a rounded rectangle to the given bounds
84// and sets the radius of all four corners equally.
85func (x *RoundedRect) InitFromRect(BoundsVar *graphene.Rect, RadiusVar float32) *RoundedRect {
86
87 cret := xRoundedRectInitFromRect(x.GoPointer(), BoundsVar, RadiusVar)
88 return cret
89}
90
91var xRoundedRectIntersectsRect func(uintptr, *graphene.Rect) bool
92
93// Checks if part a rectangle is contained
94// inside the rounded rectangle.
95func (x *RoundedRect) IntersectsRect(RectVar *graphene.Rect) bool {
96
97 cret := xRoundedRectIntersectsRect(x.GoPointer(), RectVar)
98 return cret
99}
100
101var xRoundedRectIsRectilinear func(uintptr) bool
102
103// Checks if all corners of a rounded rectangle are right angles
104// and the rectangle covers all of its bounds.
105//
106// This information can be used to decide if [ctor@Gsk.ClipNode.new]
107// or [ctor@Gsk.RoundedClipNode.new] should be called.
108func (x *RoundedRect) IsRectilinear() bool {
109
110 cret := xRoundedRectIsRectilinear(x.GoPointer())
111 return cret
112}
113
114var xRoundedRectNormalize func(uintptr) *RoundedRect
115
116// Normalizes a rounded rectangle.
117//
118// This function will ensure that the bounds of the rounded rectangle
119// are normalized and ensure that the corner values are positive
120// and the corners do not overlap.
121func (x *RoundedRect) Normalize() *RoundedRect {
122
123 cret := xRoundedRectNormalize(x.GoPointer())
124 return cret
125}
126
127var xRoundedRectOffset func(uintptr, float32, float32) *RoundedRect
128
129// Offsets the rounded rectangle's origin by @dx and @dy.
130//
131// The size and corners of the rounded rectangle are unchanged.
132func (x *RoundedRect) Offset(DxVar float32, DyVar float32) *RoundedRect {
133
134 cret := xRoundedRectOffset(x.GoPointer(), DxVar, DyVar)
135 return cret
136}
137
138var xRoundedRectShrink func(uintptr, float32, float32, float32, float32) *RoundedRect
139
140// Shrinks (or grows) a rounded rectangle by moving the 4 sides
141// according to the offsets given.
142//
143// The corner radii will be changed in a way that tries to keep
144// the center of the corner circle intact. This emulates CSS behavior.
145//
146// This function also works for growing rounded rectangles
147// if you pass negative values for the @top, @right, @bottom or @left.
148func (x *RoundedRect) Shrink(TopVar float32, RightVar float32, BottomVar float32, LeftVar float32) *RoundedRect {
149
150 cret := xRoundedRectShrink(x.GoPointer(), TopVar, RightVar, BottomVar, LeftVar)
151 return cret
152}
153
154func init() {
155 core.SetPackageName("GSK", "gtk4")
156 core.SetSharedLibraries("GSK", []string{"libgtk-4.so.1"})
157 var libs []uintptr
158 for _, libPath := range core.GetPaths("GSK") {
159 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
160 if err != nil {
161 panic(err)
162 }
163 libs = append(libs, lib)
164 }
165
166 core.PuregoSafeRegister(&xRoundedRectContainsPoint, libs, "gsk_rounded_rect_contains_point")
167 core.PuregoSafeRegister(&xRoundedRectContainsRect, libs, "gsk_rounded_rect_contains_rect")
168 core.PuregoSafeRegister(&xRoundedRectInit, libs, "gsk_rounded_rect_init")
169 core.PuregoSafeRegister(&xRoundedRectInitCopy, libs, "gsk_rounded_rect_init_copy")
170 core.PuregoSafeRegister(&xRoundedRectInitFromRect, libs, "gsk_rounded_rect_init_from_rect")
171 core.PuregoSafeRegister(&xRoundedRectIntersectsRect, libs, "gsk_rounded_rect_intersects_rect")
172 core.PuregoSafeRegister(&xRoundedRectIsRectilinear, libs, "gsk_rounded_rect_is_rectilinear")
173 core.PuregoSafeRegister(&xRoundedRectNormalize, libs, "gsk_rounded_rect_normalize")
174 core.PuregoSafeRegister(&xRoundedRectOffset, libs, "gsk_rounded_rect_offset")
175 core.PuregoSafeRegister(&xRoundedRectShrink, libs, "gsk_rounded_rect_shrink")
176
177}