The right mouse button to adjust brightness, contr
no vote
To adjust the brightness and contrast of the picture by the right mouse button. There are scanners code. Adjust the contrast, brightness code is very simple. From site VOID CScanToDocDlg::BrightAndContrast(HBITMAP hBitmap, INT bright, INT contrast, BYTE threshold) { FLOAT cv = contrast <= -255? -1.0f : contrast / 255.0f; if (contrast > 0 && contrast < 255) cv = 1.0f / (1.0f - cv) - 1.0f; BYTE values[256]; for (INT i = 0; i < 256; i ++) { INT v = contrast > 0? CheckValue(i + bright) : i; if (contrast >= 255) v = v >= threshold? 255 : 0; else v = CheckValue(v + (INT)((v - threshold) * cv + 0.5f)); values[i] = contrast < 0? CheckValue(v + bright) : v; } BITMAP bm; GetObject(hBitmap, sizeof(BITMAP), &b