aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickshadereffect/data/MyIcon.qml
blob: f48b3698e155bfda550760a62d46aa6fc35f6a25 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright (C) 2016 Canonical Limited and/or its subsidiary(-ies).
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

import QtQuick 2.4

Item {
    id: root

    property alias source: image.source
    property bool shaderActive: false

    implicitWidth: image.width

    Image {
        id: image
        objectName: "image"
        anchors { top: parent.top; bottom: parent.bottom }
        sourceSize.height: height

        visible: !shaderActive
    }

    ShaderEffect {
        id: colorizedImage

        anchors.fill: parent
        visible: shaderActive && image.status == Image.Ready
        supportsAtlasTextures: true

        property Image source: visible ? image : null

        fragmentShader: "qrc:/data/red.frag"
    }
}