[Xcb] xcb_put_image

Peter Harris peter.harris at hummingbird.com
Mon Dec 15 07:53:53 PST 2008


Matthew Allen wrote:
>> What sort of bitmap organization is need to supply bitmap data to 
>> xcb_put_image? 

See xcb_get_setup() and xcb_setup_pixmap_formats().

>> 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;

You want (pseudocode):
  find pixmap format
  Line = ((x * format->bits_per_pixel) + 7) / 8;
  Line = pad(Line, format->scanline_pad);

Also, setup->image_byte_order is important, as are
xcb_depth_visuals()->red_mask, green_mask, and blue_mask. Without those
pieces of information, you don't know which bits correspond to which
colours.

xcb_image.h (from xcb/util) has a number of useful functions that may
help when dealing with images.

Peter Harris
-- 
               Open Text Connectivity Solutions Group
Peter Harris                    http://www.opentext.com/connectivity
Research and Development        Phone: +1 905 762 6001
peter.harris at opentext.com       Toll Free: 1 877 359 4866


More information about the Xcb mailing list