Browse Source

Play around with ShaderEffects

Change-Id: Ib013f44aa803ffe3d356f2410f4d3317446417c2
Donald Carr 5 years ago
parent
commit
d397b10b83
2 changed files with 27 additions and 0 deletions
  1. 1 0
      qml/common/ArtImage.qml
  2. 26 0
      qml/views/trivial/Trivial.qml

+ 1 - 0
qml/common/ArtImage.qml

@@ -8,6 +8,7 @@ Rectangle {
     property var effect
     property int modelIndex
 
+    property alias artwork: image
     property alias asynchronous: image.asynchronous
     property alias source: image.source
 

+ 26 - 0
qml/views/trivial/Trivial.qml

@@ -111,6 +111,32 @@ Item {
                 onHeightChanged: {
                     considerY()
                 }
+
+                /*
+                ShaderEffect {
+                    z: 1
+                    width: src.width; height: src.height
+                    property variant src: artwork
+                    vertexShader: "
+                                  uniform highp mat4 qt_Matrix;
+                                  attribute highp vec4 qt_Vertex;
+                                  attribute highp vec2 qt_MultiTexCoord0;
+                                  varying highp vec2 coord;
+                                  void main() {
+                                      coord = qt_MultiTexCoord0;
+                                      gl_Position = qt_Matrix * qt_Vertex;
+                                  }"
+                    fragmentShader: "
+                                  varying highp vec2 coord;
+                                  uniform sampler2D src;
+                                  uniform lowp float qt_Opacity;
+                                  void main() {
+                                      lowp vec4 tex = texture2D(src, coord);
+                                      gl_FragColor = vec4(vec3(dot(tex.rgb,
+                                                          vec3(0.344, 0.5, 0.156))),
+                                                               tex.a) * qt_Opacity;
+                                  }"
+                }*/
             }
         }