OLD | NEW |
| (Empty) |
1 <?xml version="1.0" encoding="UTF-8"?> | |
2 <protocol name="scaler"> | |
3 | |
4 <copyright> | |
5 Copyright © 2013-2014 Collabora, Ltd. | |
6 | |
7 Permission is hereby granted, free of charge, to any person obtaining a | |
8 copy of this software and associated documentation files (the "Software"), | |
9 to deal in the Software without restriction, including without limitation | |
10 the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
11 and/or sell copies of the Software, and to permit persons to whom the | |
12 Software is furnished to do so, subject to the following conditions: | |
13 | |
14 The above copyright notice and this permission notice (including the next | |
15 paragraph) shall be included in all copies or substantial portions of the | |
16 Software. | |
17 | |
18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
19 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
20 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
21 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
22 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | |
23 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | |
24 DEALINGS IN THE SOFTWARE. | |
25 </copyright> | |
26 | |
27 <interface name="wl_scaler" version="2"> | |
28 <description summary="surface cropping and scaling"> | |
29 The global interface exposing surface cropping and scaling | |
30 capabilities is used to instantiate an interface extension for a | |
31 wl_surface object. This extended interface will then allow | |
32 cropping and scaling the surface contents, effectively | |
33 disconnecting the direct relationship between the buffer and the | |
34 surface size. | |
35 </description> | |
36 | |
37 <request name="destroy" type="destructor"> | |
38 <description summary="unbind from the cropping and scaling interface"> | |
39 Informs the server that the client will not be using this | |
40 protocol object anymore. This does not affect any other objects, | |
41 wl_viewport objects included. | |
42 </description> | |
43 </request> | |
44 | |
45 <enum name="error"> | |
46 <entry name="viewport_exists" value="0" | |
47 summary="the surface already has a viewport object associated"/> | |
48 </enum> | |
49 | |
50 <request name="get_viewport"> | |
51 <description summary="extend surface interface for crop and scale"> | |
52 Instantiate an interface extension for the given wl_surface to | |
53 crop and scale its content. If the given wl_surface already has | |
54 a wl_viewport object associated, the viewport_exists | |
55 protocol error is raised. | |
56 </description> | |
57 | |
58 <arg name="id" type="new_id" interface="wl_viewport" | |
59 summary="the new viewport interface id"/> | |
60 <arg name="surface" type="object" interface="wl_surface" | |
61 summary="the surface"/> | |
62 </request> | |
63 </interface> | |
64 | |
65 <interface name="wl_viewport" version="2"> | |
66 <description summary="crop and scale interface to a wl_surface"> | |
67 An additional interface to a wl_surface object, which allows the | |
68 client to specify the cropping and scaling of the surface | |
69 contents. | |
70 | |
71 This interface allows to define the source rectangle (src_x, | |
72 src_y, src_width, src_height) from where to take the wl_buffer | |
73 contents, and scale that to destination size (dst_width, | |
74 dst_height). This state is double-buffered, and is applied on the | |
75 next wl_surface.commit. | |
76 | |
77 The two parts of crop and scale state are independent: the source | |
78 rectangle, and the destination size. Initially both are unset, that | |
79 is, no scaling is applied. The whole of the current wl_buffer is | |
80 used as the source, and the surface size is as defined in | |
81 wl_surface.attach. | |
82 | |
83 If the destination size is set, it causes the surface size to become | |
84 dst_width, dst_height. The source (rectangle) is scaled to exactly | |
85 this size. This overrides whatever the attached wl_buffer size is, | |
86 unless the wl_buffer is NULL. If the wl_buffer is NULL, the surface | |
87 has no content and therefore no size. Otherwise, the size is always | |
88 at least 1x1 in surface coordinates. | |
89 | |
90 If the source rectangle is set, it defines what area of the | |
91 wl_buffer is taken as the source. If the source rectangle is set and | |
92 the destination size is not set, the surface size becomes the source | |
93 rectangle size rounded up to the nearest integer. If the source size | |
94 is already exactly integers, this results in cropping without scaling. | |
95 | |
96 The coordinate transformations from buffer pixel coordinates up to | |
97 the surface-local coordinates happen in the following order: | |
98 1. buffer_transform (wl_surface.set_buffer_transform) | |
99 2. buffer_scale (wl_surface.set_buffer_scale) | |
100 3. crop and scale (wl_viewport.set*) | |
101 This means, that the source rectangle coordinates of crop and scale | |
102 are given in the coordinates after the buffer transform and scale, | |
103 i.e. in the coordinates that would be the surface-local coordinates | |
104 if the crop and scale was not applied. | |
105 | |
106 If the source rectangle is partially or completely outside of the | |
107 wl_buffer, then the surface contents are undefined (not void), and | |
108 the surface size is still dst_width, dst_height. | |
109 | |
110 The x, y arguments of wl_surface.attach are applied as normal to | |
111 the surface. They indicate how many pixels to remove from the | |
112 surface size from the left and the top. In other words, they are | |
113 still in the surface-local coordinate system, just like dst_width | |
114 and dst_height are. | |
115 | |
116 If the wl_surface associated with the wl_viewport is destroyed, | |
117 the wl_viewport object becomes inert. | |
118 | |
119 If the wl_viewport object is destroyed, the crop and scale | |
120 state is removed from the wl_surface. The change will be applied | |
121 on the next wl_surface.commit. | |
122 </description> | |
123 | |
124 <request name="destroy" type="destructor"> | |
125 <description summary="remove scaling and cropping from the surface"> | |
126 The associated wl_surface's crop and scale state is removed. | |
127 The change is applied on the next wl_surface.commit. | |
128 </description> | |
129 </request> | |
130 | |
131 <enum name="error"> | |
132 <entry name="bad_value" value="0" | |
133 summary="negative or zero values in width or height"/> | |
134 </enum> | |
135 | |
136 <request name="set"> | |
137 <description summary="set the crop and scale state"> | |
138 Set both source rectangle and destination size of the associated | |
139 wl_surface. See wl_viewport for the description, and relation to | |
140 the wl_buffer size. | |
141 | |
142 The bad_value protocol error is raised if src_width or | |
143 src_height is negative, or if dst_width or dst_height is not | |
144 positive. | |
145 | |
146 The crop and scale state is double-buffered state, and will be | |
147 applied on the next wl_surface.commit. | |
148 | |
149 Arguments dst_x and dst_y do not exist here, use the x and y | |
150 arguments to wl_surface.attach. The x, y, dst_width, and dst_height | |
151 define the surface-local coordinate system irrespective of the | |
152 attached wl_buffer size. | |
153 </description> | |
154 | |
155 <arg name="src_x" type="fixed" summary="source rectangle x"/> | |
156 <arg name="src_y" type="fixed" summary="source rectangle y"/> | |
157 <arg name="src_width" type="fixed" summary="source rectangle width"/> | |
158 <arg name="src_height" type="fixed" summary="source rectangle height"/> | |
159 <arg name="dst_width" type="int" summary="surface width"/> | |
160 <arg name="dst_height" type="int" summary="surface height"/> | |
161 </request> | |
162 | |
163 <request name="set_source" since="2"> | |
164 <description summary="set the source rectangle for cropping"> | |
165 Set the source rectangle of the associated wl_surface. See | |
166 wl_viewport for the description, and relation to the wl_buffer | |
167 size. | |
168 | |
169 If width is -1.0 and height is -1.0, the source rectangle is unset | |
170 instead. Any other pair of values for width and height that | |
171 contains zero or negative values raises the bad_value protocol | |
172 error. | |
173 | |
174 The crop and scale state is double-buffered state, and will be | |
175 applied on the next wl_surface.commit. | |
176 </description> | |
177 | |
178 <arg name="x" type="fixed" summary="source rectangle x"/> | |
179 <arg name="y" type="fixed" summary="source rectangle y"/> | |
180 <arg name="width" type="fixed" summary="source rectangle width"/> | |
181 <arg name="height" type="fixed" summary="source rectangle height"/> | |
182 </request> | |
183 | |
184 <request name="set_destination" since="2"> | |
185 <description summary="set the surface size for scaling"> | |
186 Set the destination size of the associated wl_surface. See | |
187 wl_viewport for the description, and relation to the wl_buffer | |
188 size. | |
189 | |
190 If width is -1 and height is -1, the destination size is unset | |
191 instead. Any other pair of values for width and height that | |
192 contains zero or negative values raises the bad_value protocol | |
193 error. | |
194 | |
195 The crop and scale state is double-buffered state, and will be | |
196 applied on the next wl_surface.commit. | |
197 | |
198 Arguments x and y do not exist here, use the x and y arguments to | |
199 wl_surface.attach. The x, y, width, and height define the | |
200 surface-local coordinate system irrespective of the attached | |
201 wl_buffer size. | |
202 </description> | |
203 | |
204 <arg name="width" type="int" summary="surface width"/> | |
205 <arg name="height" type="int" summary="surface height"/> | |
206 </request> | |
207 </interface> | |
208 </protocol> | |
OLD | NEW |