Warning, /frameworks/kdeclarative/src/qmlcontrols/graphicaleffects/Lanczos.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 SPDX-FileCopyrightText: 2021 Arjen Hiemstra <ahiemstra@heimr.nl>
0003
0004 SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006
0007 import QtQuick
0008
0009 /**
0010 * A ShaderEffect that makes use of the Lanczos resampling method for scaling textures.
0011 *
0012 * Lanczos resampling tries to preserve detail when scaling down images and
0013 * thus looks less blurry compared to a simple linear interpolation.
0014 *
0015 * This effect implements a single-pass Lanczos resampling filter using two
0016 * lobes. Everything is done in the shader, with some defaults set for
0017 * parameters. These defaults were designed to provide a good visual result when
0018 * scaling down window thumbnails.
0019 */
0020 ShaderEffect {
0021 /**
0022 * The source texture. Can be any QQuickTextureProvider.
0023 */
0024 required property var source
0025 /**
0026 * The size of the source texture. Used to perform aspect ratio correction.
0027 */
0028 required property size sourceSize
0029
0030 /**
0031 * The target size of the Lanczos effect.
0032 *
0033 * Defaults to the width and height of this effect.
0034 */
0035 property size targetSize: Qt.size(width, height)
0036
0037 /**
0038 * Lanczos window Sinc function factor.
0039 *
0040 * Defaults to 0.4
0041 */
0042 property real windowSinc: 0.4;
0043 /**
0044 * Lanczos Sinc function factor.
0045 *
0046 * Defaults to 1.0
0047 */
0048 property real sinc: 1.0;
0049
0050 /**
0051 * The amount of anti-ringing to apply.
0052 *
0053 * Defaults to 0.65
0054 */
0055 property real antiRingingStrength: 0.65;
0056 /**
0057 * The resolution of the Lanczos effect.
0058 *
0059 * Larger values mean reduced (more pixelated) results.
0060 * Defaults to 0.98 to achieve good results.
0061 */
0062 property real resolution: 0.98;
0063
0064 vertexShader: Qt.resolvedUrl(":/shaders/preserveaspect.vert.qsb")
0065 fragmentShader: Qt.resolvedUrl(":/shaders/lanczos2sharp.frag.qsb")
0066 }