her*_*ong 3 qt image antialiasing qml
我在QML中有一段代码:
Image {
anchors.rightMargin: 10
anchors.leftMargin: 10
anchors.bottomMargin: 10
anchors.topMargin: 10
anchors.fill: parent
source: "Google Chrome Icon.png"
fillMode: Image.PreserveAspectFit
}
Run Code Online (Sandbox Code Playgroud)
图像会随窗口自动拉伸.但拉伸方法没有抗锯齿,因此丑陋的结果:
chrome image http://img838.imageshack.us/img838/667/unantialiasedchrome.png
有没有什么方法可以让结果变得更好?
作为一个纯粹的QML解决方案,您可以简单地设置smooth
属性的的Image
元素true
:
import QtQuick 1.0
Image {
smooth: true // smoother image
anchors.rightMargin: 10
anchors.leftMargin: 10
anchors.bottomMargin: 10
anchors.topMargin: 10
anchors.fill: parent
source: "Google Chrome Icon.png"
fillMode: Image.PreserveAspectFit
}
Run Code Online (Sandbox Code Playgroud)