IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

BrightnessContrast QML Type

Adjusts brightness and contrast.

This type was introduced in QtGraphicalEffects 1.0.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

BrightnessContrast QML Type

  • Import Statement: import Qt5Compat.GraphicalEffects

  • Since:: QtGraphicalEffects 1.0

  • Inherits:: Item

  • Group: BrightnessContrast is part of qtgraphicaleffects-color

Detailed Description

This effect adjusts the source item colors. Brightness adjustment changes the perceived luminance of the source item. Contrast adjustment increases or decreases the color and brightness variations.

Source

Effect applied

Image non disponible
Image non disponible

Example

The following example shows how to apply the effect.

 
Sélectionnez
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
    }

    BrightnessContrast {
        anchors.fill: bug
        source: bug
        brightness: 0.5
        contrast: 0.5
    }
}

Property Documentation

 

brightness : real

This property defines how much the source brightness is increased or decreased.

The value ranges from -1.0 to 1.0. By default, the property is set to 0.0 (no change).

Output examples with different brightness values

   
Image non disponible
Image non disponible
Image non disponible

brightness: -0.25

brightness: 0

brightness: 0.5

contrast: 0

contrast: 0

contrast: 0

cached : bool

This property allows the effect output pixels to be cached in order to improve the rendering performance.

Every time the source or effect properties are changed, the pixels in the cache must be updated. Memory consumption is increased, because an extra buffer of memory is required for storing the effect output.

It is recommended to disable the cache when the source or the effect properties are animated.

By default, the property is set to false.

contrast : real

This property defines how much the source contrast is increased or decreased. The decrease of the contrast is linear, but the increase is applied with a non-linear curve to allow very high contrast adjustment at the high end of the value range.

Contrast adjustment curve

Image non disponible

The value ranges from -1.0 to 1.0. By default, the property is set to 0.0 (no change).

Output examples with different contrast values

   
Image non disponible
Image non disponible
Image non disponible

contrast: -0.5

contrast: 0

contrast: 0.5

brightness: 0

brightness: 0

brightness: 0

source : variant

This property defines the source item that provides the source pixels for the effect.

It is not supported to let the effect include itself, for instance by setting source to the effect's parent.

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+