colorrepresentation_generated.go RawHistoryFolder
1// Code generated by wlbgen; DO NOT EDIT.
2
3// Upstream protocol copyright and license:
4// Copyright 2022 Simon Ser
5// Copyright 2022 Red Hat, Inc.
6// Copyright 2022 Collabora, Ltd.
7// Copyright 2022-2025 Red Hat, Inc.
8//
9// Permission is hereby granted, free of charge, to any person obtaining a
10// copy of this software and associated documentation files (the "Software"),
11// to deal in the Software without restriction, including without limitation
12// the rights to use, copy, modify, merge, publish, distribute, sublicense,
13// and/or sell copies of the Software, and to permit persons to whom the
14// Software is furnished to do so, subject to the following conditions:
15//
16// The above copyright notice and this permission notice (including the next
17// paragraph) shall be included in all copies or substantial portions of the
18// Software.
19//
20// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26// DEALINGS IN THE SOFTWARE.
27
28package colorrepresentation
29
30import (
31 "fmt"
32 wayland "github.com/bnema/go-wayland-bindings/server/wayland"
33 "github.com/bnema/purego-libwayland/server"
34)
35
36var WpColorRepresentationManagerV1Interface *server.Interface
37var WpColorRepresentationSurfaceV1Interface *server.Interface
38
39func init() {
40 WpColorRepresentationManagerV1Interface = &server.Interface{Name: "wp_color_representation_manager_v1", Version: 1}
41 WpColorRepresentationSurfaceV1Interface = &server.Interface{Name: "wp_color_representation_surface_v1", Version: 1}
42 WpColorRepresentationManagerV1Interface.Requests = []server.Message{
43 {Name: "destroy", Signature: "", Types: []*server.Interface{}},
44 {Name: "get_surface", Signature: "no", Types: []*server.Interface{WpColorRepresentationSurfaceV1Interface, wayland.SurfaceInterface}},
45 }
46 WpColorRepresentationManagerV1Interface.Events = []server.Message{
47 {Name: "supported_alpha_mode", Signature: "u", Types: []*server.Interface{nil}},
48 {Name: "supported_coefficients_and_ranges", Signature: "uu", Types: []*server.Interface{nil, nil}},
49 {Name: "done", Signature: "", Types: []*server.Interface{}},
50 }
51 WpColorRepresentationSurfaceV1Interface.Requests = []server.Message{
52 {Name: "destroy", Signature: "", Types: []*server.Interface{}},
53 {Name: "set_alpha_mode", Signature: "u", Types: []*server.Interface{nil}},
54 {Name: "set_coefficients_and_range", Signature: "uu", Types: []*server.Interface{nil, nil}},
55 {Name: "set_chroma_location", Signature: "u", Types: []*server.Interface{nil}},
56 }
57 WpColorRepresentationSurfaceV1Interface.Events = []server.Message{}
58 if err := server.NewInterfaces(WpColorRepresentationManagerV1Interface, WpColorRepresentationSurfaceV1Interface); err != nil {
59 panic(err)
60 }
61}
62
63// WpColorRepresentationManagerV1 color representation manager singleton.
64type WpColorRepresentationManagerV1 struct{ *server.Resource }
65
66func WrapWpColorRepresentationManagerV1(r *server.Resource) *WpColorRepresentationManagerV1 {
67 if r == nil {
68 return nil
69 }
70 return &WpColorRepresentationManagerV1{r}
71}
72
73const WpColorRepresentationManagerV1RequestDestroy uint32 = 0
74const WpColorRepresentationManagerV1RequestGetSurface uint32 = 1
75const WpColorRepresentationManagerV1EventSupportedAlphaMode uint32 = 0
76const WpColorRepresentationManagerV1EventSupportedCoefficientsAndRanges uint32 = 1
77const WpColorRepresentationManagerV1EventDone uint32 = 2
78
79// WpColorRepresentationManagerV1Error protocol errors.
80type WpColorRepresentationManagerV1Error uint32
81
82const (
83 WpColorRepresentationManagerV1ErrorSurfaceExists WpColorRepresentationManagerV1Error = 1
84)
85
86// WpColorRepresentationManagerV1Handler handles wp_color_representation_manager_v1 requests.
87type WpColorRepresentationManagerV1Handler interface {
88 Destroy(self *WpColorRepresentationManagerV1)
89 GetSurface(self *WpColorRepresentationManagerV1, id uint32, surface *wayland.Surface)
90}
91
92func NewWpColorRepresentationManagerV1(c server.Client, version int32, id uint32, h WpColorRepresentationManagerV1Handler) (*WpColorRepresentationManagerV1, error) {
93 if h == nil {
94 return nil, fmt.Errorf("purego-libwayland: nil handler for wp_color_representation_manager_v1")
95 }
96 var self *WpColorRepresentationManagerV1
97 r, err := c.CreateResource(WpColorRepresentationManagerV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
98 switch opcode {
99 case 0:
100 h.Destroy(self)
101 self.Destroy()
102 case 1:
103 h.GetSurface(self, args[0].NewID(), wayland.WrapSurface(args[1].Resource()))
104 }
105 })
106 if err != nil {
107 return nil, err
108 }
109 self = WrapWpColorRepresentationManagerV1(r)
110 r.Data = self
111 return self, nil
112}
113
114// SendSupportedAlphaMode supported alpha modes.
115func (self *WpColorRepresentationManagerV1) SendSupportedAlphaMode(alphaMode uint32) {
116 self.PostEvent(WpColorRepresentationManagerV1EventSupportedAlphaMode, server.Uint(alphaMode))
117}
118
119// SendSupportedCoefficientsAndRanges supported matrix coefficients and ranges.
120func (self *WpColorRepresentationManagerV1) SendSupportedCoefficientsAndRanges(coefficients uint32, rangeArg uint32) {
121 self.PostEvent(WpColorRepresentationManagerV1EventSupportedCoefficientsAndRanges, server.Uint(coefficients), server.Uint(rangeArg))
122}
123
124// SendDone all features have been sent.
125func (self *WpColorRepresentationManagerV1) SendDone() {
126 self.PostEvent(WpColorRepresentationManagerV1EventDone)
127}
128func NewWpColorRepresentationManagerV1Global(d *server.Display, version int32, bind server.BindFunc) error {
129 return d.CreateGlobal(WpColorRepresentationManagerV1Interface, version, bind)
130}
131
132// WpColorRepresentationSurfaceV1 color representation extension to a surface.
133type WpColorRepresentationSurfaceV1 struct{ *server.Resource }
134
135func WrapWpColorRepresentationSurfaceV1(r *server.Resource) *WpColorRepresentationSurfaceV1 {
136 if r == nil {
137 return nil
138 }
139 return &WpColorRepresentationSurfaceV1{r}
140}
141
142const WpColorRepresentationSurfaceV1RequestDestroy uint32 = 0
143const WpColorRepresentationSurfaceV1RequestSetAlphaMode uint32 = 1
144const WpColorRepresentationSurfaceV1RequestSetCoefficientsAndRange uint32 = 2
145const WpColorRepresentationSurfaceV1RequestSetChromaLocation uint32 = 3
146
147// WpColorRepresentationSurfaceV1Error protocol errors.
148type WpColorRepresentationSurfaceV1Error uint32
149
150const (
151 WpColorRepresentationSurfaceV1ErrorAlphaMode WpColorRepresentationSurfaceV1Error = 1
152 WpColorRepresentationSurfaceV1ErrorCoefficients WpColorRepresentationSurfaceV1Error = 2
153 WpColorRepresentationSurfaceV1ErrorPixelFormat WpColorRepresentationSurfaceV1Error = 3
154 WpColorRepresentationSurfaceV1ErrorInert WpColorRepresentationSurfaceV1Error = 4
155 WpColorRepresentationSurfaceV1ErrorChromaLocation WpColorRepresentationSurfaceV1Error = 5
156)
157
158// WpColorRepresentationSurfaceV1AlphaMode alpha mode.
159type WpColorRepresentationSurfaceV1AlphaMode uint32
160
161const (
162 WpColorRepresentationSurfaceV1AlphaModePremultipliedElectrical WpColorRepresentationSurfaceV1AlphaMode = 0
163 WpColorRepresentationSurfaceV1AlphaModePremultipliedOptical WpColorRepresentationSurfaceV1AlphaMode = 1
164 WpColorRepresentationSurfaceV1AlphaModeStraight WpColorRepresentationSurfaceV1AlphaMode = 2
165)
166
167// WpColorRepresentationSurfaceV1Coefficients named coefficients.
168type WpColorRepresentationSurfaceV1Coefficients uint32
169
170const (
171 WpColorRepresentationSurfaceV1CoefficientsIdentity WpColorRepresentationSurfaceV1Coefficients = 1
172 WpColorRepresentationSurfaceV1CoefficientsBt709 WpColorRepresentationSurfaceV1Coefficients = 2
173 WpColorRepresentationSurfaceV1CoefficientsFcc WpColorRepresentationSurfaceV1Coefficients = 3
174 WpColorRepresentationSurfaceV1CoefficientsBt601 WpColorRepresentationSurfaceV1Coefficients = 4
175 WpColorRepresentationSurfaceV1CoefficientsSmpte240 WpColorRepresentationSurfaceV1Coefficients = 5
176 WpColorRepresentationSurfaceV1CoefficientsBt2020 WpColorRepresentationSurfaceV1Coefficients = 6
177 WpColorRepresentationSurfaceV1CoefficientsBt2020Cl WpColorRepresentationSurfaceV1Coefficients = 7
178 WpColorRepresentationSurfaceV1CoefficientsIctcp WpColorRepresentationSurfaceV1Coefficients = 8
179)
180
181// WpColorRepresentationSurfaceV1Range Color range values.
182type WpColorRepresentationSurfaceV1Range uint32
183
184const (
185 WpColorRepresentationSurfaceV1RangeFull WpColorRepresentationSurfaceV1Range = 1
186 WpColorRepresentationSurfaceV1RangeLimited WpColorRepresentationSurfaceV1Range = 2
187)
188
189// WpColorRepresentationSurfaceV1ChromaLocation Chroma sample location for 4:2:0 YCbCr.
190type WpColorRepresentationSurfaceV1ChromaLocation uint32
191
192const (
193 WpColorRepresentationSurfaceV1ChromaLocationType0 WpColorRepresentationSurfaceV1ChromaLocation = 1
194 WpColorRepresentationSurfaceV1ChromaLocationType1 WpColorRepresentationSurfaceV1ChromaLocation = 2
195 WpColorRepresentationSurfaceV1ChromaLocationType2 WpColorRepresentationSurfaceV1ChromaLocation = 3
196 WpColorRepresentationSurfaceV1ChromaLocationType3 WpColorRepresentationSurfaceV1ChromaLocation = 4
197 WpColorRepresentationSurfaceV1ChromaLocationType4 WpColorRepresentationSurfaceV1ChromaLocation = 5
198 WpColorRepresentationSurfaceV1ChromaLocationType5 WpColorRepresentationSurfaceV1ChromaLocation = 6
199)
200
201// WpColorRepresentationSurfaceV1Handler handles wp_color_representation_surface_v1 requests.
202type WpColorRepresentationSurfaceV1Handler interface {
203 Destroy(self *WpColorRepresentationSurfaceV1)
204 SetAlphaMode(self *WpColorRepresentationSurfaceV1, alphaMode uint32)
205 SetCoefficientsAndRange(self *WpColorRepresentationSurfaceV1, coefficients uint32, rangeArg uint32)
206 SetChromaLocation(self *WpColorRepresentationSurfaceV1, chromaLocation uint32)
207}
208
209func NewWpColorRepresentationSurfaceV1(c server.Client, version int32, id uint32, h WpColorRepresentationSurfaceV1Handler) (*WpColorRepresentationSurfaceV1, error) {
210 if h == nil {
211 return nil, fmt.Errorf("purego-libwayland: nil handler for wp_color_representation_surface_v1")
212 }
213 var self *WpColorRepresentationSurfaceV1
214 r, err := c.CreateResource(WpColorRepresentationSurfaceV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
215 switch opcode {
216 case 0:
217 h.Destroy(self)
218 self.Destroy()
219 case 1:
220 h.SetAlphaMode(self, args[0].Uint())
221 case 2:
222 h.SetCoefficientsAndRange(self, args[0].Uint(), args[1].Uint())
223 case 3:
224 h.SetChromaLocation(self, args[0].Uint())
225 }
226 })
227 if err != nil {
228 return nil, err
229 }
230 self = WrapWpColorRepresentationSurfaceV1(r)
231 r.Data = self
232 return self, nil
233}
234func NewWpColorRepresentationSurfaceV1Global(d *server.Display, version int32, bind server.BindFunc) error {
235 return d.CreateGlobal(WpColorRepresentationSurfaceV1Interface, version, bind)
236}
237func resourceOf(v interface{ GetResource() *server.Resource }) *server.Resource {
238 if v == nil {
239 return nil
240 }
241 return v.GetResource()
242}
243func (self *WpColorRepresentationManagerV1) GetResource() *server.Resource {
244 if self == nil {
245 return nil
246 }
247 return self.Resource
248}
249func (self *WpColorRepresentationSurfaceV1) GetResource() *server.Resource {
250 if self == nil {
251 return nil
252 }
253 return self.Resource
254}