Thread: directfb
View Single Post
Old 07-07-2011, 06:00 PM   #4
fbdev
fbdev
fbdev really knows where his or her towel isfbdev really knows where his or her towel isfbdev really knows where his or her towel isfbdev really knows where his or her towel isfbdev really knows where his or her towel isfbdev really knows where his or her towel isfbdev really knows where his or her towel isfbdev really knows where his or her towel isfbdev really knows where his or her towel isfbdev really knows where his or her towel isfbdev really knows where his or her towel is
 
Posts: 107
Karma: 70177
Join Date: Jul 2011
Device: kindle
fixed (kind of)

what i wanted most was anti-aliased fonts (they're gorgeous with this hack!).
anti-aliasing needs A8 pixel format.
i created a surface:

einkdsc.flags
= DSDESC_CAPS|DSDESC_WIDTH|DSDESC_HEIGHT
|DSDESC_PIXELFORMAT|DSDESC_PREALLOCATED;
einkdsc.caps = 0;
einkdsc.width = 600;
einkdsc.height = 800;
einkdsc.pixelformat = DSPF_A8;
einkdsc.preallocated[0].data = screenbuffer;
einkdsc.preallocated[0].pitch = 600;
einkdsc.preallocated[1].data = screenbuffer;
einkdsc.preallocated[1].pitch = 600;
dfb->CreateSurface(dfb,&einkdsc,&eink);

then mmap()ed the framebuffer:
framebuffer
= mmap(NULL,(800 * 600) / 2,PROT_READ|PROT_WRITE,MAP_SHARED,fb,0);

and i blit between the two:

void fbblit(char* dst,char* src)
{
unsigned aa;
aa = 0;
for(;
{
dst[aa] = ((src[aa * 2] & 0xf) << 4) | (src[1 + (aa * 2)] & 0xf);
dst[aa] ^= 0xff;
++aa;
if(((600 * 800) / 2) == aa) break;
}
}
fbdev is offline   Reply With Quote