Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Item {
- id: mainpage
- Rectangle {
- width: 200
- height: 200
- color: "transparent"
- //this Rectangle is needed to keep the source image's fillMode
- Rectangle {
- id: imageSource
- anchors.fill: parent
- Image {
- anchors.fill: parent
- source: "qrc:/_84154370_facebook.jpg"
- fillMode: Image.PreserveAspectCrop
- }
- visible: false
- layer.enabled: true
- }
- Rectangle {
- id: maskLayer
- anchors.fill: parent
- radius: parent.width / 2
- color: "red"
- border.color: "black"
- layer.enabled: true
- layer.samplerName: "maskSource"
- layer.effect: ShaderEffect {
- property var colorSource: imageSource
- fragmentShader: "
- uniform lowp sampler2D colorSource;
- uniform lowp sampler2D maskSource;
- uniform lowp float qt_Opacity;
- varying highp vec2 qt_TexCoord0;
- void main() {
- gl_FragColor =
- texture2D(colorSource, qt_TexCoord0)
- * texture2D(maskSource, qt_TexCoord0).a
- * qt_Opacity;
- }
- "
- }
- }
- // only draw border line
- Rectangle {
- anchors.fill: parent
- radius: parent.width / 2
- border.color: "black"
- border.width: 1
- color: "transparent"
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement