ext_pick_color_v1
- external
 
This protocol allows a privileged client to pick colors from the screen. In particular, the client will be able to sample color values at specific coordinates or through interactive user selection.
Warning! The protocol described in this file is currently in the testing phase. Backward compatible changes may be added together with the corresponding interface version bump. Backward incompatible changes can only be done by creating a new major version of the extension.
ext_pick_color_manager_v1
This interface is a manager that allows creating color picker objects. Clients can use it to initiate color picking operations with high precision, including color space information.
create_pick_color(id: new_id<ext_pick_color_v1>)
Argument  | Type  | Description  | 
|---|---|---|
| id | new_id<ext_pick_color_v1> | 
Create a new color picker object. The compositor may start capturing input or displaying relevant UI when the picker is activated.
The picker will be created in an inactive state and must be explicitly activated using the activate request.
destroy()
All objects created by the manager will still remain valid, until their appropriate destroy request has been called.
ext_pick_color_v1
A color picker object allows the client to receive color values selected from the screen. When active, the compositor may listen for user input, such as mouse clicks, and respond by sending the corresponding color.
The picker operates in different states and can provide detailed color information including color space data and pixel coordinates.
When the seat is destroyed, this object becomes inert.
activate()
Activate the color picker to start capturing user input. The compositor should show appropriate UI and start monitoring for user interactions.
Request to pick a color at specific coordinates without waiting for user input. The coordinates are in global compositor space.
This is useful for programmatic color sampling.
destroy()
Destroys the color picker object.
color(x: int, y: int, a: uint, r: uint, g: uint, b: uint, colorspace: uint<ext_pick_color_v1.colorspace>)
Argument  | Type  | Description  | 
|---|---|---|
| x | int | x coordinate of picked pixel  | 
| y | int | y coordinate of picked pixel  | 
| a | uint | alpha channel (0–4294967295)  | 
| r | uint | red channel (0–4294967295)  | 
| g | uint | green channel (0–4294967295)  | 
| b | uint | blue channel (0–4294967295)  | 
| colorspace | uint<ext_pick_color_v1.colorspace> | color space of the sampled color  | 
Sent when the user picks a color. Typically triggered when the user clicks on a point on the screen while the picker is active.
Each channel is represented as a 32-bit unsigned integer in the range 0 to 4294967295 (inclusive), allowing for high-precision color data. The values are unpremultiplied.
The coordinates indicate the exact pixel location where the color was sampled, in surface-local coordinates of the output.
error(error_code: uint<ext_pick_color_v1.error>, message: string)
Argument  | Type  | Description  | 
|---|---|---|
| error_code | uint<ext_pick_color_v1.error> | error type  | 
| message | string | human-readable error description  | 
Sent when an error occurs during color picking operation. The picker may become inactive as a result.
error { invalid_coordinates, compositor_error }
Argument  | Value  | Description  | 
|---|---|---|
| invalid_coordinates | 0 | coordinates out of bounds  | 
| compositor_error | 1 | compositor-side error  | 
These errors can be emitted in response to requests.
Compositor Support
Copyright
Copyright © 2024 UnionTech Software Technology Co., Ltd.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.