LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   image pixel information retrieval in gtk ? (https://www.linuxquestions.org/questions/programming-9/image-pixel-information-retrieval-in-gtk-691910/)

sumitshining 12-20-2008 11:38 AM

image pixel information retrieval in gtk ?
 
I have retrieved an image. Now I have to retrieve pixel information.
I tried the following code...

width = gdk_pixbuf_get_width (pixbuf);
height = gdk_pixbuf_get_height (pixbuf);

rowstride = gdk_pixbuf_get_rowstride (pixbuf);
pixels = gdk_pixbuf_get_pixels (pixbuf);

for(y=0;y<height;y++)
{ for(x=0;x<width;x++)
{p = pixels + y * rowstride + x * n_channels;
}
}

its ok with that, but when I'm trying to print this data or use this data anyway simultaneously....using following method:
printf("%d",p[0]);
printf("%d",p[1]);
printf("%d",p[2]);

following error is recieved:
subscripted value is neither array nor pointer

So can anyone tell me, where's the error?

David1357 12-20-2008 02:37 PM

Quote:

Originally Posted by sumitshining (Post 3382243)
So can anyone tell me, where's the error?

What is "p" declared as?


All times are GMT -5. The time now is 11:47 AM.