Sailfish OS
  • Info
  • User Experience
  • Cases
  • Community
  • Developers
  • Contact
  • Get Sailfish OS
Select Page
  • Info
  • User Experience
  • Cases
  • Community
  • Developers
  • Contact
  • Get Sailfish OS

API Documentation

Documentation for developing SailfishOS applications
  • API Documentation
  • Libsailfishapp
  • Sailfish Silica
    • Documentation
    • Icon Reference
  • Sailfish Components
    • Sailfish Accounts
    • Sailfish Bluetooth
    • Sailfish Contacts
    • Sailfish Crypto
    • Sailfish Gallery
    • Sailfish Media
    • Sailfish Pickers
    • Sailfish Secrets
    • Sailfish Share
    • Sailfish Telephony
    • Sailfish Webview
    • Amber Web Authorization
    • Amber MPRIS
  • Nemo QML Plugins
    • Configuration
    • Contacts
    • D-Bus
    • Keepalive
    • Notifications
    • Thumbnailer
  • Sailfish Middleware
    • MDM Framework
    • MDM Policy Framework
    • User Manager Daemon
  • API Documentation
  • Libsailfishapp
  • Sailfish Silica
    • Documentation
    • Icon Reference
  • Sailfish Components
    • Sailfish Accounts
    • Sailfish Bluetooth
    • Sailfish Contacts
    • Sailfish Crypto
    • Sailfish Gallery
    • Sailfish Media
    • Sailfish Pickers
    • Sailfish Secrets
    • Sailfish Share
    • Sailfish Telephony
    • Sailfish Webview
    • Amber Web Authorization
    • Amber MPRIS
  • Nemo QML Plugins
    • Configuration
    • Contacts
    • D-Bus
    • Keepalive
    • Notifications
    • Thumbnailer
  • Sailfish Middleware
    • MDM Framework
    • MDM Policy Framework
    • User Manager Daemon

Contents

  • Properties
  • Detailed Description

ShaderFilter QML Type

Filters an image using a GLSL shader program. More...

Import Statement: import Sailfish.Silica.Background 1.0
  • List of all members, including inherited members

Properties

  • fragmentShader : string
  • vertexShader : string

Detailed Description

Note: This QML type is under development and is subject to change.

The vertexShader and fragmentShader properties allow the use of standard GLSL shader programs to perform image processing options on the input of a FilteredImage. Both shaders have some limited attributes they expect to be defined in order to input the source imaage but are otherwise unbounded.

Additional data may be passed from QML to a shader by defining a uniform attribute in the shader and a QML property in either the FilteredImage or ShaderFilter with a compatible value with priority given to the FilteredImage properties.

GLSLQML property
float
  • int
  • real
vec2
  • point
  • size
  • Qt.vector2d()
vec3
  • Qt.vector3d()
vec4
  • color
  • Qt.vector4d()
sampler2D
  • Item Items must be texture providers. These include Image, ShaderEffectSource, FilteredImage, or any other item with layer.enabled: true.
  • url This can be the URL of any image file which would otherwise be compatible with the Image type.

Property Documentation

fragmentShader : string

The GLSL fragment shader used to filter an image.

The input texture of the fragment shader is supplied in a uniform named sourceTexture.

 uniform lowp sampler2D sourceTexture;

The values of any QML properties in a FilteredImage or ShaderFilter definition will be used to populate a compatible uniform in the vertex shader.

Additionally the default vertex shader if used produces a varying attribute specifying the texture coordinates to sample the source texture:

 varying highp vec2 sourceCoord;

The default fragment shader is as follows:

 varying highp vec2 sourceCoord;

 uniform lowp sampler2D sourceTexture;

 void main() {
     gl_FragColor = texture2D(sourceTexture, sourceCoord);
 }

vertexShader : string

The GLSL vertex shader used to filter an image

The input vertex coordinates of the vertex shader are suppled in a attribute named position and the input texture coordinates in an attribute named textureCoord. Both are pre-transformed and there are no pre-defined uniform attributes.

 attribute highp vec4 position;
 attribute highp vec2 textureCoord;

The values of any QML properties in a FilteredImage or ShaderFilter definition will be used to populate a compatible uniform in the vertex shader.

The default fragment shader if used expects a varying attribute specifying the texture coordinates to sample the source texture:

 varying highp vec2 sourceCoord;

The default vertex shader is as follows:

 attribute highp vec4 position;
 attribute highp vec2 textureCoord;

 varying highp vec2 sourceCoord;

 void main() {
     gl_Position = position;
     sourceCoord = textureCoord;
 }

  • Legal
  • Contact Us
  • Jolla Mobile Ltd © 2025

  • Facebook
  • Twitter
  • Mastodon
  • YouTube
  • LinkedIn