( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Týr
Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
|
Hi I was reading http://bisqwit.iki.fi/story/howto/dither/jy/ and then http://www.efg2.com/Lab/Library/Imag...sing/DHALF.TXT and
was wondering if this (almost complete) snippet would be of use to try a cheap 8bpp -dithered target?
1) This code (in the C programming language) dithers a 256-level
monochrome image onto a black-and-white display with the Bayer ordered
dither.
Spoiler:
PHP Code:
/* Bayer-method ordered dither. The array line[] contains the intensity
** values for the line being processed. As you can see, the ordered
** dither is much simpler than the error dispersion dither. It is also
** many times faster, but it is not as accurate and produces cross-hatch
** patterns on the output.
*/
unsigned char line[WIDTH];
int pattern[8][8] = {
{ 0, 32, 8, 40, 2, 34, 10, 42}, /* 8x8 Bayer ordered dithering */
{48, 16, 56, 24, 50, 18, 58, 26}, /* pattern. Each input pixel */
{12, 44, 4, 36, 14, 46, 6, 38}, /* is scaled to the 0..63 range */
{60, 28, 52, 20, 62, 30, 54, 22}, /* before looking in this table */
{ 3, 35, 11, 43, 1, 33, 9, 41}, /* to determine the action. */
{51, 19, 59, 27, 49, 17, 57, 25},
{15, 47, 7, 39, 13, 45, 5, 37},
{63, 31, 55, 23, 61, 29, 53, 21} };
int getline(); /* Function to read line[] from image */
/* file; must return EOF when done. */
putdot(int x, int y); /* Plot white dot at given x, y. */
dither()
{
int x, y;
while (getline() != EOF) {
for (x=0; x<WIDTH; ++x) {
c = line[x] >> 2; /* Scale value to 0..63 range */
if (c > pattern[x & 7][y & 7]) putdot(x, y);
}
++y;
}
}
and
I guess?
Would dearly love to see a (cheap) dithered target for the touch as the one on the 3 does such a great job. Did think about getting it done myself but once again the maths has stumbled me.
Anyways, I know you are busy but I documented the thought.
Also:
Is the GIT the latest code?
I don't understand how I can get an error message that I cant find in the code???
The one about "4bpp only being supported for now sorry" Am I being stupid?
also this was worth a read http://www.virtualdub.org/blog/pivot/entry.php?id=151
Last edited by twobob; 11-23-2012 at 02:54 PM.
|