From 7d4b21f4d92835bae7283a34afb1d74d874e28c8 Mon Sep 17 00:00:00 2001 From: Christoph Weitkamp Date: Wed, 28 Aug 2019 22:24:16 +0200 Subject: [PATCH] Fix gamma correction in HSBType (#996) Signed-off-by: Christoph Weitkamp --- .../org/eclipse/smarthome/core/library/types/HSBType.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bundles/org.openhab.core/src/main/java/org/eclipse/smarthome/core/library/types/HSBType.java b/bundles/org.openhab.core/src/main/java/org/eclipse/smarthome/core/library/types/HSBType.java index 05e8ee0c4..f1a47e2a0 100644 --- a/bundles/org.openhab.core/src/main/java/org/eclipse/smarthome/core/library/types/HSBType.java +++ b/bundles/org.openhab.core/src/main/java/org/eclipse/smarthome/core/library/types/HSBType.java @@ -335,7 +335,7 @@ public class HSBType extends PercentType implements ComplexType, State, Command c = 1.0f; } - return c <= 0.0031308f ? 19.92f * c : (1.0f + 0.055f) * (float) Math.pow(c, 1.0f / 2.4f) - 0.055f; + return c <= 0.0031308f ? 12.92f * c : (1.0f + 0.055f) * (float) Math.pow(c, 1.0f / 2.4f) - 0.055f; } // Gamma decompression (sRGB) for a single component, in the 0.0 - 1.0 range @@ -346,7 +346,7 @@ public class HSBType extends PercentType implements ComplexType, State, Command c = 1.0f; } - return c <= 0.04045f ? c / 19.92f : (float) Math.pow((c + 0.055f) / (1.0f + 0.055f), 2.4f); + return c <= 0.04045f ? c / 12.92f : (float) Math.pow((c + 0.055f) / (1.0f + 0.055f), 2.4f); } /**