summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Motoyoshi Kalland <kim.kalland@nokia.com>2010-11-23 14:57:34 +0100
committerKim Motoyoshi Kalland <kim.kalland@nokia.com>2010-11-25 13:17:30 +0100
commit14535d4bd2a4f966f9438e9af00c8fa51c71afac (patch)
treeacb7e5840ca6053a9e6f74e65a142194e8f3cb53
parent9d33e7f2a093c87acbf2cb1d87971eebd1702b3c (diff)
Updated the ShaderEffectItem examples.
-rw-r--r--examples/shadereffectitem/Effectoids/Box4PointBlur.qml53
-rw-r--r--examples/shadereffectitem/Effectoids/Colorize.qml26
-rw-r--r--examples/shadereffectitem/Effectoids/Directional4PointBlur.qml57
-rw-r--r--examples/shadereffectitem/Effectoids/Directional8PointBlur.qml98
-rw-r--r--examples/shadereffectitem/Effectoids/DropShadow.qml59
-rw-r--r--examples/shadereffectitem/test-boxblur-4point.qml43
-rw-r--r--examples/shadereffectitem/test-colorize.qml1
-rw-r--r--examples/shadereffectitem/test-directional-4point.qml13
-rw-r--r--examples/shadereffectitem/test-directional-8point.qml13
-rw-r--r--examples/shadereffectitem/test-dropshadow.qml6
-rw-r--r--tests/opacityeffect.qml69
11 files changed, 233 insertions, 205 deletions
diff --git a/examples/shadereffectitem/Effectoids/Box4PointBlur.qml b/examples/shadereffectitem/Effectoids/Box4PointBlur.qml
index f64fbe7..64cd727 100644
--- a/examples/shadereffectitem/Effectoids/Box4PointBlur.qml
+++ b/examples/shadereffectitem/Effectoids/Box4PointBlur.qml
@@ -48,39 +48,44 @@ ShaderEffectItem
"varying highp vec2 my_TexCoord2; \n" +
"varying highp vec2 my_TexCoord3; \n" +
"varying highp vec2 my_TexCoord4; \n" +
- "uniform sampler2D source; \n" +
+ "uniform lowp sampler2D source; \n" +
+ "uniform highp float qt_Opacity; \n" +
"void main() { \n" +
- " gl_FragColor = (texture2D(source, qt_TexCoord) \n" +
- " + texture2D(source, my_TexCoord2) \n" +
- " + texture2D(source, my_TexCoord3) \n" +
- " + texture2D(source, my_TexCoord4)) * 0.25; \n" +
+ " gl_FragColor = qt_Opacity * (texture2D(source, qt_TexCoord) \n" +
+ " + texture2D(source, my_TexCoord2) \n" +
+ " + texture2D(source, my_TexCoord3) \n" +
+ " + texture2D(source, my_TexCoord4)) * 0.25; \n" +
"}"
vertexShader:
- "attribute highp vec4 qt_VertexPosition; \n" +
- "attribute highp vec2 qt_VertexTexCoord; \n" +
- "uniform highp mat4 qt_Matrix; \n" +
- "uniform highp float xOffset; \n" +
- "uniform highp float yOffset; \n" +
- "varying highp vec2 qt_TexCoord; \n" +
- "varying highp vec2 my_TexCoord2; \n" +
- "varying highp vec2 my_TexCoord3; \n" +
- "varying highp vec2 my_TexCoord4; \n" +
- "void main() { \n" +
- " highp vec2 s1 = vec2(xOffset, yOffset); \n" +
- " highp vec2 s2 = vec2(-xOffset, yOffset); \n" +
- " qt_TexCoord = qt_VertexTexCoord + s1; \n" +
- " my_TexCoord2 = qt_VertexTexCoord - s1; \n" +
- " my_TexCoord3 = qt_VertexTexCoord + s2; \n" +
- " my_TexCoord4 = qt_VertexTexCoord - s2; \n" +
- " gl_Position = qt_Matrix * qt_VertexPosition; \n" +
+ "attribute highp vec4 qt_Vertex; \n" +
+ "attribute highp vec2 qt_MultiTexCoord0; \n" +
+ "uniform highp mat4 qt_Matrix; \n" +
+ "uniform highp float xOffset; \n" +
+ "uniform highp float yOffset; \n" +
+ "uniform highp vec2 _normMargins; \n" +
+ "varying highp vec2 qt_TexCoord; \n" +
+ "varying highp vec2 my_TexCoord2; \n" +
+ "varying highp vec2 my_TexCoord3; \n" +
+ "varying highp vec2 my_TexCoord4; \n" +
+ "void main() { \n" +
+ " highp vec2 s1 = vec2(xOffset, yOffset); \n" +
+ " highp vec2 s2 = vec2(-xOffset, yOffset); \n" +
+ " highp vec2 tcoord = mix(_normMargins, \n" +
+ " qt_MultiTexCoord0 - _normMargins, qt_MultiTexCoord0); \n" +
+ " qt_TexCoord = tcoord + s1; \n" +
+ " my_TexCoord2 = tcoord - s1; \n" +
+ " my_TexCoord3 = tcoord + s2; \n" +
+ " my_TexCoord4 = tcoord - s2; \n" +
+ " gl_Position = qt_Matrix * qt_Vertex; \n" +
"}"
property variant source;
property real xOffset: 0.5 / width
property real yOffset: 0.5 / height
+ property variant _normMargins: Qt.size(margins.width / (2 * margins.width + width), margins.height / (2 * margins.height + height))
+ property variant margins: "margins" in source ? source.margins : Qt.size(0, 0)
active: true
blending: true
- smooth: true
-
+ property variant source
}
diff --git a/examples/shadereffectitem/Effectoids/Colorize.qml b/examples/shadereffectitem/Effectoids/Colorize.qml
index 4d6ad53..dead5cf 100644
--- a/examples/shadereffectitem/Effectoids/Colorize.qml
+++ b/examples/shadereffectitem/Effectoids/Colorize.qml
@@ -45,23 +45,24 @@ ShaderEffectItem
{
fragmentShader:
"varying highp vec2 qt_TexCoord; \n" +
- "uniform sampler2D source; \n" +
+ "uniform lowp sampler2D source; \n" +
"uniform lowp vec4 color; \n" +
"uniform lowp float intensity; \n" +
+ "uniform lowp float qt_Opacity; \n" +
"void main() { \n" +
- " lowp vec4 pix = texture2D(source, qt_TexCoord); \n" +
- " lowp float gray = dot(pix.rgb, vec3(0.5, 0.5, 0.5)); \n" +
- " gl_FragColor = mix(pix, color * (gray * pix.w), intensity); \n" +
+ " lowp vec4 pix = texture2D(source, qt_TexCoord); \n" +
+ " lowp float gray = dot(pix.xyz, vec3(0.5, 0.5, 0.5)); \n" +
+ " gl_FragColor = qt_Opacity * mix(pix, vec4(color.xyz * gray, pix.w), intensity); \n" +
"}"
vertexShader:
- "attribute highp vec4 qt_VertexPosition; \n" +
- "attribute highp vec2 qt_VertexTexCoord; \n" +
- "uniform highp mat4 qt_Matrix; \n" +
- "varying highp vec2 qt_TexCoord; \n" +
- "void main() { \n" +
- " qt_TexCoord = qt_VertexTexCoord; \n" +
- " gl_Position = qt_Matrix * qt_VertexPosition; \n" +
+ "attribute highp vec4 qt_Vertex; \n" +
+ "attribute highp vec2 qt_MultiTexCoord0; \n" +
+ "uniform highp mat4 qt_Matrix; \n" +
+ "varying highp vec2 qt_TexCoord; \n" +
+ "void main() { \n" +
+ " qt_TexCoord = qt_MultiTexCoord0; \n" +
+ " gl_Position = qt_Matrix * qt_Vertex; \n" +
"}"
property variant source;
@@ -69,6 +70,5 @@ ShaderEffectItem
property color color;
property real intensity;
active: intensity > 0
- anchors.fill: source
-
+ property variant source
}
diff --git a/examples/shadereffectitem/Effectoids/Directional4PointBlur.qml b/examples/shadereffectitem/Effectoids/Directional4PointBlur.qml
index d5ab6f9..4478dec 100644
--- a/examples/shadereffectitem/Effectoids/Directional4PointBlur.qml
+++ b/examples/shadereffectitem/Effectoids/Directional4PointBlur.qml
@@ -44,36 +44,37 @@ import QtQuick 2.0
ShaderEffectItem
{
fragmentShader:
- "varying highp vec2 qt_TexCoord; \n" +
- "varying highp vec2 qt_TexCoord2; \n" +
- "varying highp vec2 qt_TexCoord3; \n" +
- "varying highp vec2 qt_TexCoord4; \n" +
- "uniform sampler2D source; \n" +
- "void main() { \n" +
- " gl_FragColor = ( 2. / 6. * texture2D(source, qt_TexCoord) \n" +
- " + 1. / 6. * texture2D(source, qt_TexCoord2) \n" +
- " + 2. / 6. * texture2D(source, qt_TexCoord3) \n" +
- " + 1. / 6. * texture2D(source, qt_TexCoord4)); \n" +
+ "varying highp vec2 qt_TexCoord; \n" +
+ "varying highp vec2 qt_TexCoord2; \n" +
+ "varying highp vec2 qt_TexCoord3; \n" +
+ "varying highp vec2 qt_TexCoord4; \n" +
+ "uniform lowp sampler2D source; \n" +
+ "uniform highp float qt_Opacity; \n" +
+ "void main() { \n" +
+ " gl_FragColor = qt_Opacity * (2. / 6. * texture2D(source, qt_TexCoord) \n" +
+ " + 1. / 6. * texture2D(source, qt_TexCoord2) \n" +
+ " + 2. / 6. * texture2D(source, qt_TexCoord3) \n" +
+ " + 1. / 6. * texture2D(source, qt_TexCoord4)); \n" +
"}"
vertexShader:
- "attribute highp vec4 qt_VertexPosition; \n" +
- "attribute highp vec2 qt_VertexTexCoord; \n" +
- "uniform highp mat4 qt_Matrix; \n" +
- "uniform highp float xStep; \n" +
- "uniform highp float yStep; \n" +
- "uniform highp float spread; \n" +
- "varying highp vec2 qt_TexCoord; \n" +
- "varying highp vec2 qt_TexCoord2; \n" +
- "varying highp vec2 qt_TexCoord3; \n" +
- "varying highp vec2 qt_TexCoord4; \n" +
- "void main() { \n" +
- " highp vec2 shift = vec2(xStep, yStep); \n" +
- " qt_TexCoord = 0.7 * spread * shift + qt_VertexTexCoord; \n" +
- " qt_TexCoord2 = 2.7 * spread * shift + qt_VertexTexCoord; \n" +
- " qt_TexCoord3 = -0.7 * spread * shift + qt_VertexTexCoord; \n" +
- " qt_TexCoord4 = -2.7 * spread * shift + qt_VertexTexCoord; \n" +
- " gl_Position = qt_Matrix * qt_VertexPosition; \n" +
+ "attribute highp vec4 qt_Vertex; \n" +
+ "attribute highp vec2 qt_MultiTexCoord0; \n" +
+ "uniform highp mat4 qt_Matrix; \n" +
+ "uniform highp float xStep; \n" +
+ "uniform highp float yStep; \n" +
+ "uniform highp float spread; \n" +
+ "varying highp vec2 qt_TexCoord; \n" +
+ "varying highp vec2 qt_TexCoord2; \n" +
+ "varying highp vec2 qt_TexCoord3; \n" +
+ "varying highp vec2 qt_TexCoord4; \n" +
+ "void main() { \n" +
+ " highp vec2 shift = vec2(xStep, yStep) * spread; \n" +
+ " qt_TexCoord = 0.7 * shift + qt_MultiTexCoord0; \n" +
+ " qt_TexCoord2 = 2.7 * shift + qt_MultiTexCoord0; \n" +
+ " qt_TexCoord3 = -0.7 * shift + qt_MultiTexCoord0; \n" +
+ " qt_TexCoord4 = -2.7 * shift + qt_MultiTexCoord0; \n" +
+ " gl_Position = qt_Matrix * qt_Vertex; \n" +
"}"
@@ -81,8 +82,8 @@ ShaderEffectItem
property real spread: 1;
property real xStep: 0 / width;
property real yStep: 1 / height;
+ property variant source
active: spread > 0
- anchors.fill: source
smooth: true
}
diff --git a/examples/shadereffectitem/Effectoids/Directional8PointBlur.qml b/examples/shadereffectitem/Effectoids/Directional8PointBlur.qml
index 3aaaa18..940c50d 100644
--- a/examples/shadereffectitem/Effectoids/Directional8PointBlur.qml
+++ b/examples/shadereffectitem/Effectoids/Directional8PointBlur.qml
@@ -44,61 +44,59 @@ import QtQuick 2.0
ShaderEffectItem
{
fragmentShader:
- "varying highp vec2 qt_TexCoord; \n" +
- "varying highp vec2 qt_TexCoord2; \n" +
- "varying highp vec2 qt_TexCoord3; \n" +
- "varying highp vec2 qt_TexCoord4; \n" +
- "varying highp vec2 qt_TexCoord5; \n" +
- "varying highp vec2 qt_TexCoord6; \n" +
- "varying highp vec2 qt_TexCoord7; \n" +
- "varying highp vec2 qt_TexCoord8; \n" +
- "uniform sampler2D source; \n" +
- "void main() { \n" +
- " gl_FragColor = \n" +
- " (4. / 20. * texture2D(source, qt_TexCoord) \n" +
- " + 3. / 20. * texture2D(source, qt_TexCoord2) \n" +
- " + 2. / 20. * texture2D(source, qt_TexCoord3) \n" +
- " + 1. / 20. * texture2D(source, qt_TexCoord4) \n" +
- " + 4. / 20. * texture2D(source, qt_TexCoord5) \n" +
- " + 3. / 20. * texture2D(source, qt_TexCoord6) \n" +
- " + 2. / 20. * texture2D(source, qt_TexCoord7) \n" +
- " + 1. / 20. * texture2D(source, qt_TexCoord8)); \n" +
+ "varying highp vec2 qt_TexCoord; \n" +
+ "varying highp vec2 qt_TexCoord2; \n" +
+ "varying highp vec2 qt_TexCoord3; \n" +
+ "varying highp vec2 qt_TexCoord4; \n" +
+ "varying highp vec2 qt_TexCoord5; \n" +
+ "varying highp vec2 qt_TexCoord6; \n" +
+ "varying highp vec2 qt_TexCoord7; \n" +
+ "varying highp vec2 qt_TexCoord8; \n" +
+ "uniform lowp sampler2D source; \n" +
+ "uniform highp float qt_Opacity; \n" +
+ "void main() { \n" +
+ " gl_FragColor = qt_Opacity * (4. / 20. * texture2D(source, qt_TexCoord) \n" +
+ " + 3. / 20. * texture2D(source, qt_TexCoord2) \n" +
+ " + 2. / 20. * texture2D(source, qt_TexCoord3) \n" +
+ " + 1. / 20. * texture2D(source, qt_TexCoord4) \n" +
+ " + 4. / 20. * texture2D(source, qt_TexCoord5) \n" +
+ " + 3. / 20. * texture2D(source, qt_TexCoord6) \n" +
+ " + 2. / 20. * texture2D(source, qt_TexCoord7) \n" +
+ " + 1. / 20. * texture2D(source, qt_TexCoord8)); \n" +
"}"
vertexShader:
- "attribute highp vec4 qt_VertexPosition; \n" +
- "attribute highp vec2 qt_VertexTexCoord; \n" +
- "uniform highp mat4 qt_Matrix; \n" +
- "uniform highp float xStep; \n" +
- "uniform highp float yStep; \n" +
- "uniform highp float spread; \n" +
- "varying highp vec2 qt_TexCoord; \n" +
- "varying highp vec2 qt_TexCoord2; \n" +
- "varying highp vec2 qt_TexCoord3; \n" +
- "varying highp vec2 qt_TexCoord4; \n" +
- "varying highp vec2 qt_TexCoord5; \n" +
- "varying highp vec2 qt_TexCoord6; \n" +
- "varying highp vec2 qt_TexCoord7; \n" +
- "varying highp vec2 qt_TexCoord8; \n" +
- "void main() { \n" +
- " highp vec2 shift = vec2(xStep, yStep); \n" +
- " qt_TexCoord = 0.66 * spread * shift + qt_VertexTexCoord; \n" +
- " qt_TexCoord2 = 2.5 * spread * shift + qt_VertexTexCoord; \n" +
- " qt_TexCoord3 = 4.5 * spread * shift + qt_VertexTexCoord; \n" +
- " qt_TexCoord4 = 6.5 * spread * shift + qt_VertexTexCoord; \n" +
- " qt_TexCoord5 = -0.66 * spread * shift + qt_VertexTexCoord; \n" +
- " qt_TexCoord6 = -2.5 * spread * shift + qt_VertexTexCoord; \n" +
- " qt_TexCoord7 = -4.5 * spread * shift + qt_VertexTexCoord; \n" +
- " qt_TexCoord8 = -6.5 * spread * shift + qt_VertexTexCoord; \n" +
- " gl_Position = qt_Matrix * qt_VertexPosition; \n" +
+ "attribute highp vec4 qt_Vertex; \n" +
+ "attribute highp vec2 qt_MultiTexCoord0; \n" +
+ "uniform highp mat4 qt_Matrix; \n" +
+ "uniform highp float xStep; \n" +
+ "uniform highp float yStep; \n" +
+ "uniform highp float spread; \n" +
+ "varying highp vec2 qt_TexCoord; \n" +
+ "varying highp vec2 qt_TexCoord2; \n" +
+ "varying highp vec2 qt_TexCoord3; \n" +
+ "varying highp vec2 qt_TexCoord4; \n" +
+ "varying highp vec2 qt_TexCoord5; \n" +
+ "varying highp vec2 qt_TexCoord6; \n" +
+ "varying highp vec2 qt_TexCoord7; \n" +
+ "varying highp vec2 qt_TexCoord8; \n" +
+ "void main() { \n" +
+ " highp vec2 shift = vec2(xStep, yStep) * spread; \n" +
+ " qt_TexCoord = 0.66 * shift + qt_MultiTexCoord0; \n" +
+ " qt_TexCoord2 = 2.5 * shift + qt_MultiTexCoord0; \n" +
+ " qt_TexCoord3 = 4.5 * shift + qt_MultiTexCoord0; \n" +
+ " qt_TexCoord4 = 6.5 * shift + qt_MultiTexCoord0; \n" +
+ " qt_TexCoord5 = -0.66 * shift + qt_MultiTexCoord0; \n" +
+ " qt_TexCoord6 = -2.5 * shift + qt_MultiTexCoord0; \n" +
+ " qt_TexCoord7 = -4.5 * shift + qt_MultiTexCoord0; \n" +
+ " qt_TexCoord8 = -6.5 * shift + qt_MultiTexCoord0; \n" +
+ " gl_Position = qt_Matrix * qt_Vertex; \n" +
"}"
- property variant source;
- property real spread: 1;
- property real xStep: 0 / width;
- property real yStep: 1 / height;
+ property real spread: 1
+ property real xStep: 0 / width
+ property real yStep: 1 / height
+ property variant source
active: spread > 0
- anchors.fill: source
smooth: true
-
}
diff --git a/examples/shadereffectitem/Effectoids/DropShadow.qml b/examples/shadereffectitem/Effectoids/DropShadow.qml
index b28a6ef..f93bf15 100644
--- a/examples/shadereffectitem/Effectoids/DropShadow.qml
+++ b/examples/shadereffectitem/Effectoids/DropShadow.qml
@@ -49,39 +49,39 @@ ShaderEffectItem
"varying highp vec2 my_TexCoord2; \n" +
"varying highp vec2 my_TexCoord3; \n" +
"varying highp vec2 my_TexCoord4; \n" +
- "uniform sampler2D source; \n" +
+ "uniform sampler2D source; \n" +
"void main() { \n" +
- " lowp vec4 pix = texture2D(source, qt_TexCoord); \n" +
- " lowp float shadow = (texture2D(source, my_TexCoord1).w \n" +
- " + texture2D(source, my_TexCoord2).w \n" +
- " + texture2D(source, my_TexCoord3).w \n" +
+ " lowp vec4 pix = texture2D(source, qt_TexCoord); \n" +
+ " lowp float shadow = (texture2D(source, my_TexCoord1).w \n" +
+ " + texture2D(source, my_TexCoord2).w \n" +
+ " + texture2D(source, my_TexCoord3).w \n" +
" + texture2D(source, my_TexCoord4).w) * 0.1; \n" +
- " gl_FragColor = mix(vec4(0, 0, 0, shadow), pix, pix.w); \n" +
+ " gl_FragColor = mix(vec4(0, 0, 0, shadow), pix, pix.w); \n" +
"}"
vertexShader:
- "attribute highp vec4 qt_VertexPosition; \n" +
- "attribute highp vec2 qt_VertexTexCoord; \n" +
- "uniform highp mat4 qt_Matrix; \n" +
- "uniform highp float xOffset; \n" +
- "uniform highp float xDisplacement; \n" +
- "uniform highp float yOffset; \n" +
- "uniform highp float yDisplacement; \n" +
- "varying highp vec2 qt_TexCoord; \n" +
- "varying highp vec2 my_TexCoord1; \n" +
- "varying highp vec2 my_TexCoord2; \n" +
- "varying highp vec2 my_TexCoord3; \n" +
- "varying highp vec2 my_TexCoord4; \n" +
- "void main() { \n" +
- " highp vec2 s1 = vec2(xOffset, yOffset); \n" +
- " highp vec2 s2 = vec2(-xOffset, yOffset); \n" +
- " qt_TexCoord = qt_VertexTexCoord; \n" +
- " vec2 shadowPos = qt_VertexTexCoord + vec2(-xDisplacement, yDisplacement); \n" +
- " my_TexCoord1 = shadowPos + s1; \n" +
- " my_TexCoord2 = shadowPos - s1; \n" +
- " my_TexCoord3 = shadowPos + s2; \n" +
- " my_TexCoord4 = shadowPos - s2; \n" +
- " gl_Position = qt_Matrix * qt_VertexPosition; \n" +
+ "attribute highp vec4 qt_Vertex; \n" +
+ "attribute highp vec2 qt_MultiTexCoord0; \n" +
+ "uniform highp mat4 qt_Matrix; \n" +
+ "uniform highp float xOffset; \n" +
+ "uniform highp float xDisplacement; \n" +
+ "uniform highp float yOffset; \n" +
+ "uniform highp float yDisplacement; \n" +
+ "varying highp vec2 qt_TexCoord; \n" +
+ "varying highp vec2 my_TexCoord1; \n" +
+ "varying highp vec2 my_TexCoord2; \n" +
+ "varying highp vec2 my_TexCoord3; \n" +
+ "varying highp vec2 my_TexCoord4; \n" +
+ "void main() { \n" +
+ " highp vec2 s1 = vec2(xOffset, yOffset); \n" +
+ " highp vec2 s2 = vec2(-xOffset, yOffset); \n" +
+ " qt_TexCoord = qt_MultiTexCoord0; \n" +
+ " vec2 shadowPos = qt_MultiTexCoord0 + vec2(-xDisplacement, yDisplacement); \n" +
+ " my_TexCoord1 = shadowPos + s1; \n" +
+ " my_TexCoord2 = shadowPos - s1; \n" +
+ " my_TexCoord3 = shadowPos + s2; \n" +
+ " my_TexCoord4 = shadowPos - s2; \n" +
+ " gl_Position = qt_Matrix * qt_Vertex; \n" +
"}"
property variant source;
@@ -89,7 +89,6 @@ ShaderEffectItem
property real yOffset: 0.66 / height;
property real xDisplacement: 10 / width;
property real yDisplacement: 12 / height;
- anchors.fill: source
+ property variant source
smooth: true
-
}
diff --git a/examples/shadereffectitem/test-boxblur-4point.qml b/examples/shadereffectitem/test-boxblur-4point.qml
index c1b727b..59d9e51 100644
--- a/examples/shadereffectitem/test-boxblur-4point.qml
+++ b/examples/shadereffectitem/test-boxblur-4point.qml
@@ -48,14 +48,51 @@ Item {
height: 540
Box4PointBlur {
- source: box
+ source: ShaderEffectSource {
+ sourceItem: box
+ filtering: ShaderEffectSource.Linear
+ }
anchors.fill: box
- xOffset: 0.5 / width;
- yOffset: 0.5 / height;
+ xOffset: knob.progress / width;
+ yOffset: knob.progress / height;
+ smooth: true
}
MovingBox {
id: box
}
+ Rectangle {
+ id: slider
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ height: 32
+ color: "black"
+ opacity: 0.5
+ }
+
+ Item {
+ id: knob
+ x: 0.5 * (slider.width - knob.width)
+ anchors.top: slider.top
+ anchors.bottom: slider.bottom
+ width: height * 1.5
+ Rectangle {
+ anchors.fill: parent
+ anchors.margins: 2
+ radius: height / 2
+ color: "white"
+ border.width: 2
+ border.color: "black"
+ }
+ property real progress: x / (slider.width - knob.width)
+ MouseArea {
+ anchors.fill: parent
+ drag.target: parent
+ drag.axis: Drag.XAxis
+ drag.minimumX: 0
+ drag.maximumX: slider.width - knob.width
+ }
+ }
}
diff --git a/examples/shadereffectitem/test-colorize.qml b/examples/shadereffectitem/test-colorize.qml
index 06f26f8..a991108 100644
--- a/examples/shadereffectitem/test-colorize.qml
+++ b/examples/shadereffectitem/test-colorize.qml
@@ -48,6 +48,7 @@ Item {
height: 540
Colorize {
+ anchors.fill: effectRoot
source: effectRoot
id: colorizeEffect
color: "#c0c0ff"
diff --git a/examples/shadereffectitem/test-directional-4point.qml b/examples/shadereffectitem/test-directional-4point.qml
index f04976a..08357a8 100644
--- a/examples/shadereffectitem/test-directional-4point.qml
+++ b/examples/shadereffectitem/test-directional-4point.qml
@@ -48,6 +48,7 @@ Item {
height: 540
Directional4PointBlur {
+ anchors.fill: parent
id: blurEffect
yStep: 0
@@ -55,8 +56,10 @@ Item {
blending: false
spread: 0
- source: effectRoot
-
+ source: ShaderEffectSource {
+ sourceItem: effectRoot
+ filtering: ShaderEffectSource.Linear
+ }
}
Item {
@@ -65,7 +68,11 @@ Item {
height: 540
Directional4PointBlur {
- source: innerEffectRoot
+ anchors.fill: parent
+ source: ShaderEffectSource {
+ sourceItem: innerEffectRoot
+ filtering: ShaderEffectSource.Linear
+ }
spread: blurEffect.spread
blending: false
yStep: 1 / height
diff --git a/examples/shadereffectitem/test-directional-8point.qml b/examples/shadereffectitem/test-directional-8point.qml
index e9019c9..0946eb7 100644
--- a/examples/shadereffectitem/test-directional-8point.qml
+++ b/examples/shadereffectitem/test-directional-8point.qml
@@ -49,14 +49,17 @@ Item {
Directional8PointBlur {
id: blurEffect
+ anchors.fill: parent
yStep: 0
xStep: 1 / width
blending: false
spread: 0
- source: effectRoot
-
+ source: ShaderEffectSource {
+ sourceItem: effectRoot
+ filtering: ShaderEffectSource.Linear
+ }
}
Item {
@@ -65,7 +68,11 @@ Item {
height: 540
Directional8PointBlur {
- source: innerEffectRoot
+ anchors.fill: parent
+ source: ShaderEffectSource {
+ sourceItem: innerEffectRoot
+ filtering: ShaderEffectSource.Linear
+ }
spread: blurEffect.spread
blending: false
yStep: 1 / height
diff --git a/examples/shadereffectitem/test-dropshadow.qml b/examples/shadereffectitem/test-dropshadow.qml
index 109a13f..f245890 100644
--- a/examples/shadereffectitem/test-dropshadow.qml
+++ b/examples/shadereffectitem/test-dropshadow.qml
@@ -81,7 +81,11 @@ Image {
DropShadow
{
- source: effectRoot
+ anchors.fill: effectRoot
+ source: ShaderEffectSource {
+ sourceItem: effectRoot
+ filtering: ShaderEffectSource.Linear
+ }
blending: true
}
diff --git a/tests/opacityeffect.qml b/tests/opacityeffect.qml
index 086a572..77d6af9 100644
--- a/tests/opacityeffect.qml
+++ b/tests/opacityeffect.qml
@@ -38,46 +38,6 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt scene graph research project.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
import QtQuick 2.0
@@ -114,27 +74,36 @@ Rectangle {
}
}
+ ShaderEffectSource {
+ id: theSource
+ sourceItem: theItem
+ //sourceImage: "face-smile.png"
+ filtering: ShaderEffectSource.Linear
+ horizontalWrap: ShaderEffectSource.ClampToEdge
+ verticalWrap: ShaderEffectSource.ClampToEdge
+ }
+
ShaderEffectItem {
id: effect
anchors.fill: parent
- property real layeredOpacity: 1
- fragmentShader: "varying highp vec2 qt_TexCoord; \n" +
- "uniform sampler2D qt_Texture; \n" +
- "uniform highp float layeredOpacity; \n" +
- "void main() { \n" +
- " gl_FragColor = texture2D(qt_Texture, qt_TexCoord) * layeredOpacity;\n" +
+ fragmentShader: "varying highp vec2 qt_TexCoord; \n" +
+ "uniform sampler2D source; \n" +
+ "uniform highp float qt_Opacity; \n" +
+ "void main() { \n" +
+ " gl_FragColor = texture2D(source, qt_TexCoord) * qt_Opacity; \n" +
"}"
- source: theItem
- active: layeredOpacity < 0.99
+ //property url source: "face-smile.png"
+ //property variant source: theItem
+ property variant source: theSource
+ active: opacity < 0.99
blending: true
- SequentialAnimation on layeredOpacity {
+ SequentialAnimation on opacity {
NumberAnimation { to: 0; duration: 1000 }
NumberAnimation { to: 1; duration: 1000 }
loops: Animation.Infinite
}
}
-
}