Merge branch 'cropping' into 'main'

Add cropping functionality to allow clients to capture specific regions of image sources instead of the entire source

See merge request wayland/wayland-protocols!440
This commit is contained in:
YaoBing Xiao 2025-12-17 21:26:04 +08:00
commit ae5b513d17

View file

@ -199,7 +199,7 @@
</request> </request>
</interface> </interface>
<interface name="ext_image_copy_capture_frame_v1" version="1"> <interface name="ext_image_copy_capture_frame_v1" version="2">
<description summary="image capture frame"> <description summary="image capture frame">
This object represents an image capture frame. This object represents an image capture frame.
@ -217,6 +217,7 @@
<entry name="no_buffer" value="1" summary="capture sent without attach_buffer"/> <entry name="no_buffer" value="1" summary="capture sent without attach_buffer"/>
<entry name="invalid_buffer_damage" value="2" summary="invalid buffer damage"/> <entry name="invalid_buffer_damage" value="2" summary="invalid buffer damage"/>
<entry name="already_captured" value="3" summary="capture request has been sent"/> <entry name="already_captured" value="3" summary="capture request has been sent"/>
<entry name="invalid_viewport" value="4" summary="invalid viewport region" since="2"/>
</enum> </enum>
<request name="destroy" type="destructor"> <request name="destroy" type="destructor">
@ -284,6 +285,36 @@
</description> </description>
</request> </request>
<request name="set_viewport" since="2">
<description summary="set the viewport for cropping">
Set a viewport for the capture, cropping the source to a specific
region. The viewport is defined in the source's coordinate system.
The coordinates (x, y) specify the top-left corner of the viewport
relative to the source's top-left corner. The width and height
specify the dimensions of the region to capture.
If this request is not called, the whole source is captured.
If width or height are zero or negative, the invalid_viewport protocol
error is raised.
The viewport must be fully contained within the source boundaries at
the time of capture.
When the viewport is set or changed, the client should damage the
entire buffer for the next capture, as the relationship between
source content and buffer content may have changed.
This request must not be sent after capture, or else the
already_captured protocol error is raised.
</description>
<arg name="x" type="int" summary="viewport x coordinate"/>
<arg name="y" type="int" summary="viewport y coordinate"/>
<arg name="width" type="int" summary="viewport width"/>
<arg name="height" type="int" summary="viewport height"/>
</request>
<event name="transform"> <event name="transform">
<description summary="buffer transform"> <description summary="buffer transform">
This event is sent before the ready event and holds the transform that This event is sent before the ready event and holds the transform that