Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync: from linuxdeepin/dtkdeclarative #156

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions examples/qml-inspect/Example_3.qml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,28 @@ Item {
invert: true
}

Rectangle {
id: sourceItem1
x: 300
y: 50
width: 200
height: 200
color: "green"
}

DRadiusEffect {
x: 300
y: 300
width: 200
height: 200
sourceItem: sourceItem1
radius: 30
topRightRadius: 10
topLeftRadius: 20
bottomRightRadius: 30
bottomLeftRadius: 40
}

BoxShadow {
hollow: true
anchors.fill: shadowedRect
Expand Down
2 changes: 2 additions & 0 deletions qt6/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ qt_add_shaders(${LIB_NAME} "_shaders_ng"
"shaders_ng/cornerscolorshader.frag"
"shaders_ng/shadowmaterial.vert"
"shaders_ng/shadowmaterial.frag"
"shaders_ng/radiussmoothtexture.vert"
"shaders_ng/radiussmoothtexture.frag"
)

include(${PROJECT_SOURCE_DIR}/qmlplugin/targets.cmake)
Expand Down
13 changes: 13 additions & 0 deletions qt6/src/shaders_ng/radiussmoothtexture.frag
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#version 440

layout(location = 0) in vec2 texCoord;
layout(location = 1) in float vertexOpacity;

layout(location = 0) out vec4 fragColor;

layout(binding = 1) uniform sampler2D qt_Texture;

void main()
{
fragColor = texture(qt_Texture, texCoord) * vertexOpacity;
}
24 changes: 24 additions & 0 deletions qt6/src/shaders_ng/radiussmoothtexture.vert
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#version 440

layout(location = 0) in vec4 vertex;
layout(location = 1) in vec2 multiTexCoord;
layout(location = 2) in float vertexOpacityIn;

layout(location = 0) out vec2 texCoord;
layout(location = 1) out float vertexOpacity;

layout(std140, binding = 0) uniform buf {
mat4 qt_Matrix;
float opacity;
vec2 pixelSize;
} ubuf;

out gl_PerVertex { vec4 gl_Position; };

void main()
{
vec4 pos = ubuf.qt_Matrix * vertex;
gl_Position = pos;
texCoord = multiTexCoord;
vertexOpacity = ubuf.opacity * vertexOpacityIn;
}
Loading
Loading