1// Package gdk was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gdk
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/glib"
12 "github.com/bnema/puregotk/v4/gobject"
13 "github.com/bnema/puregotk/v4/gobject/types"
14)
15
16type CicpParamsClass struct {
17 _ structs.HostLayout
18}
19
20func (x *CicpParamsClass) GoPointer() uintptr {
21 return uintptr(unsafe.Pointer(x))
22}
23
24// The values of this enumeration describe whether image data uses
25// the full range of 8-bit values.
26//
27// In digital broadcasting, it is common to reserve the lowest and
28// highest values. Typically the allowed values for the narrow range
29// are 16-235 for Y and 16-240 for u,v (when dealing with YUV data).
30type CicpRange int
31
32var xCicpRangeGLibType func() types.GType
33
34func CicpRangeGLibType() types.GType {
35 return xCicpRangeGLibType()
36}
37
38const (
39
40 // The values use the range of 16-235 (for Y) and 16-240 for u and v.
41 CicpRangeNarrowValue CicpRange = 0
42 // The values use the full range.
43 CicpRangeFullValue CicpRange = 1
44)
45
46// Contains the parameters that define a colorstate with cicp parameters.
47//
48// Cicp parameters are specified in the ITU-T H.273
49// [specification](https://www.itu.int/rec/T-REC-H.273/en).
50//
51// See the documentation of individual properties for supported values.
52//
53// The 'unspecified' value (2) is not treated in any special way, and
54// must be replaced by a different value before creating a color state.
55//
56// `GdkCicpParams` can be used as a builder object to construct a color
57// state from Cicp data with [method@Gdk.CicpParams.build_color_state].
58// The function will return an error if the given parameters are not
59// supported.
60//
61// You can obtain a `GdkCicpParams` object from a color state with
62// [method@Gdk.ColorState.create_cicp_params]. This can be used to
63// create a variant of a color state, by changing just one of the cicp
64// parameters, or just to obtain information about the color state.
65type CicpParams struct {
66 gobject.Object
67}
68
69var xCicpParamsGLibType func() types.GType
70
71func CicpParamsGLibType() types.GType {
72 return xCicpParamsGLibType()
73}
74
75func CicpParamsNewFromInternalPtr(ptr uintptr) *CicpParams {
76 cls := &CicpParams{}
77 cls.Ptr = ptr
78 return cls
79}
80
81var xNewCicpParams func() uintptr
82
83// Creates a new `GdkCicpParams` object.
84//
85// The initial values of the properties are the values for "undefined"
86// and need to be set before a color state object can be built.
87func NewCicpParams() *CicpParams {
88 var cls *CicpParams
89
90 cret := xNewCicpParams()
91
92 if cret == 0 {
93 return nil
94 }
95 cls = &CicpParams{}
96 cls.Ptr = cret
97 return cls
98}
99
100var xCicpParamsBuildColorState func(uintptr) *ColorState
101
102// Creates a new `GdkColorState` object for the cicp parameters in @self.
103//
104// Note that this may fail if the cicp parameters in @self are not
105// supported by GTK. In that case, `NULL` is returned, and @error is set
106// with an error message that can be presented to the user.
107func (x *CicpParams) BuildColorState() (*ColorState, error) {
108 var cerr *glib.Error
109
110 cret := xCicpParamsBuildColorState(x.GoPointer())
111 if cerr == nil {
112 return cret, nil
113 }
114 return cret, cerr
115
116}
117
118var xCicpParamsGetColorPrimaries func(uintptr) uint
119
120// Returns the value of the color-primaries property
121// of @self.
122func (x *CicpParams) GetColorPrimaries() uint {
123
124 cret := xCicpParamsGetColorPrimaries(x.GoPointer())
125 return cret
126}
127
128var xCicpParamsGetMatrixCoefficients func(uintptr) uint
129
130// Gets the matrix-coefficients property of @self.
131func (x *CicpParams) GetMatrixCoefficients() uint {
132
133 cret := xCicpParamsGetMatrixCoefficients(x.GoPointer())
134 return cret
135}
136
137var xCicpParamsGetRange func(uintptr) CicpRange
138
139// Gets the range property of @self.
140func (x *CicpParams) GetRange() CicpRange {
141
142 cret := xCicpParamsGetRange(x.GoPointer())
143 return cret
144}
145
146var xCicpParamsGetTransferFunction func(uintptr) uint
147
148// Gets the transfer-function property of @self.
149func (x *CicpParams) GetTransferFunction() uint {
150
151 cret := xCicpParamsGetTransferFunction(x.GoPointer())
152 return cret
153}
154
155var xCicpParamsSetColorPrimaries func(uintptr, uint)
156
157// Sets the color-primaries property of @self.
158func (x *CicpParams) SetColorPrimaries(ColorPrimariesVar uint) {
159
160 xCicpParamsSetColorPrimaries(x.GoPointer(), ColorPrimariesVar)
161
162}
163
164var xCicpParamsSetMatrixCoefficients func(uintptr, uint)
165
166// @self a `GdkCicpParams`
167// Sets the matrix-coefficients property of @self.
168func (x *CicpParams) SetMatrixCoefficients(MatrixCoefficientsVar uint) {
169
170 xCicpParamsSetMatrixCoefficients(x.GoPointer(), MatrixCoefficientsVar)
171
172}
173
174var xCicpParamsSetRange func(uintptr, CicpRange)
175
176// Sets the range property of @self
177func (x *CicpParams) SetRange(RangeVar CicpRange) {
178
179 xCicpParamsSetRange(x.GoPointer(), RangeVar)
180
181}
182
183var xCicpParamsSetTransferFunction func(uintptr, uint)
184
185// Sets the transfer-function property of @self.
186func (x *CicpParams) SetTransferFunction(TransferFunctionVar uint) {
187
188 xCicpParamsSetTransferFunction(x.GoPointer(), TransferFunctionVar)
189
190}
191
192func (c *CicpParams) GoPointer() uintptr {
193 if c == nil {
194 return 0
195 }
196 return c.Ptr
197}
198
199func (c *CicpParams) SetGoPointer(ptr uintptr) {
200 c.Ptr = ptr
201}
202
203// SetPropertyColorPrimaries sets the "color-primaries" property.
204// The color primaries to use.
205//
206// Supported values:
207//
208// - 1: BT.709 / sRGB
209// - 2: unspecified
210// - 5: PAL
211// - 6,7: BT.601 / NTSC
212// - 9: BT.2020
213// - 12: Display P3
214func (x *CicpParams) SetPropertyColorPrimaries(value uint) {
215 var v gobject.Value
216 v.Init(gobject.TypeUintVal)
217 v.SetUint(value)
218 x.SetProperty("color-primaries", &v)
219}
220
221// GetPropertyColorPrimaries gets the "color-primaries" property.
222// The color primaries to use.
223//
224// Supported values:
225//
226// - 1: BT.709 / sRGB
227// - 2: unspecified
228// - 5: PAL
229// - 6,7: BT.601 / NTSC
230// - 9: BT.2020
231// - 12: Display P3
232func (x *CicpParams) GetPropertyColorPrimaries() uint {
233 var v gobject.Value
234 x.GetProperty("color-primaries", &v)
235 return v.GetUint()
236}
237
238// SetPropertyMatrixCoefficients sets the "matrix-coefficients" property.
239// The matrix coefficients (for YUV to RGB conversion).
240//
241// Supported values:
242//
243// - 0: RGB
244// - 1: BT.709
245// - 2: unspecified
246// - 5,6: BT.601
247// - 9: BT.2020
248func (x *CicpParams) SetPropertyMatrixCoefficients(value uint) {
249 var v gobject.Value
250 v.Init(gobject.TypeUintVal)
251 v.SetUint(value)
252 x.SetProperty("matrix-coefficients", &v)
253}
254
255// GetPropertyMatrixCoefficients gets the "matrix-coefficients" property.
256// The matrix coefficients (for YUV to RGB conversion).
257//
258// Supported values:
259//
260// - 0: RGB
261// - 1: BT.709
262// - 2: unspecified
263// - 5,6: BT.601
264// - 9: BT.2020
265func (x *CicpParams) GetPropertyMatrixCoefficients() uint {
266 var v gobject.Value
267 x.GetProperty("matrix-coefficients", &v)
268 return v.GetUint()
269}
270
271// SetPropertyTransferFunction sets the "transfer-function" property.
272// The transfer function to use.
273//
274// Supported values:
275//
276// - 1,6,14,15: BT.709, BT.601, BT.2020
277// - 2: unspecified
278// - 4: gamma 2.2
279// - 5: gamma 2.8
280// - 8: linear
281// - 13: sRGB
282// - 16: BT.2100 PQ
283// - 18: BT.2100 HLG
284func (x *CicpParams) SetPropertyTransferFunction(value uint) {
285 var v gobject.Value
286 v.Init(gobject.TypeUintVal)
287 v.SetUint(value)
288 x.SetProperty("transfer-function", &v)
289}
290
291// GetPropertyTransferFunction gets the "transfer-function" property.
292// The transfer function to use.
293//
294// Supported values:
295//
296// - 1,6,14,15: BT.709, BT.601, BT.2020
297// - 2: unspecified
298// - 4: gamma 2.2
299// - 5: gamma 2.8
300// - 8: linear
301// - 13: sRGB
302// - 16: BT.2100 PQ
303// - 18: BT.2100 HLG
304func (x *CicpParams) GetPropertyTransferFunction() uint {
305 var v gobject.Value
306 x.GetProperty("transfer-function", &v)
307 return v.GetUint()
308}
309
310func init() {
311 core.SetPackageName("GDK", "gtk4")
312 core.SetSharedLibraries("GDK", []string{"libgtk-4.so.1"})
313 var libs []uintptr
314 for _, libPath := range core.GetPaths("GDK") {
315 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
316 if err != nil {
317 panic(err)
318 }
319 libs = append(libs, lib)
320 }
321
322 core.PuregoSafeRegister(&xCicpRangeGLibType, libs, "gdk_cicp_range_get_type")
323
324 core.PuregoSafeRegister(&xCicpParamsGLibType, libs, "gdk_cicp_params_get_type")
325
326 core.PuregoSafeRegister(&xNewCicpParams, libs, "gdk_cicp_params_new")
327
328 core.PuregoSafeRegister(&xCicpParamsBuildColorState, libs, "gdk_cicp_params_build_color_state")
329 core.PuregoSafeRegister(&xCicpParamsGetColorPrimaries, libs, "gdk_cicp_params_get_color_primaries")
330 core.PuregoSafeRegister(&xCicpParamsGetMatrixCoefficients, libs, "gdk_cicp_params_get_matrix_coefficients")
331 core.PuregoSafeRegister(&xCicpParamsGetRange, libs, "gdk_cicp_params_get_range")
332 core.PuregoSafeRegister(&xCicpParamsGetTransferFunction, libs, "gdk_cicp_params_get_transfer_function")
333 core.PuregoSafeRegister(&xCicpParamsSetColorPrimaries, libs, "gdk_cicp_params_set_color_primaries")
334 core.PuregoSafeRegister(&xCicpParamsSetMatrixCoefficients, libs, "gdk_cicp_params_set_matrix_coefficients")
335 core.PuregoSafeRegister(&xCicpParamsSetRange, libs, "gdk_cicp_params_set_range")
336 core.PuregoSafeRegister(&xCicpParamsSetTransferFunction, libs, "gdk_cicp_params_set_transfer_function")
337
338}