| 1 |
import QtQuick 2.0 |
| 2 |
|
| 3 |
Item { |
| 4 |
width: 320 |
| 5 |
height: 480 |
| 6 |
|
| 7 |
Rectangle { |
| 8 |
id: rect; |
| 9 |
anchors.centerIn: parent |
| 10 |
width: 1 |
| 11 |
height: 10 |
| 12 |
visible: false |
| 13 |
|
| 14 |
gradient: Gradient { |
| 15 |
GradientStop { position: 0; color: "#ff0000" } |
| 16 |
GradientStop { position: 0.5; color: "#00ff00" } |
| 17 |
GradientStop { position: 1; color: "#0000ff" } |
| 18 |
} |
| 19 |
} |
| 20 |
|
| 21 |
Text { |
| 22 |
id: text |
| 23 |
anchors.centerIn: parent |
| 24 |
font.pixelSize: 80 |
| 25 |
text: "Shaderz!" |
| 26 |
visible: false |
| 27 |
} |
| 28 |
|
| 29 |
ShaderEffectSource { |
| 30 |
id: maskSource |
| 31 |
sourceItem: text |
| 32 |
smooth: true |
| 33 |
} |
| 34 |
|
| 35 |
ShaderEffectSource { |
| 36 |
id: colorSource |
| 37 |
sourceItem: rect; |
| 38 |
smooth: true |
| 39 |
} |
| 40 |
|
| 41 |
ShaderEffect { |
| 42 |
anchors.fill: text; |
| 43 |
|
| 44 |
property variant colorSource: colorSource |
| 45 |
property variant maskSource: maskSource; |
| 46 |
|
| 47 |
fragmentShader: "qrc:shaders/stencil.frag" |
| 48 |
} |
| 49 |
} |