src/colors.cpp

changeset 43
08dc62e03a6d
parent 35
98906a94732f
child 94
164f53fb5921
--- a/src/colors.cpp	Sun Feb 02 00:49:32 2020 +0200
+++ b/src/colors.cpp	Sun Feb 02 00:50:57 2020 +0200
@@ -82,3 +82,12 @@
 		}
 	}
 }
+
+/*
+ * Calculates the luma-value for the given color.
+ * c.f. https://en.wikipedia.org/wiki/Luma_(video)
+ */
+double luma(const QColor& color)
+{
+	return 0.2126 * color.redF() + 0.7152 * color.greenF() + 0.0722 * color.blueF();
+}

mercurial