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

GammaAdjust QML Type

Alters the luminance of the source item.

This type was introduced in QtGraphicalEffects 1.0.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

GammaAdjust QML Type

  • Import Statement: import Qt5Compat.GraphicalEffects

  • Since:: QtGraphicalEffects 1.0

  • Inherits:: Item

  • Group: GammaAdjust is part of qtgraphicaleffects-color

Detailed Description

GammaAdjust is applied to each pixel according to the curve which is pre-defined as a power-law expression, where the property gamma is used as the reciprocal scaling exponent. Refer to the property documentation of gamma for more details.

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
    }

    GammaAdjust {
        anchors.fill: bug
        source: bug
        gamma: 0.45
    }
}

Property Documentation

 

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.

gamma : real

This property defines the change factor for how the luminance of each pixel is altered according to the equation:

 
Sélectionnez
luminance = pow(original_luminance, 1.0 / gamma); // The luminance is assumed to be between 0.0 and 1.0

Setting the gamma values under 1.0 makes the image darker, the values above 1.0 lighten it.

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

Output examples with different gamma values

   
Image non disponible
Image non disponible
Image non disponible

gamma: 0.5

gamma: 1.0

gamma: 2.0

Pixel luminance curves of the above images.

   
Image non disponible
Image non disponible
Image non disponible

Red curve: default gamma (1.0)

   

Yellow curve: effect applied

   

X-axis: pixel original luminance

   

Y-axis: pixel luminance with effect applied

   

source : variant

This property defines the source item for which the luminance is going to be adjusted.

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+