混合 QML 类型
通过使用混合模式合并两个源项目。 更多...
| 导入语句 | import Qt5Compat.GraphicalEffects | 
| 自 | QtGraphicalEffects 1.0 | 
| 继承 | 
属性
- cached : bool
- foregroundSource : variant
- mode : string
- source : variant
详细描述
混合模式可以通过 mode 属性选择。
| source | foregroundSource | 应用的效果 | 
|---|---|---|
| 
 | 
 | 
 | 
注意:当使用 OpenGL 运行时,此效果可用。
示例
下面的示例显示了如何应用此效果。
import QtQuick import Qt5Compat.GraphicalEffects Item { width: 300 height: 300 Image { id: bug source: "images/bug.jpg" sourceSize: Qt.size(parent.width, parent.height) smooth: true visible: false } Image { id: butterfly source: "images/butterfly.png" sourceSize: Qt.size(parent.width, parent.height) smooth: true visible: false } Blend { anchors.fill: bug source: bug foregroundSource: butterfly mode: "subtract" } }
属性文档
| cached : bool | 
此属性允许缓存效果输出像素以提高渲染性能。
每次更改源或效果属性时,都必须更新缓存中的像素。由于需要额外的内存缓冲区来存储效果输出,因此内存消耗会增加。
建议在源或效果属性动画时禁用缓存。
默认情况下,属性设置为零。
| mode : string | 
此属性定义当 foregroundSource 混合到源上时使用的模式。值不区分大小写。
| mode | 描述 | 
|---|---|
| normal | 使用 Alpha 混合将 foregroundSource 的像素组件值覆盖到源。 | 
| addition | 将源和 foregroundSource 的像素组件值相加并写入。 | 
| average | 将源和 foregroundSource 的像素组件值平均并写入。 | 
| color | 从源中结合亮度与从 foregroundSource 得到的色调和饱和度并写入。 | 
| colorBurn | 如果源像素和前景源像素都较亮,从源头来的较暗像素会变得暗;如果两者都亮,结果会较亮。 | 
| colorDodge | 从源头来的较亮像素会变亮,如果源像素和前景源像素都较暗,则结果变暗。 | 
| darken | 将源像素和前景源像素的较暗像素组件值写入。 | 
| darkerColor | 将源头和前景源像素的较低亮度rgb值写入。 | 
| difference | 将源像素和前景源像素之间的绝对像素组件值差写入。 | 
| divide | 将源像素的像素组件值除以前景源像素的值,并写入。 | 
| exclusion | 将源像素和前景源像素之间的像素组件值差(对比度降低)写入。 | 
| hardLight | 根据前景源像素的值,将源像素的像素组件值变亮或变暗,并写入。 | 
| hue | 将前景源像素的色调值与源像素的饱和度和亮度相结合,并写入。 | 
| lighten | 将源像素和前景源像素的较亮像素组件值写入。 | 
| lighterColor | 将源头和前景源像素的较高亮度rgb值写入。 | 
| lightness | 将前景源像素的亮度值与源像素的色调和饱和度相结合,并写入。 | 
| multiply | 将源像素和前景源像素的像素组件值相乘,并写入。 | 
| negation | 将源像素和前景源像素之间的绝对像素组件值差取反,并写入。 | 
| saturation | 将前景源像素的饱和度值与源像素的色调和亮度相结合,并写入。 | 
| screen | 取源像素和前景源像素的像素值的反,然后相乘,再次取反,并写入。 | 
| subtract | 从源像素中减去前景源像素的像素值,并写入。 | 
| softLight | 根据前景源像素的值,轻微地变亮或变暗源像素的像素组件值,并写入。 | 
| 示例源 | 示例前景源 | 
|---|---|
| 
 | 
 | 
| 具有不同模式下不同模式值的输出示例 | ||
|---|---|---|
| 
 | 
 | 
 | 
| mode: normal | mode: addition | mode: average | 
| 
 | 
 | 
 | 
| mode: color | mode: colorBurn | mode: colorDodge | 
| 
 | 
 | 
 | 
| mode: darken | mode: darkerColor | mode: difference | 
| 
 | 
 | 
 | 
| mode: divide | mode: exclusion | mode: hardlight | 
| 
 | 
 | 
 | 
| mode: hue | mode: lighten | mode: lighterColor | 
| 
 | 
 | 
 | 
| mode: lightness | mode: negation | mode: multiply | 
| 
 | 
 | 
 | 
| mode: saturation | mode: screen | mode: subtract | 
| 
 | ||
| mode: softLight | 
| source : variant | 
此属性定义了将要作为前景源像素混合其上基础项的源项。
注意:不支持让效果包含自身,例如通过将源设置为效果的父项。
© 2024 Qt公司有限公司。本文件中包含的文档贡献均为各自所有者的版权所有。提供的文档受自由软件基金会发布的GNU自由文档许可协议版本1.3的条款约束。Qt及其相关标志是芬兰以及/或其他国家的Qt公司有限公司的商标。所有其他商标均为各自所有者的财产。
























