|
From: <ste...@nt...> - 2001-10-26 08:46:03
|
hi i'm new to framebuffer development. i want to write a small library for my embedded system(MPC823L) with a lcd(SHARP LQ64D341). i use the framebufferdriver(lcd823.c) from the denx.de kernel tree. my problem now is to get control over the colors. i use this to open the framebuffer: int fbfd = 0; long int screensize = 0; unsigned char *fbp = 0; struct fb_fix_screeninfo finfo; struct fb_var_screeninfo vinfo; ... fbfd = open("/dev/fb", O_RDWR); if (ioctl(fbfd, FBIOGET_FSCREENINFO, &finfo)) { if (ioctl(fbfd, FBIOGET_VSCREENINFO, &vinfo)) { screensize = vinfo.xres * vinfo.yres * vinfo.bits_per_pixel / 8; fbp = (unsigned char*)mmap(0, screensize, PROT_READ | PROT_WRITE, MAP_SHARED, fbfd, 0); to set a pixel i use something like this: setPixel(int x, int y, int color){ long int location; location = (x+vinfo.xoffset) * (vinfo.bits_per_pixel/8) + (y+vinfo.yoffset) * finfo.line_length; *(fbp + location) = color; } } but what is the structure of the var color(should the type be unsigned char?)? what is red, green and blue? i know that the driver uses pseudocolor and 8bit per pixel. thanks for helping stefan |