Quote:
Originally Posted by jmseight
Hi,
I was thinking of something like this in the rfb16ToHalftonedFramebuffer4() function.
From:
Code:
if(c < *mp++) {
dval |= 0x0F;
}
To:
Code:
if(c <= BLK || (c <= WHT && c < *mp++)) {
dval |= 0x0F;
}
where BLK and WHT can be read from the command line.
Maybe BLK = 4 and WHT = 11 or something else.
This would allow easy testing instead of changing the dithering table.
I am not sure how to do this in geekmaster's formula...
Thanks,
James
|
You just replace some of the high and low threshold values in the dither table. For example, change numbers below 16 to 0, and change numbers above 48 to 64. No need for any CODE changes. You could also expand the range of the remaining values, and even adjust the gamma, by replacing numbers in that table. No code changes.
I will make a new 8x8 dither version that uses values in the 0-255 range, adjusting the values in the dither table accordingly. That way we can display 8-bit PNG files without needing to rescale the pixel values to 0-64. In fact, I already tested this without changing the dither table by adding a little extra code (for testing).
You can adjust brightness, contrast, gamma, invert (negative), and clamping (forcing values NEAR black or white to pure black or white), all by replacing numbers in the dither table. I am thinking of having multiple pre-computed dither tables, and you select which table you want when you call the setpx() function.
I need a function that COMPUTES a dither table during one-time initialization, or any time you adjust display settings (brightness, contrast, gamma, etc.).
It is nice when ALL the adjustments can be done by precomputing the dither table.