summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Niemelä <marko.a.niemela@nokia.com>2012-02-01 11:08:03 +0200
committerMarko Niemelä <marko.a.niemela@nokia.com>2012-02-01 11:08:03 +0200
commitda5d1860abd4c4bb821b02404f1709bca3d51b58 (patch)
tree3fbde6361156843c7f151e3099485f0c8f0da982
parentd6b4eb8b9989dcd2e5716ec2aa296169836d8049 (diff)
downloadqtgraphicaleffects-da5d1860abd4c4bb821b02404f1709bca3d51b58.tar.gz
qtgraphicaleffects-da5d1860abd4c4bb821b02404f1709bca3d51b58.tar.bz2
qtgraphicaleffects-da5d1860abd4c4bb821b02404f1709bca3d51b58.zip
RadialBlur offset and angle interpretation changed
-rw-r--r--doc/src/images/RadialBlur_angle1.pngbin20946 -> 22871 bytes
-rw-r--r--doc/src/images/RadialBlur_angle2.pngbin33332 -> 31705 bytes
-rw-r--r--doc/src/images/RadialBlur_angle3.pngbin38197 -> 35937 bytes
-rw-r--r--[-rwxr-xr-x]doc/src/images/RadialBlur_butterfly.pngbin36760 -> 36052 bytes
-rw-r--r--doc/src/images/RadialBlur_horizontalOffset1.pngbin32199 -> 33870 bytes
-rw-r--r--doc/src/images/RadialBlur_horizontalOffset2.pngbin34914 -> 33001 bytes
-rw-r--r--doc/src/images/RadialBlur_horizontalOffset3.pngbin33937 -> 34662 bytes
-rw-r--r--doc/src/qtgraphicaleffects-radialblur.qdoc8
-rw-r--r--src/effects/RadialBlur.qml14
-rw-r--r--tests/manual/testbed/TestRadialBlur.qml4
10 files changed, 17 insertions, 9 deletions
diff --git a/doc/src/images/RadialBlur_angle1.png b/doc/src/images/RadialBlur_angle1.png
index ac3d2aa..10eed9b 100644
--- a/doc/src/images/RadialBlur_angle1.png
+++ b/doc/src/images/RadialBlur_angle1.png
Binary files differ
diff --git a/doc/src/images/RadialBlur_angle2.png b/doc/src/images/RadialBlur_angle2.png
index e340f90..0212f03 100644
--- a/doc/src/images/RadialBlur_angle2.png
+++ b/doc/src/images/RadialBlur_angle2.png
Binary files differ
diff --git a/doc/src/images/RadialBlur_angle3.png b/doc/src/images/RadialBlur_angle3.png
index aedba92..3b26786 100644
--- a/doc/src/images/RadialBlur_angle3.png
+++ b/doc/src/images/RadialBlur_angle3.png
Binary files differ
diff --git a/doc/src/images/RadialBlur_butterfly.png b/doc/src/images/RadialBlur_butterfly.png
index 46374a4..69314be 100755..100644
--- a/doc/src/images/RadialBlur_butterfly.png
+++ b/doc/src/images/RadialBlur_butterfly.png
Binary files differ
diff --git a/doc/src/images/RadialBlur_horizontalOffset1.png b/doc/src/images/RadialBlur_horizontalOffset1.png
index 41df082..5f34885 100644
--- a/doc/src/images/RadialBlur_horizontalOffset1.png
+++ b/doc/src/images/RadialBlur_horizontalOffset1.png
Binary files differ
diff --git a/doc/src/images/RadialBlur_horizontalOffset2.png b/doc/src/images/RadialBlur_horizontalOffset2.png
index 880f68c..771f727 100644
--- a/doc/src/images/RadialBlur_horizontalOffset2.png
+++ b/doc/src/images/RadialBlur_horizontalOffset2.png
Binary files differ
diff --git a/doc/src/images/RadialBlur_horizontalOffset3.png b/doc/src/images/RadialBlur_horizontalOffset3.png
index 054a535..e1d6c37 100644
--- a/doc/src/images/RadialBlur_horizontalOffset3.png
+++ b/doc/src/images/RadialBlur_horizontalOffset3.png
Binary files differ
diff --git a/doc/src/qtgraphicaleffects-radialblur.qdoc b/doc/src/qtgraphicaleffects-radialblur.qdoc
index 6fbb282..19aea5c 100644
--- a/doc/src/qtgraphicaleffects-radialblur.qdoc
+++ b/doc/src/qtgraphicaleffects-radialblur.qdoc
@@ -86,7 +86,7 @@
If angle value is large, more samples are needed to keep the visual quality
at high level.
- Allowed values are between -360.0 and 360.0.
+ Allowed values are between 0.0 and 360.0.
By default the property is set to \c 0.0.
\table
@@ -167,9 +167,9 @@
interpreted to be transparent, which is similar to OpenGL clamp-to-border
extension. The blur is expanded slightly outside the effect item area.
- If the property is set to \c false, the pixels outside the source are
- interpreted to contain the same color as the pixels at the edge of the item,
- which is similar to OpenGL clamp-to-edge behavior. The blur does not expand
+ If the property is set to \c false, the pixels outside the source are
+ interpreted to contain the same color as the pixels at the edge of the item,
+ which is similar to OpenGL clamp-to-edge behavior. The blur does not expand
outside the effect item area.
By default, the property is set to \c false.
diff --git a/src/effects/RadialBlur.qml b/src/effects/RadialBlur.qml
index b44d134..0e63c7b 100644
--- a/src/effects/RadialBlur.qml
+++ b/src/effects/RadialBlur.qml
@@ -74,6 +74,8 @@ Item {
property bool transparentBorder: rootItem.transparentBorder && rootItem.samples > 1
property int samples: rootItem.samples
property real weight: 1.0 / Math.max(1.0, rootItem.samples)
+ property real angleSin: Math.sin(rootItem.angle/2 * Math.PI/180)
+ property real angleCos: Math.cos(rootItem.angle/2 * Math.PI/180)
property real angleSinStep: Math.sin(-rootItem.angle * Math.PI/180 / Math.max(1.0, rootItem.samples - 1))
property real angleCosStep: Math.cos(-rootItem.angle * Math.PI/180 / Math.max(1.0, rootItem.samples - 1))
property variant expandPixels: transparentBorder ? Qt.size(0.5 * parent.height, 0.5 * parent.width) : Qt.size(0,0)
@@ -91,6 +93,8 @@ Item {
varying highp vec2 qt_TexCoord0;
uniform highp float qt_Opacity;
uniform sampler2D source;
+ uniform highp float angleSin;
+ uniform highp float angleCos;
uniform highp float angleSinStep;
uniform highp float angleCosStep;
uniform highp float weight;
@@ -102,14 +106,18 @@ Item {
void main(void) {
highp mat2 m;
- m[0] = vec2(angleCosStep, -angleSinStep);
- m[1] = vec2(angleSinStep, angleCosStep);
gl_FragColor = vec4(0.0);
mediump vec2 texCoord = qt_TexCoord0;
PLACEHOLDER_EXPAND_STEPS
- highp vec2 dir = vec2(texCoord.s * w - w * 0.5, texCoord.t * h - h * 0.5);
+ highp vec2 dir = vec2(texCoord.s * w - w * center.x, texCoord.t * h - h * center.y);
+ m[0] = vec2(angleCos, -angleSin);
+ m[1] = vec2(angleSin, angleCos);
+ dir *= m;
+
+ m[0] = vec2(angleCosStep, -angleSinStep);
+ m[1] = vec2(angleSinStep, angleCosStep);
PLACEHOLDER_UNROLLED_LOOP
diff --git a/tests/manual/testbed/TestRadialBlur.qml b/tests/manual/testbed/TestRadialBlur.qml
index 037ce6f..217329c 100644
--- a/tests/manual/testbed/TestRadialBlur.qml
+++ b/tests/manual/testbed/TestRadialBlur.qml
@@ -72,8 +72,8 @@ TestCaseTemplate {
caption: "general"
Slider {
id: lengthSlider
- minimum: -180.0
- maximum: 180.0
+ minimum: 0.0
+ maximum: 360.0
value: 15.0
caption: "angle"
}