[Xcb] xcb_put_image

Matthew Allen fret at memecode.com
Sun Dec 14 16:56:17 PST 2008


What sort of bitmap organization is need to supply bitmap data to xcb_put_image?

I initially allocated a single block of memory, where 'x', 'y' are the dimensions of my bitmap and 'Bits' is the bits per pixel:

	Line = ((x * Bits) + 7) / 8;
	Mem = new uint8[Line * y];
	
then

	xcb_create_pixmap(conn, Bits, pix_hnd, xcb_screen->root, x, y);
	xcb_put_image(conn, XCB_IMAGE_FORMAT_Z_PIXMAP, pix_hnd, gc, x, y, 0, 0, 0, Bits, Line * y, Mem);
	
gives the error "length" (16). Maybe my understanding on the data_len parameter is wrong?

I'm assuming that the Line * y is messing things up? What arrangment should I have? Values for x,y,Bits are 320,16,24 which gives a Line value of 960. And Line * y will be the exact amount of bytes in the entire bitmap... so I don't see why I'd be getting this error.

Although I'm not sure what to pass into xcb_create_pixmap's 'drawable' parameter. I don't necessarily have a window on hand to pass, as this code is just general bitmap handling stuff that is disconnected somewhat from the UI layer.
--
Matthew Allen



More information about the Xcb mailing list