I'm still having no luck.
That's the updated version:
What it should do:
- Loop through every pixel of the DrawingCanvas
- Store the pixels rgb value in the temporary variables red, green and blue
- Then check if these values are within +-5% from another (means, if the color is black-ish, gray-ish or white-ish)
- If so, check if (red+green+blue)/3 is above 50 (= white_ink +1) or below (= black_ink +1)
- If the color is not black, gray or white their color proportions will be calculated:
red_ink will be increased by: red/(red+green+blue)
green_ink will be increased by: green/(red+green+blue)
blue_ink will be increased by: blue/(red+green+blue)
For example rgbEx(100,0,100), which is purple, will increase red and blue by 0.5 each.
So, but what it actually does:
- The white color is count correctly if I'm not wrong (if I fill the 800*800 DrawingCanvas with white its about over half a million white pixels)
- Black is count very weird. If I draw a long white line it will increase the white_ink by about 200-300. If I do it with black color it is only increased by 1-5. Sometimes even decreased (?!).
- The colored pixels will not be count at all. In the debug mode NaN will be displayed behind them
.
What am I doing wrong here? Any suggestions please? :D
Thank you in advance <3