X PixMap

X PixMap

Infobox file format
name = X Pixmap
extension = .xpm
mime = image/x-xpixmap unofficial
image/x-xpm unofficial
owner = BULL Research
creatorcode =
genre = Image file formats
containerfor =
containedby =
extendedfrom = XBM and Portable pixmap
extendedto =

X Pixmap (XPM) is an ASCII-text-based image format used by the X Window System. It was created in 1989 by Daniel Dardailler and Colas Nahaboo working at the INRIA, France, and was later enhanced by Arnaud Le Hors. It is intended primarily for creating icon pixmaps, and supports transparent color. It has a simple structure, deriving from the earlier XBM syntax. It can be created and manipulated using any text editor and can be included in a C language file.

Styles

Three styles are known, the simple XPM2 stripped all C idiosyncrasies, example:

:! XPM2:128 128 64 1:z c #f6f6f6:Z c #eeeeee:"etc., palette using 1 character codes":@ c #080808:. c #000000:............................................:"truncated first row, each dot is a pixel with colour #000000 as defined above."

This is about an XPM2 image with width 128, height 128, 64 colours, using one character per pixel.One tool is known to use only a to p for 16 colours, switching to aa up to dp for 64 colours, but still reading single character encodings for 64 colours, compare Base64. With more colours the codes use more characters, e.g. aa up to pp for 16*16=256 colours. This is less useful for text editors, because a string ab could be actually the middle of two adjacent pixels dabc. Spaces are allowed as colour code, see links, but might be a bad idea depending on the used text editor. Without control codes, space, and quote (needed in XPM1 and XPM3) 128-33-2=93 ASCII characters are available for single character colour codes.

It's helpful if the converter from other formats to XPM can sort the palette from white to black, because one of the reasons to edit an icon might be to get rid of antialiasing artefacts after a reduction of the number colours, adding affected pixels to #000000 or #ffffff acting as transparency colour (the dots in the example).

For XPM2 it's clear how many lines belong to the image, two header lines, the second header line announcing the number of colour codes (64 lines in the example above) and rows (height 128 in the example above), e.g. 2+64+128=194 lines.

The other styles are designed to be used as is in C sources, example:

:#define XFACE_format 1:#define XFACE_width 48:#define XFACE_height 48:#define XFACE_ncolors 2:#define XFACE_chars_per_pixel 1:static char *XFACE_colors [] = {:"a", "#ffffff",:"b", "#000000":};:static char *XFACE_pixels [] = {:"abaabaababaaabaabababaabaabaababaabaaababaabaaab",:"etc., 48 rows with 48 pixels".

This is a black and white image in the first (1989) XPM format.The source icon was in PNG format, and although it defined #ffffff astransparent, this detail was lost in the conversion. The hex. RGB #123456 codes can be also replaced by known colour names found in a "well known location" rgb.txt, where "well known location" depends on the operating system and the used tools. The XPM "colour" name for transparency is none.

Just for the records the same image in the other styles:

:! XPM2:48 48 2 1:a c #ffffff:b c #000000:abaabaababaaabaabababaabaabaababaabaaababaabaaab:"etc."

: /* XPM */: static char * XFACE [] = {: "48 48 2 1",: "a c #ffffff",: "b c #000000",: "abaabaababaaabaabababaabaabaababaabaaababaabaaab",:"etc."

The latter format is XPM3, the common format used for the X Window System since about 1991. The c means "colour", it's possible to add m for "monochrome" output, g for "grayscale", and s for "symbolic", explaining what a defined colour is supposed to do.

The "symbolic" feature allows to adjust colours depending on the context where they are used, like say s border c blue could be adjusted on a blue background.

If the width, height, colours, and characters per pixel line contains six instead of four numbers the additional values indicate the coordinates of a "hotspot", 0 0 is the upper left corner of a box containing the icon and the default. A "hotspot" is used for mouse pointers and similar applications.

Comparison with XBM

Here's the same in both formats, the examples are complete images Blarg.xbm and Blarg.xpm: #define blarg_xbm_width 16 #define blarg_xbm_height 7 static char blarg_xbm_bits [] = { 0xec, 0xff, 0xea, 0xff, 0x6c, 0x32, 0xaa, 0x5a, 0x6c, 0x3a, 0xff, 0x7f, 0xff, 0x9f};Above is the XBM (183 bytes text), below the XPM2 (170 bytes), for 16*7 black and white pixels. ! XPM2 16 7 2 1 * c #ffffff . c #000000 **..*........... *.*.*........... **..*..**.**..** *.*.*.*.*.*..*.* **..*..**.*...** ...............* .............**.

See also

* GIF89a history, also invented in 1989
* X11 color names, explanation of rgb.txt

External links

* [http://cvsweb.xfree86.org/cvsweb/*checkout*/xc/programs/rgb/rgb.txt?rev=1.1 X11 R6 rgb.txt 1.1] (1994), [http://cvsweb.xfree86.org/cvsweb/xc/programs/rgb/rgb.txt.diff?r1=1.2&r2=1.1 1.2] (2005, excl. 96 aliases)
* [http://koala.ilog.fr/lehors/xpm.html The XPM format and library]
* [http://www.w3.org/People/danield/xpm_story.html The XPM Story] (Daniel Dardailler)
* [http://doc.trolltech.com/qq/qq12-mac-events.html Mac OS X XPM apple event] (example)
* [http://www.kb.cert.org/vuls/id/537878 X11 version 6.8.0 vulnerability 537878]


Wikimedia Foundation. 2010.

Игры ⚽ Поможем сделать НИР

Look at other dictionaries:

  • Pixmap — Eine Rastergrafik, auch Pixelgrafik (englisch Raster graphics image, Digital image, Bitmap oder Pixmap), ist eine Form der Beschreibung eines Bildes in Form von computerlesbaren Daten. Rastergrafiken bestehen aus einer rasterförmigen Anordnung… …   Deutsch Wikipedia

  • Pixmap — Image matricielle Exemple d image matricielle Une image matricielle (ou image en mode point, ou en anglais une « bitmap » ou « raster ») est une image numérique dans un format de données qui se compose d un tableau de pixels… …   Wikipédia en Français

  • pixmap — noun raster graphics Syn: bitmap …   Wiktionary

  • Pixmap — Pixel Map Rastergrafik mit der Tiefe n (jeder Bildpunkt besitzt einen expliziten Farbwert), vergl. Bitmap …   Acronyms

  • pixmap — ● ►en n. f. ►GRAPH Image définition par un tableau à trois dimensions, deux pour les dimensions de l image et une pour la profondeur de chaque pixel …   Dictionnaire d'informatique francophone

  • Pixmap — Pixel Map Rastergrafik mit der Tiefe n (jeder Bildpunkt besitzt einen expliziten Farbwert), vergl. Bitmap …   Acronyms von A bis Z

  • X Pixmap — (XPM)  текстовый формат графических файлов. Используется серверной стороной системы X Window. Главной особенностью формата является то, что он использует семантику языка Си и может быть включён в код. Разработан в 1989 году Daniel Dardailler …   Википедия

  • Portable Pixmap — Vorlage:Infobox Dateiformat/Wartung/Standard fehltVorlage:Infobox Dateiformat/Wartung/Website fehlt Portable Pixmap Dateiendung …   Deutsch Wikipedia

  • Portable pixmap — Extension .ppm, .pgm, .pbm, .pnm Type MIME image/x portable pixmap, graymap, bitmap, anymap all unofficial Développé par Jef Poskanzer Type de format Format de fichier graphique Origine de XPM …   Wikipédia en Français

  • X PixMap — Vorlage:Infobox Dateiformat/Wartung/MagischeZahl fehltVorlage:Infobox Dateiformat/Wartung/Standard fehltVorlage:Infobox Dateiformat/Wartung/Website fehlt X PixMap Dateiendung: .xpm MIME Type …   Deutsch Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”