import QtQuick import QtQuick.Effects // Liquid glass over the lock screen backdrop (see shaders/glass.frag). // Must be a direct child of the item that `backdrop` covers, so its own x/y // map straight onto the backdrop. The shape is a rounded rectangle unless // `shape` children are supplied (drawn opaque, e.g. white Text). Item { id: root required property var backdrop // ShaderEffectSource of the frosted backdrop required property Item space // item the backdrop covers (this item's parent) property real radius: Math.min(width, height) / 2 property bool glass: true property color tint: "#000000" property real tintAmount: 0.18 property real brightness: LockState.glass.brightness default property alias shape: shapeHolder.data readonly property bool customShape: shapeHolder.children.length > 1 Item { id: shapeHolder anchors.fill: parent Rectangle { anchors.fill: parent radius: root.radius visible: !root.customShape && root.glass } } // With glass off the custom shape stays visible as-is (e.g. white clock digits). ShaderEffectSource { id: maskSource sourceItem: shapeHolder hideSource: root.glass visible: false } MultiEffect { id: heightEffect anchors.fill: parent source: maskSource blurEnabled: true blur: 1 blurMax: Math.round(LockState.glass.edge) autoPaddingEnabled: false visible: false } ShaderEffectSource { id: heightSource sourceItem: heightEffect hideSource: true visible: false } ShaderEffect { anchors.fill: parent visible: root.glass && root.space.width > 0 property variant backdropMap: root.backdrop property variant maskMap: maskSource property variant heightMap: heightSource property vector4d sourceRect: Qt.vector4d(root.x / root.space.width, root.y / root.space.height, root.width / root.space.width, root.height / root.space.height) property point pixelStep: Qt.point(1 / Math.max(1, root.width), 1 / Math.max(1, root.height)) property real refraction: LockState.glass.refraction property real dispersion: LockState.glass.dispersion property real fresnel: LockState.glass.fresnel property real specular: LockState.glass.specular property real brightness: root.brightness property real saturation: LockState.glass.saturation property vector4d tint: Qt.vector4d(root.tint.r, root.tint.g, root.tint.b, root.tintAmount) fragmentShader: Qt.resolvedUrl("shaders/glass.frag.qsb") } // Without glass: a plain translucent surface with a hairline. Item { anchors.fill: parent visible: !root.glass Rectangle { anchors.fill: parent visible: !root.customShape radius: root.radius color: Qt.alpha("#ffffff", 0.16) border.width: 1 border.color: Qt.alpha("#ffffff", 0.25) } } }