From be7a0e82c4ea3fa04eca4f941a2983256955c1d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Dorn?= Date: Fri, 12 Apr 2024 01:38:16 +0200 Subject: [PATCH] fix: cmyk conversion on pure black (#69) --- src/events/Events.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/events/Events.cpp b/src/events/Events.cpp index e9fb6e1..774d5ed 100644 --- a/src/events/Events.cpp +++ b/src/events/Events.cpp @@ -151,7 +151,7 @@ void Events::handlePointerButton(void* data, struct wl_pointer* wl_pointer, uint // http://www.codeproject.com/KB/applications/xcmyk.aspx float r = 1 - COL.r / 255.0f, g = 1 - COL.g / 255.0f, b = 1 - COL.b / 255.0f; - float k = fmin3(r, g, b), K = 1 - k; + float k = fmin3(r, g, b), K = (k == 1) ? 1 : 1 - k; float c = (r - k) / K, m = (g - k) / K, y = (b - k) / K; c = std::round(c * 100);