XBM
Encyclopedia
In computer graphics
Computer graphics
Computer graphics are graphics created using computers and, more generally, the representation and manipulation of image data by a computer with help from specialized software and hardware....

, the X Window System
X Window System
The X window system is a computer software system and network protocol that provides a basis for graphical user interfaces and rich input device capability for networked computers...

 uses X BitMap (XBM), a plain text
Plain text
In computing, plain text is the contents of an ordinary sequential file readable as textual material without much processing, usually opposed to formatted text....

 binary
Binary image
A binary image is a digital image that has only two possible values for each pixel. Typically the two colors used for a binary image are black and white though any two colors can be used. The color used for the object in the image is the foreground color while the rest of the image is the...

 image format, for storing cursor
Cursor (computers)
In computing, a cursor is an indicator used to show the position on a computer monitor or other display device that will respond to input from a text input or pointing device. The flashing text cursor may be referred to as a caret in some cases...

 and icon
Icon
An icon is a religious work of art, most commonly a painting, from Eastern Christianity and in certain Eastern Catholic churches...

 bitmap
Bitmap
In computer graphics, a bitmap or pixmap is a type of memory organization or image file format used to store digital images. The term bitmap comes from the computer programming terminology, meaning just a map of bits, a spatially mapped array of bits. Now, along with pixmap, it commonly refers to...

s used in the X GUI
Graphical user interface
In computing, a graphical user interface is a type of user interface that allows users to interact with electronic devices with images rather than text commands. GUIs can be used in computers, hand-held devices such as MP3 players, portable media players or gaming devices, household appliances and...

.

XBM files differ markedly from most image files in that they take the form of C
C (programming language)
C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system....

 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 would be (each byte of image data takes at least 4 bytes in a XBM file).

Format

XBM data typically appears in header
Header
Header may refer to: Computers and engineering* Header , supplemental data at the beginning of a data block** E-mail header** HTTP header* Header file, a text file used in computer programming...

s (.h files) and consist of a series of static unsigned char arrays containing the monochrome pixel
Pixel
In digital imaging, a pixel, or pel, is a single point in a raster image, or the smallest addressable screen element in a display device; it is the smallest unit of picture that can be represented or controlled....

 data. They feature one array per image stored in the header.

The following piece of C code exemplifies an XBM file:

  1. define test_width 16
  2. define test_height 7

static char test_bits[] = {
0x13, 0x00, 0x15, 0x00, 0x93, 0xcd, 0x55, 0xa5, 0x93, 0xc5, 0x00, 0x80,
0x00, 0x60 };


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 any hotspot within the bitmap. (Programmers use a hotspot within the image for bitmapped cursors to define where to position the "pointer" of the cursor, generally at 0,0.)

The image data consists of a line of pixel values stored in a static array. Because a single bit
Bit
A bit is the basic unit of information in computing and telecommunications; it is the amount of information stored by a digital device or other physical system that exists in one of two possible distinct states...

 represents each pixel (black or white), 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 display mechanism ignores and discards the extra bits in the last byte of each row.

Support

A number of web browser
Web browser
A web browser is a software application for retrieving, presenting, and traversing information resources on the World Wide Web. An information resource is identified by a Uniform Resource Identifier and may be a web page, image, video, or other piece of content...

s still offer support for displaying XBM images. This is a holdover from the early days of the world wide web
World Wide Web
The World Wide Web is a system of interlinked hypertext documents accessed via the Internet...

, when XBM was the minimal non-proprietary image file format. XBM support was removed from Internet Explorer 6 and Mozilla Firefox 3.6
Mozilla Firefox 3.6
Mozilla Firefox 3.6 is a version of the Firefox web browser released in January 2010. The release's main improvement over Firefox 3.5 is improved performance . It uses the Gecko 1.9.2 engine , which improves compliance with web standards...

, although it is still supported in some other browsers, including Safari
Safari (web browser)
Safari is a web browser developed by Apple Inc. and included with the Mac OS X and iOS operating systems. First released as a public beta on January 7, 2003 on the company's Mac OS X operating system, it became Apple's default browser beginning with Mac OS X v10.3 "Panther". Safari is also the...

.
The Arena
Arena (web browser)
The Arena browser was an early testbed web browser and web authoring tool for Unix. Originally authored by Dave Raggett in 1993, the browser continued its development at CERN and the World Wide Web Consortium and subsequently by Yggdrasil Computing...

 web browser has full support since version 0.3.34 (25 July 1997) The discontinued world wide web email browser Agora
Agora (web browser)
Agora was a World Wide Web email browser and was a proof of concept to help people to use the full internet. Agora was an email-based web browser designed for non-graphic terminals and to help people without full access to the internet such as in developing countries or without a permanent internet...

was also capable of reading XBM images.
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK