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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
|
import QtQuick 2.0
Item {
id: root
width: 1280
height: 720
Checkers {
id: checkers;
anchors.fill: parent
anchors.leftMargin: list.width
tileSize: 32
}
Loader {
id: loader
anchors.fill: checkers;
}
Rectangle {
id: listBackground
anchors.left: parent.left
anchors.right: checkers.left
anchors.top: parent.top
anchors.bottom: parent.bottom
color: "black"
}
ListModel {
id: listModel
ListElement { name: "Brignthness / Contrast"; file: "effect_BrightnessContrast.qml" }
ListElement { name: "Colorize"; file: "effect_Colorize.qml" }
ListElement { name: "Displacement"; file: "effect_Displacement.qml" }
ListElement { name: "Drop Shadow"; file: "effect_DropShadow.qml" }
ListElement { name: "Gaussian Blur"; file: "effect_GaussianBlur.qml" }
ListElement { name: "Glow"; file: "effect_Glow.qml" }
ListElement { name: "Hue / Saturation"; file: "effect_HueSaturation.qml" }
ListElement { name: "Opacity Mask"; file: "effect_OpacityMask.qml" }
ListElement { name: "Threshold Mask"; file: "effect_ThresholdMask.qml" }
ListElement { name: "Wave (custom)"; file: "effect_CustomWave.qml" }
ListElement { name: "Dissolve (custom)"; file: "effect_CustomDissolve.qml" }
}
ListView
{
id: list
anchors.top: parent.top
anchors.left: parent.left
width: parent.width / 4
height: parent.height - width
clip: true
focus: true
highlightMoveDuration: 0
onCurrentItemChanged: {
var entry = listModel.get(currentIndex);
loader.source = entry.file;
}
model: listModel
highlight: Rectangle {
color: "steelblue"
}
delegate: Item {
id: delegateRoot
width: list.width
height: root.height * 0.05
Rectangle {
width: parent.width
height: 3
anchors.bottom: parent.bottom
gradient: Gradient {
GradientStop { position: 0; color: "transparent" }
GradientStop { position: 0.5; color: "lightgray" }
GradientStop { position: 1; color: "transparent" }
}
}
Text {
color: "white"
font.pixelSize: parent.height * 0.5
anchors.verticalCenter: parent.verticalCenter
anchors.verticalCenterOffset: -2
x: parent.width * 0.1
text: name
}
MouseArea {
anchors.fill: parent
onClicked: list.currentIndex = index;
}
}
}
Canvas {
id: canvas
anchors.fill: controller
anchors.margins: 10
property real padding: 20
onPaint: {
var ctx = canvas.getContext("2d");
var w = canvas.width
var h = canvas.height;
ctx.fillStyle = "rgb(50, 50, 50)"
ctx.beginPath();
ctx.roundedRect(0, 0, w, h, w * 0.1, w * 0.1);
ctx.fill();
var margin = canvas.padding;
var segmentSize = 4
ctx.strokeStyle = "gray"
ctx.beginPath();
ctx.moveTo(margin, margin);
ctx.lineTo(margin, h-margin);
ctx.moveTo(margin, h - margin);
ctx.lineTo(w-margin, h - margin);
var segmentCount = 11
for (var i = 0; i<segmentCount; ++i) {
var offset = margin + i * (w - margin * 2) / (segmentCount - 1);
ctx.moveTo(margin - segmentSize, offset);
ctx.lineTo(margin + segmentSize, offset);
ctx.moveTo(offset, h - margin - segmentSize);
ctx.lineTo(offset, h - margin + segmentSize);
}
ctx.stroke();
}
}
Text {
id: labelX
anchors.bottom: canvas.bottom
x: canvas.width * 0.4
anchors.bottomMargin: 2
text: (loader.item != undefined && typeof loader.item.nameX != 'undefined' ? loader.item.nameX : "")
+ (loader.item != undefined && typeof loader.item.feedbackX != 'undefined' ? ": " + loader.item.feedbackX.toFixed(2) : "");
color: "white"
font.pixelSize: canvas.padding * 0.5
}
Text {
id: labelY
anchors.verticalCenter: canvas.verticalCenter
anchors.verticalCenterOffset: canvas.height * 0.15
anchors.left: canvas.left
transformOrigin: Item.TopLeft
rotation: -90
text: (loader.item != undefined && typeof loader.item.nameY != 'undefined' ? loader.item.nameY : "")
+ (loader.item != undefined && typeof loader.item.feedbackY != 'undefined' ? ": " + loader.item.feedbackY.toFixed(2) : "");
color: "white"
font.pixelSize: canvas.padding * 0.5
}
MouseArea {
id: controller
anchors.top: list.bottom;
anchors.left: parent.left
anchors.right: checkers.left
anchors.bottom: parent.bottom;
onPositionChanged: {
var effect = loader.item;
function bound(val) { return Math.max(0, Math.min(1, val)); }
if (effect != undefined) {
if (typeof effect.inputX != 'undefined')
effect.inputX = bound(mouseX / controller.width);
if (typeof effect.inputY != 'undefined')
effect.inputY = bound(1 - mouseY / controller.height);
}
}
}
}
|