Carpe diem, c'est la vie.
Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
Quote:
Originally Posted by hawhill
Yep, the dithering (in this case: halftoning) is not really fit to the input parameters, I think. Thus a few "frackles" are left on pure-white areas (I think, or were it the pure-black areas?). However, this mode isn't really made for reading text. The resolution is _low_. But it was asked for, so I did it (and I was curious, too).
jmseight: It will be OK to comment out Lua, but you won't have input support then.
However there is no way around libvncclient (it brings the set of rfb* functions). It's (ironically) part of libvncserver. http://libvncserver.sourceforge.net/ It will probably a bit of work to compile it with a TCC toolchain, though. Though I could be wrong. I never tried (yet).
|
I have a replacement dither table. When I was developing it, for some reason (I cannot remember why) I added 1 to all the values. The new one removes that and it is correct now.
Spoiler:
PHP Code:
/======================================== // setpx - draw pixel using ordered dither // x,y: screen coordinates, c: color(0-64). // (This works on all eink kindle models.) //---------------------------------------- inline void setpx(int x,int y,int c) { static int dt[64] = { 0,32,8,40,2,34,10,42,48,16,56,24,50,18,58,26,12,44,4, 36,14,46,6,38,60,28,52,20,62,30,54,22,3,35,11,45,1,33,9,41,51,19,59,27,49, 17,57,25,15,47,7,39,13,45,5,37,63,31,55,23,61,29,53,21 }; // dither table fb0[pb*x/8+fs*y]=((128&(c-dt[(7&x)+8*(7&y)]))/128*(blk&(240*(1&~x)| 15*(1&x)|fb0[pb*x/8+fs*y])))|((128&(dt[(7&x)+8*(7&y)]-c))/128*wht| (blk&((240*(1&x)|15*(1&~x))&fb0[pb*x/8+fs*y]))); // geekmaster formula 42 }
The rest of the program is here (palpump): https://www.mobileread.com/forums/sho....php?p=2048756
You need to remember when scaling that the range for an 8x8 table is 65, not 64 values. If you have 6-bit values, you will either lose pure black, or you will lose pure white.
You *could* subtract one from all the numbers above 32, sacrificing the 50-percent checkerboard (the best gray). You need to throw away ONE of the shades of gray somewhere in the palette to get 0-63...
I still cannot remember why I thought I needed to add one to all my palette values.
Last edited by geekmaster; 04-19-2012 at 05:27 AM.
|