渐变
演示如何在QPainter 中使用渐变效果。
渐变有三种类型:
- 线性渐变在起点和终点之间插入颜色。
- 径向渐变在焦点和其周围的圆点之间插值。
- 锥形渐变在中心点周围插值。
右侧面板包含一个颜色表编辑器,用于定义渐变中的颜色。最上面的三个控制钮决定了红色、绿色和蓝色的分量,最后一个控制钮定义了渐变的 alpha 值。点击鼠标左键可以移动点或添加新点,点击鼠标右键可以删除点。
页面底部提供了三个配置示例,作为如何配置颜色表的建议。
Qt 还提供了一套已命名的渐变预设。它们基于免费的 WebGradients 系列。单击预设框中的名称即可显示渐变。使用箭头按钮浏览可用预设。
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.