~loic.molinari/+junk/magnifier-video-recording

« back to all changes in this revision

Viewing changes to Main.qml

  • Committer: Loïc Molinari
  • Date: 2015-04-23 10:33:06 UTC
  • Revision ID: loic.molinari@canonical.com-20150423103306-vkp78ykjra2ahetc
Reworked mouse support and added partial support for video recording.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 
4
4
Item {
5
5
    id: root
6
 
    width: 500
7
 
    height: 500
 
6
    width: 300
 
7
    height: 400
8
8
 
9
9
    Item {
10
10
        id: scene
17
17
            anchors.centerIn: parent
18
18
            anchors.verticalCenterOffset: -25
19
19
            radius: "medium"
20
 
            source: Image { id: img; source: "music-app.png" }
 
20
            source: Image { source: "music-app.png" }
21
21
            sourceFillMode: UbuntuShape.PreserveAspectCrop
22
22
            sourceHorizontalWrapMode: UbuntuShape.Repeat
23
23
        }
38
38
        id: zoomPan
39
39
        anchors.fill: parent
40
40
        scene: scene
 
41
        area: mouseArea
 
42
    }
 
43
 
 
44
    ShaderEffect {
 
45
        id: effect
 
46
        width: pointer.width
 
47
        height: pointer.height
 
48
        x: mouseArea.containsMouse ? mouseArea.mouseX + 8.0 : root.width
 
49
        y: mouseArea.containsMouse ? mouseArea.mouseY + 8.0 : root.height
 
50
        opacity: 0.85
 
51
        visible: false
 
52
        property variant texture: Image { id: pointer; source: "pointer.png" }
 
53
 
 
54
        vertexShader: "
 
55
            uniform highp mat4 qt_Matrix;
 
56
            attribute highp vec4 qt_Vertex;
 
57
            attribute mediump vec2 qt_MultiTexCoord0;
 
58
            varying mediump vec2 texCoord;
 
59
            void main() {
 
60
                texCoord = qt_MultiTexCoord0;
 
61
                gl_Position = qt_Matrix * qt_Vertex;
 
62
            }"
 
63
        fragmentShader: "
 
64
            uniform sampler2D texture;
 
65
            uniform lowp float qt_Opacity;
 
66
            varying mediump vec2 texCoord;
 
67
            void main() {
 
68
                gl_FragColor = texture2D(texture, texCoord) * vec4(0.5, 1.0, 0.5, 1.0) * qt_Opacity;
 
69
            }"
 
70
    }
 
71
 
 
72
    MouseArea {
 
73
        id: mouseArea
 
74
        anchors.fill: parent
 
75
        enabled: true
 
76
        hoverEnabled: true
 
77
        acceptedButtons: Qt.AllButtons
41
78
    }
42
79
}