1// Code generated by wlgen; DO NOT EDIT.
2package colorrepresentation
3
4import (
5 "fmt"
6 wayland "github.com/bnema/purego-libwayland/protocol/wayland"
7 "github.com/bnema/purego-libwayland/server"
8)
9
10var WpColorRepresentationManagerV1Interface *server.Interface
11var WpColorRepresentationSurfaceV1Interface *server.Interface
12
13func init() {
14 WpColorRepresentationManagerV1Interface = &server.Interface{Name: "wp_color_representation_manager_v1", Version: 1}
15 WpColorRepresentationSurfaceV1Interface = &server.Interface{Name: "wp_color_representation_surface_v1", Version: 1}
16 WpColorRepresentationManagerV1Interface.Requests = []server.Message{
17 {Name: "destroy", Signature: "", Types: []*server.Interface{}},
18 {Name: "get_surface", Signature: "no", Types: []*server.Interface{WpColorRepresentationSurfaceV1Interface, wayland.SurfaceInterface}},
19 }
20 WpColorRepresentationManagerV1Interface.Events = []server.Message{
21 {Name: "supported_alpha_mode", Signature: "u", Types: []*server.Interface{nil}},
22 {Name: "supported_coefficients_and_ranges", Signature: "uu", Types: []*server.Interface{nil, nil}},
23 {Name: "done", Signature: "", Types: []*server.Interface{}},
24 }
25 WpColorRepresentationSurfaceV1Interface.Requests = []server.Message{
26 {Name: "destroy", Signature: "", Types: []*server.Interface{}},
27 {Name: "set_alpha_mode", Signature: "u", Types: []*server.Interface{nil}},
28 {Name: "set_coefficients_and_range", Signature: "uu", Types: []*server.Interface{nil, nil}},
29 {Name: "set_chroma_location", Signature: "u", Types: []*server.Interface{nil}},
30 }
31 WpColorRepresentationSurfaceV1Interface.Events = []server.Message{}
32 if err := server.NewInterfaces(WpColorRepresentationManagerV1Interface, WpColorRepresentationSurfaceV1Interface); err != nil {
33 panic(err)
34 }
35}
36
37// WpColorRepresentationManagerV1 color representation manager singleton.
38type WpColorRepresentationManagerV1 struct{ *server.Resource }
39
40func WrapWpColorRepresentationManagerV1(r *server.Resource) *WpColorRepresentationManagerV1 {
41 if r == nil {
42 return nil
43 }
44 return &WpColorRepresentationManagerV1{r}
45}
46
47const WpColorRepresentationManagerV1RequestDestroy uint32 = 0
48const WpColorRepresentationManagerV1RequestGetSurface uint32 = 1
49const WpColorRepresentationManagerV1EventSupportedAlphaMode uint32 = 0
50const WpColorRepresentationManagerV1EventSupportedCoefficientsAndRanges uint32 = 1
51const WpColorRepresentationManagerV1EventDone uint32 = 2
52
53// WpColorRepresentationManagerV1Error protocol errors.
54type WpColorRepresentationManagerV1Error uint32
55
56const (
57 WpColorRepresentationManagerV1ErrorSurfaceExists WpColorRepresentationManagerV1Error = 1
58)
59
60// WpColorRepresentationManagerV1Handler handles wp_color_representation_manager_v1 requests.
61type WpColorRepresentationManagerV1Handler interface {
62 Destroy(self *WpColorRepresentationManagerV1)
63 GetSurface(self *WpColorRepresentationManagerV1, id uint32, surface *wayland.Surface)
64}
65
66func NewWpColorRepresentationManagerV1(c server.Client, version int32, id uint32, h WpColorRepresentationManagerV1Handler) (*WpColorRepresentationManagerV1, error) {
67 if h == nil {
68 return nil, fmt.Errorf("purego-libwayland: nil handler for wp_color_representation_manager_v1")
69 }
70 var self *WpColorRepresentationManagerV1
71 r, err := c.CreateResource(WpColorRepresentationManagerV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
72 switch opcode {
73 case 0:
74 h.Destroy(self)
75 self.Destroy()
76 case 1:
77 h.GetSurface(self, args[0].NewID(), wayland.WrapSurface(args[1].Resource()))
78 }
79 })
80 if err != nil {
81 return nil, err
82 }
83 self = WrapWpColorRepresentationManagerV1(r)
84 r.Data = self
85 return self, nil
86}
87
88// SendSupportedAlphaMode supported alpha modes.
89func (self *WpColorRepresentationManagerV1) SendSupportedAlphaMode(alphaMode uint32) {
90 self.PostEvent(WpColorRepresentationManagerV1EventSupportedAlphaMode, server.Uint(alphaMode))
91}
92
93// SendSupportedCoefficientsAndRanges supported matrix coefficients and ranges.
94func (self *WpColorRepresentationManagerV1) SendSupportedCoefficientsAndRanges(coefficients uint32, rangeArg uint32) {
95 self.PostEvent(WpColorRepresentationManagerV1EventSupportedCoefficientsAndRanges, server.Uint(coefficients), server.Uint(rangeArg))
96}
97
98// SendDone all features have been sent.
99func (self *WpColorRepresentationManagerV1) SendDone() {
100 self.PostEvent(WpColorRepresentationManagerV1EventDone)
101}
102func NewWpColorRepresentationManagerV1Global(d *server.Display, version int32, bind server.BindFunc) error {
103 return d.CreateGlobal(WpColorRepresentationManagerV1Interface, version, bind)
104}
105
106// WpColorRepresentationSurfaceV1 color representation extension to a surface.
107type WpColorRepresentationSurfaceV1 struct{ *server.Resource }
108
109func WrapWpColorRepresentationSurfaceV1(r *server.Resource) *WpColorRepresentationSurfaceV1 {
110 if r == nil {
111 return nil
112 }
113 return &WpColorRepresentationSurfaceV1{r}
114}
115
116const WpColorRepresentationSurfaceV1RequestDestroy uint32 = 0
117const WpColorRepresentationSurfaceV1RequestSetAlphaMode uint32 = 1
118const WpColorRepresentationSurfaceV1RequestSetCoefficientsAndRange uint32 = 2
119const WpColorRepresentationSurfaceV1RequestSetChromaLocation uint32 = 3
120
121// WpColorRepresentationSurfaceV1Error protocol errors.
122type WpColorRepresentationSurfaceV1Error uint32
123
124const (
125 WpColorRepresentationSurfaceV1ErrorAlphaMode WpColorRepresentationSurfaceV1Error = 1
126 WpColorRepresentationSurfaceV1ErrorCoefficients WpColorRepresentationSurfaceV1Error = 2
127 WpColorRepresentationSurfaceV1ErrorPixelFormat WpColorRepresentationSurfaceV1Error = 3
128 WpColorRepresentationSurfaceV1ErrorInert WpColorRepresentationSurfaceV1Error = 4
129 WpColorRepresentationSurfaceV1ErrorChromaLocation WpColorRepresentationSurfaceV1Error = 5
130)
131
132// WpColorRepresentationSurfaceV1AlphaMode alpha mode.
133type WpColorRepresentationSurfaceV1AlphaMode uint32
134
135const (
136 WpColorRepresentationSurfaceV1AlphaModePremultipliedElectrical WpColorRepresentationSurfaceV1AlphaMode = 0
137 WpColorRepresentationSurfaceV1AlphaModePremultipliedOptical WpColorRepresentationSurfaceV1AlphaMode = 1
138 WpColorRepresentationSurfaceV1AlphaModeStraight WpColorRepresentationSurfaceV1AlphaMode = 2
139)
140
141// WpColorRepresentationSurfaceV1Coefficients named coefficients.
142type WpColorRepresentationSurfaceV1Coefficients uint32
143
144const (
145 WpColorRepresentationSurfaceV1CoefficientsIdentity WpColorRepresentationSurfaceV1Coefficients = 1
146 WpColorRepresentationSurfaceV1CoefficientsBt709 WpColorRepresentationSurfaceV1Coefficients = 2
147 WpColorRepresentationSurfaceV1CoefficientsFcc WpColorRepresentationSurfaceV1Coefficients = 3
148 WpColorRepresentationSurfaceV1CoefficientsBt601 WpColorRepresentationSurfaceV1Coefficients = 4
149 WpColorRepresentationSurfaceV1CoefficientsSmpte240 WpColorRepresentationSurfaceV1Coefficients = 5
150 WpColorRepresentationSurfaceV1CoefficientsBt2020 WpColorRepresentationSurfaceV1Coefficients = 6
151 WpColorRepresentationSurfaceV1CoefficientsBt2020Cl WpColorRepresentationSurfaceV1Coefficients = 7
152 WpColorRepresentationSurfaceV1CoefficientsIctcp WpColorRepresentationSurfaceV1Coefficients = 8
153)
154
155// WpColorRepresentationSurfaceV1Range Color range values.
156type WpColorRepresentationSurfaceV1Range uint32
157
158const (
159 WpColorRepresentationSurfaceV1RangeFull WpColorRepresentationSurfaceV1Range = 1
160 WpColorRepresentationSurfaceV1RangeLimited WpColorRepresentationSurfaceV1Range = 2
161)
162
163// WpColorRepresentationSurfaceV1ChromaLocation Chroma sample location for 4:2:0 YCbCr.
164type WpColorRepresentationSurfaceV1ChromaLocation uint32
165
166const (
167 WpColorRepresentationSurfaceV1ChromaLocationType0 WpColorRepresentationSurfaceV1ChromaLocation = 1
168 WpColorRepresentationSurfaceV1ChromaLocationType1 WpColorRepresentationSurfaceV1ChromaLocation = 2
169 WpColorRepresentationSurfaceV1ChromaLocationType2 WpColorRepresentationSurfaceV1ChromaLocation = 3
170 WpColorRepresentationSurfaceV1ChromaLocationType3 WpColorRepresentationSurfaceV1ChromaLocation = 4
171 WpColorRepresentationSurfaceV1ChromaLocationType4 WpColorRepresentationSurfaceV1ChromaLocation = 5
172 WpColorRepresentationSurfaceV1ChromaLocationType5 WpColorRepresentationSurfaceV1ChromaLocation = 6
173)
174
175// WpColorRepresentationSurfaceV1Handler handles wp_color_representation_surface_v1 requests.
176type WpColorRepresentationSurfaceV1Handler interface {
177 Destroy(self *WpColorRepresentationSurfaceV1)
178 SetAlphaMode(self *WpColorRepresentationSurfaceV1, alphaMode uint32)
179 SetCoefficientsAndRange(self *WpColorRepresentationSurfaceV1, coefficients uint32, rangeArg uint32)
180 SetChromaLocation(self *WpColorRepresentationSurfaceV1, chromaLocation uint32)
181}
182
183func NewWpColorRepresentationSurfaceV1(c server.Client, version int32, id uint32, h WpColorRepresentationSurfaceV1Handler) (*WpColorRepresentationSurfaceV1, error) {
184 if h == nil {
185 return nil, fmt.Errorf("purego-libwayland: nil handler for wp_color_representation_surface_v1")
186 }
187 var self *WpColorRepresentationSurfaceV1
188 r, err := c.CreateResource(WpColorRepresentationSurfaceV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
189 switch opcode {
190 case 0:
191 h.Destroy(self)
192 self.Destroy()
193 case 1:
194 h.SetAlphaMode(self, args[0].Uint())
195 case 2:
196 h.SetCoefficientsAndRange(self, args[0].Uint(), args[1].Uint())
197 case 3:
198 h.SetChromaLocation(self, args[0].Uint())
199 }
200 })
201 if err != nil {
202 return nil, err
203 }
204 self = WrapWpColorRepresentationSurfaceV1(r)
205 r.Data = self
206 return self, nil
207}
208func NewWpColorRepresentationSurfaceV1Global(d *server.Display, version int32, bind server.BindFunc) error {
209 return d.CreateGlobal(WpColorRepresentationSurfaceV1Interface, version, bind)
210}
211func resourceOf(v interface{ GetResource() *server.Resource }) *server.Resource {
212 if v == nil {
213 return nil
214 }
215 return v.GetResource()
216}
217func (self *WpColorRepresentationManagerV1) GetResource() *server.Resource {
218 if self == nil {
219 return nil
220 }
221 return self.Resource
222}
223func (self *WpColorRepresentationSurfaceV1) GetResource() *server.Resource {
224 if self == nil {
225 return nil
226 }
227 return self.Resource
228}