On Thu, 01 Jun 2006 22:41:35 PDT, heavenscape said: > //create a GdkPixbuf > GdkPixbuf* pb = gdk_pixbuf_new_from_data( pDisplayBuf, // data buffer > GDK_COLORSPACE_RGB, //COLORSPACE > FALSE, // has_alpha, > 8, // int bits_per_sample, > 2048, // int width, > 2048, // int height, > 2048*3, // sizeX*3; //int rowstride, > NULL, //GdkPixbufDestroyNotify destroy_fn, > NULL //gpointer destroy_fn_data); > ); > the results i got is that: the image did appear, but the sizes are shrinked > as 684 X 684 , and there are THREE same images tile in the viewport, the > first and last ones are clipped. 684 is 2048/3, plus rounding. Are you sure that when you *loaded* the image into your pDisplayBuf, you correctly calculated where the various bytes go? Assuming pixel values r, g, and b, storing them into your pDisplayBuf for a given x,y (0-based coordinates 0..2047) is like this: pDisplayBuf[x*3+y] = r; pDisplayBuf[x*3+y+1] = g; pDisplayBuf[x*3+y+2] = b; Hmm... using x+y instead of x*3+y will produce a 1/3 width image and 2/3 trash. Other possibility is you're using 3*y+x instead (confusion of x/y between your code and what Gdk expects).
Attachment:
pgpPUNJHuqV2s.pgp
Description: PGP signature