How to write customQML Text shader using distance field?
-
As I know, Qml Text use distance field technique to render text. I wish i had direct acess to that distance field texture to achieve custom Text effect ,(I know that i can use layer mechanism and render Text to texture and then apply some effect but that's not what I want to achieve). How to do that?
Text{ id:test_text x:parent.width text: "Hello World!!" font.family: "Helvetica" font.bold: true font.pixelSize :parent.height*0.65 color: "black" anchors.verticalCenter: parent.verticalCenter ShaderEffect { property variant source: ShaderEffectSource { sourceItem: test_text; hideSource: false } anchors.fill: parent fragmentShader: " uniform sampler2D source; varying highp vec2 qt_TexCoord0; void main(void) { if(texture2D(source, qt_TexCoord0).a < 0.5) gl_FragColor = vec4(1.0,1.0,0.0,0.000); } " } }