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?
Last edited by sumitshining; 12-20-2008 at 11:39 AM.
|