Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
X BitMap
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Format== XBM files differ markedly from most image files in that they take the form of [[C (programming language)|C]] source files. This means that they can be compiled directly into an application without any preprocessing steps, but it also makes them far larger than their raw pixel data. The image data is encoded as a comma-separated list of byte values, each written in the C hexadecimal notation, '0x13' for example, so that multiple ASCII characters are used to express a single byte of image information.<ref>{{cite book|title=Encyclopedia of Graphics File Formats, Second Edition|date=April 1996|author1=James D. Murray |author2=William van Ryper |isbn=1-56592-161-5|publisher=[[O'Reilly Media|O'Reilly]] |url-access=registration |url=https://archive.org/details/mac_Graphics_File_Formats_Second_Edition_1996|access-date=2014-02-27}}</ref> XBM data consists of a series of static unsigned char [[Array data structure|arrays]] containing the monochrome [[pixel]] data. When the format was in common use, an XBM typically appeared in [[Header (computing)|header]]s (.h files) which featured one array per image stored in the header. The following piece of C code exemplifies the XBM file ''Blarg'' displayed in the panel at right: <syntaxhighlight lang="C"> #define test_width 16 #define test_height 7 static unsigned char test_bits[] = { 0x13, 0x00, 0x15, 0x00, 0x93, 0xcd, 0x55, 0xa5, 0x93, 0xc5, 0x00, 0x80, 0x00, 0x60 }; </syntaxhighlight> In place of the usual image-file-format header, XBM files has two or four #define statements. The first two #defines specify the height and width of the bitmap in pixels. The second two, if any, specify the position of any hotspot within the bitmap. (In the case of bitmapped cursors, the "hotspot" refers to the position of the cursor "point", generally at 0,0.) XBM image data consists of a line of pixel values stored in a static array. Because a single [[bit]] represents each pixel (0 for white or 1 for black), '''each byte''' in the array contains the information for '''eight pixels''', with the upper left pixel in the bitmap represented by the low bit of the first byte in the array. If the image width does not match a multiple of 8, the extra bits in the last byte of each row are ignored.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)