Re: Problem displaying an RGB image
Geert Uytterhoeven <[email protected]>
| Newsgroups | gmane.linux.fbdev.user |
|---|---|
| Message-ID | <[email protected]> |
On Thu, 5 Jun 2003, Nitin Mahajan wrote:
> I have got a problem displaying an RGB image on to screen by directly
> programming the framebuffer driver. I have attached the program with the
> mail.The sample RGB file is also there.
>
> CFile:main.c
>
> Compilation command I used: gcc -g main.c
>
> Iam not getting the proper Image on the screen.Can anyone please tell
> whre Iam going wrong or what am I missing in this attempt?
Try this patch:
--- putimage/main.c.orig Fri Jun 6 09:29:45 2003
+++ putimage/main.c Fri Jun 6 09:37:01 2003
@@ -96,13 +96,13 @@
location = finfo.line_length?finfo.line_length:vinfo.xres_virtual*3;
for ( y = 0; y < IMAGE_HEIGHT; y++ )
- for ( x = 0; x < IMAGE_WIDTH;x+=3) {
+ for ( x = 0; x < IMAGE_WIDTH; x++) {
/**********Code for displaying Aish RGB***************/
- fbp[y*location+x*3]=buff[y*IMAGE_WIDTH*3+x];
- fbp[y*location+x*3+1]=buff[y*IMAGE_WIDTH*3+x+1];
- fbp[y*location+x*3+2]=buff[y*IMAGE_WIDTH*3+x+2];
+ fbp[y*location+x*3]=buff[(y*IMAGE_WIDTH+x)*3];
+ fbp[y*location+x*3+1]=buff[(y*IMAGE_WIDTH+x)*3+1];
+ fbp[y*location+x*3+2]=buff[(y*IMAGE_WIDTH+x)*3+2];
/******************************************************/
BTW, there's still something wrong with the colors. Are you sure they're in RGB
format?
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The best
thread debugger on the planet. Designed with thread debugging features
you've never dreamed of, try TotalView 6 free at www.etnus.com.