【发布时间】:2017-09-19 10:55:22
【问题描述】:
我的组件代码是这样的:
import QtQuick 2.5
Item {
id: root
width: 315
height: 315
property bool active
Image {
id: srcImage
width: root.width
height: root.height
source: "/test.png"
y: root.active ? 0 : 300
}
ShaderEffectSource {
id: snapshotter
sourceItem: {
if(root.active) {
return srcImage;
} else {
// Work around a bug that causes the snapshotter to lose its
// contents. (see http://stackoverflow.com/a/43067294 )
return snapshotter;
}
}
width: root.width
height: root.height
live: root.active
recursive: sourceItem == snapshotter
textureSize: Qt.size(root.width, root.height)
y: live ? 300 : 0
}
}
我得到了这样的结果(并排破碎和完整):
我找出原因,我会直接发布它作为答案。
【问题讨论】:
-
Shader 输出似乎不支持 qml 中的抗锯齿:stackoverflow.com/questions/40329703/… 甚至可能是一个错误。
-
@dtech:您链接的问题是关于另一个问题 - OpenGL 几何的边缘像素的混叠。在我的情况下,问题在整个纹理中都是可见的。