QML类型说明-Colorize

来源:互联网 发布:金融 大数据 微线索 编辑:程序博客网 时间:2024/06/16 23:53

Colorize

ImportStatement:   import QtGraphicalEffects 1.0

Since:  QtGraphicalEffects 1.0

Inherits:      Item

 

Properties

cached :bool

hue : real

lightness :real

saturation :real

source :variant

 

DetailedDescription

Colorize组件的效果类似于在彩色玻璃上放了灰度图片。它适用色相、饱和度和亮度(HSL)作为色彩空间。我们能直接指定每个属性的值,也可以用HueSaturation组件改变所有HSL值。或者,我们也能通过ColorOverlay适用源的RGBA颜色空间影响Colorize。

源影响


 下面的代码是上面效果的演示。

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

    }

 

    Colorize {

        anchors.fill: bug

        source: bug

        hue: 0.0

        saturation: 0.5

        lightness: -0.2

    }

}

 

PropertyDocumentation

cached :bool

输出是否缓存,可提高渲染性能,但消费更多内存。每当源或影响属性改变,缓存的数据都跟着更新。当源或影响属性是动画时,推荐关闭缓冲。默认为假。

 

hue : real

色相。值在0.0到1.0之间,默认为0.0。输出显示红色。

可选择的色相


色相不同的影响  

hue: 0.2hue: 0.5hue: 0.8saturation: 1saturation: 1saturation: 1lightness: 0lightness: 0lightness: 0

lightness :real

提高或降低源的亮度的指标。不像hue和saturation,lightness属性不设置使用值,而是表示在原值基础上的变化。值在-1.0 (降低)到1.0 (提高)之间。默认为0.0(不改变)。

不同亮度值的影响  

lightness: -0.75lightness: 0lightness: 0.75hue: 0hue: 0hue: 0saturation: 1saturation: 1saturation: 1  

saturation :real

饱和度值,值在0.0(不饱和)到1.0(饱和)之间。默认设置为1.0(饱和)。

饱和度值的影响  

saturation: 0saturation: 0.5saturation: 1hue: 0hue: 0hue: 0lightness: 0lightness: 0lightness: 0 

source :variant

源图片。注意它不支持影响自身,这是指设置源为影响的父实例。例如Colorize在一个id为myimage的Image中宣布,它就不能影响myimage了。
0 0
原创粉丝点击