From 188280695b8c6b8e53d24abe936d9dfd2747ebb5 Mon Sep 17 00:00:00 2001 From: YaoBing Xiao Date: Wed, 16 Jul 2025 23:11:54 +0800 Subject: [PATCH] staging: add ext-pick-color protocol This protocol allows privileged clients to pick colors from the screen with high precision, supporting both interactive user selection and programmatic color sampling at specific coordinates. Features: - Interactive color picking through user input - Programmatic color sampling at specific coordinates - Support for multiple color spaces (sRGB, Display P3, Rec.2020, etc.) - High-precision color data with 32-bit channels - Comprehensive error handling The protocol provides two main interfaces: - ext_pick_color_manager_v1: Creates and manages color picker objects - ext_pick_color_v1: Handles color picking operations and events Signed-off-by: YaoBing Xiao --- staging/pick-color/README | 4 + .../treeland-pickcolor-unstable-v1.xml | 150 ++++++++++++++++++ 2 files changed, 154 insertions(+) create mode 100644 staging/pick-color/README create mode 100644 staging/pick-color/treeland-pickcolor-unstable-v1.xml diff --git a/staging/pick-color/README b/staging/pick-color/README new file mode 100644 index 0000000..d65ec74 --- /dev/null +++ b/staging/pick-color/README @@ -0,0 +1,4 @@ +pick-color protocol + +Maintainers: +YaoBing Xiao (@zzxyb) diff --git a/staging/pick-color/treeland-pickcolor-unstable-v1.xml b/staging/pick-color/treeland-pickcolor-unstable-v1.xml new file mode 100644 index 0000000..4e8c280 --- /dev/null +++ b/staging/pick-color/treeland-pickcolor-unstable-v1.xml @@ -0,0 +1,150 @@ + + + + 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. + + + + 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. + + + + + 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 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. + + + + + + + All objects created by the manager will still remain valid, until their + appropriate destroy request has been called. + + + + + + + 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. + + + + + These errors can be emitted in response to requests. + + + + + + + + Supported color spaces for color data. + + + + + + + + + + + + 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. + + + + + + + + + + + + + Sent when an error occurs during color picking operation. + The picker may become inactive as a result. + + + + + + + + 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. + + + + + + + + Destroys the color picker object. + + + +