QML类型说明-Desaturate

本文介绍 Qt Graphical Effects 1.0 中的 Desaturate 组件使用方法,通过调整 desaturation 属性实现不同等级的色彩冲淡效果。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Desaturate

ImportStatement:   import QtGraphicalEffects 1.0

Since:  QtGraphicalEffects 1.0

Inherits:      Item

 

Properties

cached :bool

desaturation: real

source :variant

 

DetailedDescription

Desaturated组件的像素值计算做源实例的原始RGB组件的平均值。

影响



importQtQuick 2.0相应代码:

importQtGraphicalEffects 1.0

 

Item {

    width: 300

    height: 300

 

    Image {

        id: bug

        source: "images/bug.jpg"

        sourceSize: Qt.size(parent.width,parent.height)

        smooth: true

        visible: false

    }

 

    Desaturate {

        anchors.fill: bug

        source: bug

        desaturation: 0.8

    }

}

 

PropertyDocumentation

cached :bool

是否缓冲影响输出。缓冲可提高渲染效率,但会消耗更多内存。每次源或影响属性变化,都会更新缓冲。如果源或影响属性是动态的,推荐关闭缓冲。默认为假。

 

desaturation: real

多少源色彩被冲淡。值在0.0(不变)到1.0(冲淡)之间,默认为0

冲淡的影响    

desaturation: 0.0 desaturation: 0.5 desaturation: 1.0


source :variant 

用来影响的源图片,它是个提供源像素的实例。注意不能将自身作为源,例如宣布本组件在一个Image中,然后去影响宣布的Image。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值