meanings of XBM encyclopedia of XBM dictionary of XBM thesaurus on XBM books about XBM dreams about XBM
 XBM - Definition 

XBM (X BitMap) is an ASCII monochrome image format used by the X Window System and is used for storing cursor and icon bitmaps that are used in the X GUI. XBM files are quite different from most image files in that they are actually C language source files that are created to be read by a C compiler rather than a graphical display program.

XBM data is typically found in headers (.h files) and are a series of static unsigned char arrays containing the monochrome pixel data. There is one array per image stored in the header.

As an example, the following piece of C code is an XBM file:

#define test_width 16
#define test_height 7
static char img_bits[] = {
0x13, 0x00, 0x15, 0x00, 0x93, 0xcd, 0x55, 0xa5, 0x93, 0xc5, 0x00, 0x80,
0x00, 0x60, };

which defines a 16x7 bitmap. You can see for yourself by creating a new text file, pasting in the C code above, and naming it blarg.xbm, then trying to view it in either your favourite image viewer or a web browser.

In place of the usual image file format header, XBM files have two or four #define statements. The first two #defines specify the height and width of the bitmap in pixels. The second two, if they exist, specify the position of the hotspot within the bitmap, and are not present if no hotspot is defined in the image. A hotspot within the image is used for bitmapped cursors to define where the "pointer" of the cursor is, generally at 0,0.

The image data is a line of pixel values stored in a static array. Because each pixel is only one bit in size (black or white), each byte in the array contains the information for eight pixels, with the first pixel in the bitmap represented by the high bit of the first byte in the array. If the image width is not a multiple of 8, the extra bits in the last byte of each row are not used and are discarded.


Copyright 2008 WordIQ.com - Privacy Policy  ::  Terms of Use  :: Contact Us  :: About Us
This article is licensed under the GNU Free Documentation License. It uses material from the Wikipedia article "XBM".