- Qt 6.9
- Qt 5 Compatibility APIs: Graphical Effects
- QML Types
- ZoomBlur
- Qt 6.9.3 Reference Documentation

# ZoomBlur QML Type

Applies directional blur effect towards source items center point. More...

Import Statement: | `import Qt5Compat.GraphicalEffects`
Since: | Qt5Compat.GraphicalEffects 1.0
Inherits: | Item

- List of all members, including inherited members

## Properties

- cached : bool
- horizontalOffset : real
- length : real
- samples : int
- source : variant
- transparentBorder : bool
- verticalOffset : real

## Detailed Description

Effect creates perceived impression that the source item appears to be moving towards the center point in Z-direction or that the camera appears to be zooming rapidly. Other available motion blur effects are DirectionalBlur and RadialBlur.

Source | Effect applied
--- | ---

Note: This effect is available when running with OpenGL.

## Example

The following example shows how to apply the effect.

     import QtQuick
     import Qt5Compat.GraphicalEffects

     Item {
         width: 300
         height: 300

         Image {
             id: butterfly
             source: "images/bug.jpg"
             sourceSize: Qt.size(parent.width, parent.height)
             smooth: true
             visible: false
         }

         ZoomBlur {
             anchors.fill: butterfly
             source: butterfly
             samples: 24
             length: 48
         }
     }

## 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`.

horizontalOffset : real

These properties define an offset in pixels for the blur direction center point.

The values range from -inf to inf. By default these properties are set to `0`.

Output examples with different horizontalOffset values |  |
--- | --- | ---
horizontalOffset: 100.0 | horizontalOffset: 0.0 | horizontalOffset: -100.0
samples: 24 | samples: 24 | samples: 24
length: 32 | length: 32 | length: 32
verticalOffset: 0 | verticalOffset: 0 | verticalOffset: 0

length : real

This property defines the maximum perceived amount of movement for each pixel. The amount is smaller near the center and reaches the specified value at the edges.

The quality of the blur depends on samples property. If length value is large, more samples are needed to keep the visual quality at high level.

The value ranges from 0.0 to inf. By default the property is set to `0.0` (no blur).

Output examples with different length values |  |
--- | --- | ---
length: 0.0 | length: 32.0 | length: 48.0
samples: 24 | samples: 24 | samples: 24
horizontalOffset: 0 | horizontalOffset: 0 | horizontalOffset: 0
verticalOffset: 0 | verticalOffset: 0 | verticalOffset: 0

samples : int

This property defines how many samples are taken per pixel when blur calculation is done. Larger value produces better quality, but is slower to render.

This property is not intended to be animated. Changing this property may cause the underlying OpenGL shaders to be recompiled.

Allowed values are between 0 and inf (practical maximum depends on GPU). By default the property is set to `0` (no samples).

source : variant

This property defines the source item that is going to be blurred.

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

transparentBorder : bool

This property defines the blur behavior near the edges of the item, where the pixel blurring is affected by the pixels outside the source edges.

If the property is set to `true`, the pixels outside the source are interpreted to be transparent, which is similar to OpenGL clamp-to-border extension. The blur is expanded slightly outside the effect item area.

If the property is set to `false`, the pixels outside the source are interpreted to contain the same color as the pixels at the edge of the item, which is similar to OpenGL clamp-to-edge behavior. The blur does not expand outside the effect item area.

By default, the property is set to `false`.

verticalOffset : real

These properties define an offset in pixels for the blur direction center point.

The values range from -inf to inf. By default these properties are set to `0`.

Output examples with different horizontalOffset values |  |
--- | --- | ---
horizontalOffset: 100.0 | horizontalOffset: 0.0 | horizontalOffset: -100.0
samples: 24 | samples: 24 | samples: 24
length: 32 | length: 32 | length: 32
verticalOffset: 0 | verticalOffset: 0 | verticalOffset: 0