Alpha modifier protocol
该接口允许客户端为 surface 上的 alpha 值设置一个系数,这可用于将此类操作卸载(offload)给 compositor,而 compositor 也可以进而将其卸载给 KMS。
警告!此文件中描述的协议目前处于测试阶段。向后兼容的更改可能会与相应的接口版本增加一起添加。向后不兼容的更改只能通过创建该扩展的一个新主要版本来完成。
destroy()
销毁 alpha 修饰符管理器。这不会销毁使用该管理器创建的对象。
get_surface(id: new_id<wp_alpha_modifier_surface_v1>, surface: object<wl_surface>)
参数 | 类型 | 描述 |
|---|---|---|
| id | new_id<wp_alpha_modifier_surface_v1> | |
| surface | object<wl_surface> |
创建一个与给定的 wl_surface 关联的新的 alpha 修饰符 surface 对象。如果该 wl_surface 已经关联了这样一个对象,则会引发 already_constructed 错误。
error { already_constructed }
参数 | 值 | 描述 |
|---|---|---|
| already_constructed | 0 | wl_surface 已经有一个 alpha 修饰符对象 |
该接口允许客户端为 surface 上的 alpha 值设置一个系数,这可用于将此类操作卸载给 compositor。默认系数为 UINT32_MAX。
此对象必须在关联的 wl_surface 之前销毁。一旦 wl_surface 被销毁,对此对象的所有请求都将引发 no_surface 错误。
destroy()
这将销毁该对象,且等同于将值设置为 UINT32_MAX 的 set_multiplier,具有与 set_multiplier 相同的双缓冲语义。
set_multiplier(factor: uint)
参数 | 类型 | 描述 |
|---|---|---|
| factor | uint |
设置 surface 的 alpha 乘数。alpha 乘数是双缓冲状态,详情请参阅 wl_surface.commit。
此系数应用于 compositor 的混合空间(blending space),作为在处理 wl_surface 的每像素 alpha 值之后的一个额外步骤。因此,除非在其他扩展中指定了混合空间,否则该系数的确切含义是未定义的。
即使附加到 wl_surface 的 buffer 没有 alpha 通道,此乘数也会被应用;在这种情况下,将使用 1 作为 alpha 值。
零表示完全透明,UINT32_MAX 表示完全不透明。
合成器支持
Cage | COSMIC | GameScope | Hyprland | Jay | KWin | Labwc | Louvre | Mir | Muffin | Mutter | niri | phoc | river | Sway | Treeland | Wayfire | Weston | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| wp_alpha_modifier_v1 | x | 1 | x | 1 | 1 | 1 | 1 | x | x | x | x | x | 1 | 1 | 1 | 1 | x | x |
Copyright
Copyright © 2024 Xaver Hugl
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.