KDeclarative

Lanczos.qml
1/*
2 SPDX-FileCopyrightText: 2021 Arjen Hiemstra <ahiemstra@heimr.nl>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7import QtQuick
8
9/**
10 * A ShaderEffect that makes use of the Lanczos resampling method for scaling textures.
11 *
12 * Lanczos resampling tries to preserve detail when scaling down images and
13 * thus looks less blurry compared to a simple linear interpolation.
14 *
15 * This effect implements a single-pass Lanczos resampling filter using two
16 * lobes. Everything is done in the shader, with some defaults set for
17 * parameters. These defaults were designed to provide a good visual result when
18 * scaling down window thumbnails.
19 */
20ShaderEffect {
21 /**
22 * The source texture. Can be any QQuickTextureProvider.
23 */
24 required property var source
25 /**
26 * The size of the source texture. Used to perform aspect ratio correction.
27 */
28 required property size sourceSize
29
30 /**
31 * The target size of the Lanczos effect.
32 *
33 * Defaults to the width and height of this effect.
34 */
35 property size targetSize: Qt.size(width, height)
36
37 /**
38 * Lanczos window Sinc function factor.
39 *
40 * Defaults to 0.4
41 */
42 property real windowSinc: 0.4;
43 /**
44 * Lanczos Sinc function factor.
45 *
46 * Defaults to 1.0
47 */
48 property real sinc: 1.0;
49
50 /**
51 * The amount of anti-ringing to apply.
52 *
53 * Defaults to 0.65
54 */
55 property real antiRingingStrength: 0.65;
56 /**
57 * The resolution of the Lanczos effect.
58 *
59 * Larger values mean reduced (more pixelated) results.
60 * Defaults to 0.98 to achieve good results.
61 */
62 property real resolution: 0.98;
63
64 vertexShader: Qt.resolvedUrl(":/shaders/preserveaspect.vert.qsb")
65 fragmentShader: Qt.resolvedUrl(":/shaders/lanczos2sharp.frag.qsb")
66}
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:05:54 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.