fix: cmyk conversion on pure black (#69)

This commit is contained in:
Félix Dorn 2024-04-12 01:38:16 +02:00 committed by GitHub
parent 0eb49192a5
commit be7a0e82c4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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);