From 7f5a47f8a42edef1e1fb9f689b1463747ef5774d Mon Sep 17 00:00:00 2001 From: Filippo Scognamiglio Date: Wed, 6 Aug 2014 19:07:30 +0200 Subject: [PATCH] Use offline saturation color. Better and a little bit faster. --- app/ApplicationSettings.qml | 5 +++-- app/ShaderTerminal.qml | 7 +------ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/app/ApplicationSettings.qml b/app/ApplicationSettings.qml index 386e110..5d38948 100644 --- a/app/ApplicationSettings.qml +++ b/app/ApplicationSettings.qml @@ -59,8 +59,9 @@ Item{ property string _background_color: "#000000" property string _font_color: "#ff8100" - property color font_color: mix(strToColor(_font_color), strToColor(_background_color), 0.7 + (contrast * 0.3)) - property color background_color: mix(strToColor(_background_color), strToColor(_font_color), 0.7 + (contrast * 0.3)) + property string saturated_color: mix(strToColor("#FFFFFF"), strToColor(_font_color), saturation_color) + property color font_color: mix(strToColor(saturated_color), strToColor(_background_color), 0.7 + (contrast * 0.3)) + property color background_color: mix(strToColor(_background_color), strToColor(saturated_color), 0.7 + (contrast * 0.3)) property real noise_strength: 0.1 property real screen_distortion: 0.1 diff --git a/app/ShaderTerminal.qml b/app/ShaderTerminal.qml index f53d077..b4b12e1 100644 --- a/app/ShaderTerminal.qml +++ b/app/ShaderTerminal.qml @@ -192,12 +192,7 @@ ShaderEffect { (chroma_color !== 0 ? "vec4 realBackColor = texture2D(source, txt_coords);" + - (saturation_color !== 0 ? - "vec4 satured_font_color = mix(font_color, vec4(1) , "+ str(saturation_color) + ");" + - "vec4 mixedColor = mix(font_color, realBackColor * satured_font_color, "+ str(chroma_color) +");" - : - "vec4 mixedColor = mix(font_color, realBackColor * font_color, "+ str(chroma_color) +");" - ) + + "vec4 mixedColor = mix(font_color, realBackColor * font_color, "+ str(chroma_color) +");" + "vec4 finalBackColor = mix(background_color, mixedColor, realBackColor.a);" + "vec3 finalColor = mix(finalBackColor, font_color, color).rgb;"