diff options
Diffstat (limited to 'examples/shadereffectitem/Effectoids/Colorize.qml')
-rw-r--r-- | examples/shadereffectitem/Effectoids/Colorize.qml | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/examples/shadereffectitem/Effectoids/Colorize.qml b/examples/shadereffectitem/Effectoids/Colorize.qml new file mode 100644 index 0000000..74fc4cd --- /dev/null +++ b/examples/shadereffectitem/Effectoids/Colorize.qml @@ -0,0 +1,31 @@ +import QtQuick 2.0 + +ShaderEffectItem +{ + fragmentShader: + "varying highp vec2 qt_TexCoord; \n" + + "uniform sampler2D qt_Texture; \n" + + "uniform lowp vec4 color; \n" + + "uniform lowp float intensity; \n" + + "void main() { \n" + + " lowp vec4 pix = texture2D(qt_Texture, 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" + + "}" + + 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" + + "}" + + property color color; + property real intensity; + active: intensity > 0 + anchors.fill: source + +} |