From ec7b44b3f34cad781f1c1e6defd1b133efbfde24 Mon Sep 17 00:00:00 2001 From: daleclack Date: Sun, 5 May 2024 10:58:47 +0800 Subject: [PATCH] Update gray color checker --- Gtk4/src/core/MainWin.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Gtk4/src/core/MainWin.cpp b/Gtk4/src/core/MainWin.cpp index d6bbdb5..9455fbb 100644 --- a/Gtk4/src/core/MainWin.cpp +++ b/Gtk4/src/core/MainWin.cpp @@ -46,9 +46,9 @@ static int get_gray_color(GdkPixbuf *pixbuf) int red = 0, green = 0, blue = 0; // Calculate the color of image of 20x20 pixels - for (int i = 0; i < 20; i++) + for (int i = 0; i < 10; i++) { - for (int j = 0; j < 20; j++) + for (int j = 0; j < 10; j++) { guchar *p = pixels + j * rowstride + i * n_channels; red += p[0]; @@ -56,9 +56,9 @@ static int get_gray_color(GdkPixbuf *pixbuf) blue += p[2]; } } - red /= 400; - green /= 400; - blue /= 400; + red /= 100; + green /= 100; + blue /= 100; // Calculate the gray number from the pixels int gray = (red * 299 + green * 587 + blue * 114 + 500) / 1000;