ext_pick_color_v1

pick colors from the screen

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.

manager to control color picking devices

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
idnew_id<ext_pick_color_v1>
create a new color picker

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()
destroy the manager

All objects created by the manager will still remain valid, until their appropriate destroy request has been called.


manage a color picker

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

Activate the color picker to start capturing user input. The compositor should show appropriate UI and start monitoring for user interactions.

pick_at(x: int, y: int)
Argument
Type
Description
xint
x coordinate to sample
yint
y coordinate to sample
pick color at specific coordinates

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()
destroy the picker object

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
xint
x coordinate of picked pixel
yint
y coordinate of picked pixel
auint
alpha channel (0–4294967295)
ruint
red channel (0–4294967295)
guint
green channel (0–4294967295)
buint
blue channel (0–4294967295)
colorspaceuint<ext_pick_color_v1.colorspace>
color space of the sampled color
a color was picked

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.

Argument
Type
Description
error_codeuint<ext_pick_color_v1.error>
error type
messagestring
human-readable error description
picker error occurred

Sent when an error occurs during color picking operation. The picker may become inactive as a result.

Argument
Value
Description
invalid_coordinates0
coordinates out of bounds
compositor_error1
compositor-side error
picker errors

These errors can be emitted in response to requests.

Argument
Value
Description
srgb0
sRGB color space
display_p31
Display P3 color space
rec20202
Rec. 2020 color space
adobe_rgb3
Adobe RGB color space
bt7094
BT.709 color space
unknown5
unknown or custom color space
color space types

Supported color spaces for color data.


Compositor Support

No compositor support found

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.