diff --git a/app/qml/ApplicationSettings.qml b/app/qml/ApplicationSettings.qml index f286184..3d73a3f 100644 --- a/app/qml/ApplicationSettings.qml +++ b/app/qml/ApplicationSettings.qml @@ -88,6 +88,9 @@ QtObject{ property real rbgShift: 0.0 + property real _margin: 0.5 + property real margin: Utils.lint(1.0, 20.0, _margin) + readonly property int no_rasterization: 0 readonly property int scanline_rasterization: 1 readonly property int pixel_rasterization: 2 @@ -225,7 +228,8 @@ QtObject{ ambientLight: ambientLight, windowOpacity: windowOpacity, fontName: fontNames[rasterization], - fontWidth: fontWidth + fontWidth: fontWidth, + margin: _margin } return settings; } @@ -317,6 +321,8 @@ QtObject{ fontNames[rasterization] = settings.fontName !== undefined ? settings.fontName : fontNames[rasterization]; fontWidth = settings.fontWidth !== undefined ? settings.fontWidth : fontWidth; + _margin = settings.margin !== undefined ? settings.margin : _margin; + handleFontChanged(); } @@ -386,7 +392,8 @@ QtObject{ "saturationColor": 0.2483, "screenCurvature": 0.3, "staticNoise": 0.1198, - "windowOpacity": 1 + "windowOpacity": 1, + "margin": 0.5 }' builtin: true } @@ -413,7 +420,8 @@ QtObject{ "saturationColor": 0.0, "screenCurvature": 0.3, "staticNoise": 0.1198, - "windowOpacity": 1 + "windowOpacity": 1, + "margin": 0.5 }' builtin: true } @@ -440,7 +448,8 @@ QtObject{ "saturationColor": 0.5, "screenCurvature": 0.3, "staticNoise": 0.15, - "windowOpacity": 1 + "windowOpacity": 1, + "margin": 0.5 }' builtin: true } @@ -467,7 +476,8 @@ QtObject{ "saturationColor": 0, "screenCurvature": 0, "staticNoise": 0.15, - "windowOpacity": 1 + "windowOpacity": 1, + "margin": 0.5 }' builtin: true } @@ -494,7 +504,8 @@ QtObject{ "saturationColor": 0, "screenCurvature": 0.5, "staticNoise": 0.099, - "windowOpacity": 1 + "windowOpacity": 1, + "margin": 0.5 }' builtin: true } @@ -521,7 +532,8 @@ QtObject{ "saturationColor": 0, "screenCurvature": 0.5, "staticNoise": 0.2969, - "windowOpacity": 1 + "windowOpacity": 1, + "margin": 0.5 }' builtin: true } @@ -548,7 +560,8 @@ QtObject{ "saturationColor": 0, "screenCurvature": 0.4, "staticNoise": 0.0503, - "windowOpacity": 1 + "windowOpacity": 1, + "margin": 0.5 }' builtin: true } @@ -575,7 +588,8 @@ QtObject{ "saturationColor": 0, "screenCurvature": 0.2, "staticNoise": 0, - "windowOpacity": 1 + "windowOpacity": 1, + "margin": 0.5 }' builtin: true } @@ -602,7 +616,8 @@ QtObject{ "saturationColor": 0.4983, "screenCurvature": 0, "staticNoise": 0.0955, - "windowOpacity": 0.7 + "windowOpacity": 0.7, + "margin": 0.1 }' builtin: true } diff --git a/app/qml/BurnInEffect.qml b/app/qml/BurnInEffect.qml index 7d1a9e8..678bd65 100644 --- a/app/qml/BurnInEffect.qml +++ b/app/qml/BurnInEffect.qml @@ -36,12 +36,12 @@ Loader { property int burnInScaling: scaleTexture * appSettings.burnInQuality width: appSettings.lowResolutionFont - ? kterminal.width * Math.max(1, burnInScaling) - : kterminal.width * scaleTexture * appSettings.burnInQuality + ? kterminal.totalWidth * Math.max(1, burnInScaling) + : kterminal.totalWidth * scaleTexture * appSettings.burnInQuality height: appSettings.lowResolutionFont - ? kterminal.height * Math.max(1, burnInScaling) - : kterminal.height * scaleTexture * appSettings.burnInQuality + ? kterminal.totalHeight * Math.max(1, burnInScaling) + : kterminal.totalHeight * scaleTexture * appSettings.burnInQuality ShaderEffectSource { id: burnInEffectSource @@ -52,7 +52,7 @@ Loader { live: false recursive: true hideSource: true - wrapMode: kterminalSource.wrapMode + wrapMode: ShaderEffectSource.ClampToEdge format: ShaderEffectSource.RGBA diff --git a/app/qml/NewTerminalFrame.qml b/app/qml/NewTerminalFrame.qml index 2ed3ff1..537fa73 100644 --- a/app/qml/NewTerminalFrame.qml +++ b/app/qml/NewTerminalFrame.qml @@ -3,7 +3,7 @@ import QtQuick 2.0 import "utils.js" as Utils ShaderEffect { - property color _staticFrameColor: "#dedede" + property color _staticFrameColor: "#ffffff" property color _backgroundColor: appSettings.backgroundColor property color _fontColor: appSettings.fontColor property color _lightColor: Utils.mix(_fontColor, _backgroundColor, 0.2) @@ -42,6 +42,10 @@ ShaderEffect { return min(v.x, v.y); } + float prod2(vec2 v) { + return v.x * v.y; + } + float sum2(vec2 v) { return v.x + v.y; } @@ -54,6 +58,7 @@ ShaderEffect { float alpha = 0.0; float outShadowLength = shadowLength; + float inShadowLength = shadowLength * 0.5; float outShadow = max2(1.0 - smoothstep(vec2(-outShadowLength), vec2(0.0), coords) + smoothstep(vec2(1.0), vec2(1.0 + outShadowLength), coords)); outShadow = clamp(0.0, 1.0, sqrt(outShadow)); @@ -61,6 +66,10 @@ ShaderEffect { alpha = sum2(1.0 - smoothstep(vec2(0.0), aadelta, coords) + smoothstep(vec2(1.0) - aadelta, vec2(1.0), coords)); alpha = clamp(alpha, 0.0, 1.0) * mix(1.0, 0.9, outShadow); + float inShadow = 1.0 - prod2(smoothstep(0.0, inShadowLength, coords) - smoothstep(1.0 - inShadowLength, 1.0, coords)); + inShadow = 0.5 * inShadow * inShadow; + alpha = max(alpha, inShadow); + gl_FragColor = vec4(color * alpha, alpha); } " diff --git a/app/qml/PreprocessedTerminal.qml b/app/qml/PreprocessedTerminal.qml index e5d9e93..26ea48e 100644 --- a/app/qml/PreprocessedTerminal.qml +++ b/app/qml/PreprocessedTerminal.qml @@ -28,7 +28,7 @@ import "utils.js" as Utils Item{ id: terminalContainer - property size virtualResolution: Qt.size(kterminal.width, kterminal.height) + property size virtualResolution: Qt.size(kterminal.totalWidth, kterminal.totalHeight) property alias mainTerminal: kterminal property ShaderEffectSource mainSource: kterminalSource @@ -69,6 +69,11 @@ Item{ QMLTermWidget { id: kterminal + + property real margin: appSettings.margin / screenScaling + property real totalWidth: 2 * margin + width + property real totalHeight: 2 * margin + height + width: Math.floor(parent.width / (screenScaling * fontWidth)) height: Math.floor(parent.height / screenScaling) @@ -167,6 +172,8 @@ Item{ property alias contextmenu: menuLoader.item MouseArea{ + property real margin: appSettings.margin + acceptedButtons: Qt.LeftButton | Qt.MiddleButton | Qt.RightButton anchors.fill: parent cursorShape: kterminal.terminalUsesMouse ? Qt.ArrowCursor : Qt.IBeamCursor @@ -200,14 +207,14 @@ Item{ } function correctDistortion(x, y){ - x = x / width; - y = y / height; + x = (x - margin) / width; + y = (y - margin) / height; var cc = Qt.size(0.5 - x, 0.5 - y); var distortion = (cc.height * cc.height + cc.width * cc.width) * appSettings.screenCurvature * appSettings.screenCurvatureSize; - return Qt.point((x - cc.width * (1+distortion) * distortion) * kterminal.width, - (y - cc.height * (1+distortion) * distortion) * kterminal.height) + return Qt.point((x - cc.width * (1+distortion) * distortion) * kterminal.totalWidth, + (y - cc.height * (1+distortion) * distortion) * kterminal.totalHeight) } } ShaderEffectSource{ @@ -216,7 +223,8 @@ Item{ hideSource: true wrapMode: ShaderEffectSource.Repeat visible: false - textureSize: Qt.size(kterminal.width * scaleTexture, kterminal.height * scaleTexture); + textureSize: Qt.size(kterminal.totalWidth * scaleTexture, kterminal.totalHeight * scaleTexture) + sourceRect: Qt.rect(-kterminal.margin, -kterminal.margin, kterminal.totalWidth, kterminal.totalHeight) } BurnInEffect { diff --git a/app/qml/SettingsEffectsTab.qml b/app/qml/SettingsEffectsTab.qml index 5ca521b..55e67ab 100644 --- a/app/qml/SettingsEffectsTab.qml +++ b/app/qml/SettingsEffectsTab.qml @@ -109,6 +109,11 @@ Tab{ onValueChanged: appSettings.windowOpacity = value value: appSettings.windowOpacity } + Label{ text: qsTr("Margin") } + SimpleSlider{ + onValueChanged: appSettings._margin = value + value: appSettings._margin + } } } }