2016-12-19 12 views
2

我試圖從一個正常的圖像 創建感知形象我需要的東西是這樣的 Resultant image如何創建QML一個何衛青圖像

這樣

Source image

我嘗試不同像旋轉和使用像這樣的面具的方法

Image { 
     id: bug 
     source: "./Graphics/sample.png" 
     width: 200 
     height: 200 
     anchors.centerIn: parent 
     sourceSize: Qt.size(parent.width, parent.height) 
     smooth: true 
     transform: Rotation { origin.x: 30; origin.y: 30; axis { x: 0; y: 1; z: 0 } angle: 46 } 
     visible: true 




     layer.enabled: true 
     layer.effect: OpacityMask { 

      maskSource: 

        Image { 
         id: mask 
         source: "./mask.png" 
         sourceSize: Qt.size(parent.width, parent.height) 
         smooth: true 
         visible: false 
        } 



     } 
    } 

是否有任何適當的方法來實際創造這樣的效果。

Mask Image

回答

2

我不知道,如果我這樣做是正確的,但它是像這樣的東西,你想才達到?

Item { 
    width: 1000 
    height: 500 

    anchors.centerIn: parent 
    RectangularGlow { 
     id: effect 
     anchors.fill: img 
     glowRadius: 25 
     spread: 0.2 
     color: "black" 
     cornerRadius: 50 
    } 

    Image { 
     id: img 
     anchors.centerIn: parent 
     width: 1000 
     height: 500 
     source: 'source.png' 


     layer.enabled: true 
     layer.effect: OpacityMask { 

      maskSource: Rectangle { 
       width: 1000 
       height: 500 
       radius: 25 
      } 
     } 
    } 
    transform: Rotation { axis {x: 0.5; y: 1; z: 0} angle: 45 } 
} 

或者,也許這是要應用的,而不是RectangularGlow

DropShadow { 
    anchors.fill: img 
    horizontalOffset: -15 
    verticalOffset: 8 
    radius: 20 
    samples: 40 
    color: "#80000000" 
    source: Rectangle { 
     width: 1000 
     height: 500 
     radius: 25 
    } 
} 
一個 DropShadow