Zum Inhalt springen

„X BitMap“ – Versionsunterschied

aus Wikipedia, der freien Enzyklopädie
[gesichtete Version][gesichtete Version]
Inhalt gelöscht Inhalt hinzugefügt
Syntax dokumentiert
K Malzeichen, Abkürzung korrigiert, Links optimiert, Kleinkram
Zeile 24: Zeile 24:
}}
}}


'''X BitMap (XBM)''' ist ein Format für die Darstellung von monochromen Rastergrafiken, hauptsächlich [[Cursor|Cursors]] und [[Icon (Computer)|Icons]]. Das XBM-Dateiformat wurde 1989 durch [[XPM]] für X11 ersetzt.<ref>{{cite web |url= http://www.w3.org/People/danield/xpm_story.html |title= The XPM Story |author= Daniel Dardailler |others= Colas Nahaboo and Arnaud Le Hors |date= 1996-07-15 |accessdate= 2014-04-28 |archiveurl= https://web.archive.org/web/20181114053701/http://www.w3.org/People/danield/xpm_story.html |archivedate= 2018-11-14 |offline= yes |archivebot= 2019-05-24 15:17:25 InternetArchiveBot }}</ref>
'''X BitMap (XBM)''' ist ein Format für die Darstellung von monochromen Rastergrafiken, hauptsächlich [[Cursor]]s und [[Icon (Computer)|Icons]]. Das XBM-Dateiformat wurde 1989 durch [[XPM]] für X11 ersetzt.<ref>{{cite web |url= http://www.w3.org/People/danield/xpm_story.html |title= The XPM Story |author= Daniel Dardailler |others= Colas Nahaboo and Arnaud Le Hors |date= 1996-07-15 |accessdate= 2014-04-28 |archiveurl= https://web.archive.org/web/20181114053701/http://www.w3.org/People/danield/xpm_story.html |archivedate= 2018-11-14 |offline= yes |archivebot= 2019-05-24 15:17:25 InternetArchiveBot }}</ref>


Die Grafiken bestehen aus reinen Textdateien in der Syntax der Programmiersprache [[C (Programmiersprache)|C]];
Die Grafiken bestehen aus reinen Textdateien in der Syntax der Programmiersprache [[C (Programmiersprache)|C]];
Zeile 33: Zeile 33:


== Beispiel ==
== Beispiel ==
Dieses Dateibeispiel zeigt das [[X11]]-[https://commons.wikimedia.org/wiki/File:X11.svg Logo] in einer Auflösung von 64x64 [[Pixel]]n:
Dieses Dateibeispiel zeigt das [[X11]]-[https://commons.wikimedia.org/wiki/File:X11.svg Logo] in einer Auflösung von 64 × 64 [[Pixel]]n:
<pre>
<pre>
#define w 64
#define w 64
Zeile 87: Zeile 87:
Die ersten 2 Zeilen legen die Breite und Höhe des codierten Bildes als [[C-Präprozessor|#define für den C-Präprozessor]] fest.
Die ersten 2 Zeilen legen die Breite und Höhe des codierten Bildes als [[C-Präprozessor|#define für den C-Präprozessor]] fest.
Danach folgen zeilenweise sequentiell die Pixel des Bildes, codiert als die gesetzten Bits in jedem Byte der Folge.
Danach folgen zeilenweise sequentiell die Pixel des Bildes, codiert als die gesetzten Bits in jedem Byte der Folge.
Die Reihenfolge ist dabei vom [[Least Significant Bit|LSB]] zum [[Most Significant Bit|MSB]], d.h.,
Die Reihenfolge ist dabei vom [[Least Significant Bit|LSB]] zum [[Most Significant Bit|MSB]], d.&nbsp;h.,
das erste Pixel des Bildes, also seine linke obere Ecke, ist das Nullte Bit des ersten Bytes.
das erste Pixel des Bildes, also seine linke obere Ecke, ist das Nullte Bit des ersten Bytes.



Version vom 15. Oktober 2020, 12:37 Uhr

X BitMap
Dateiendung: .xbm
MIME-Type: image/x‑xbitmap, image/x‑xbm[1]
Art: Grafikformat
Erweitert von: C (Programmiersprache)
Erweitert zu: X PixMap (XPM)


X BitMap (XBM) ist ein Format für die Darstellung von monochromen Rastergrafiken, hauptsächlich Cursors und Icons. Das XBM-Dateiformat wurde 1989 durch XPM für X11 ersetzt.[2]

Die Grafiken bestehen aus reinen Textdateien in der Syntax der Programmiersprache C; sie können daher mit einem einfachen Texteditor bearbeitet und direkt in Quellcode (C oder C++) eingebunden werden.

Obwohl das Grafikformat schon sehr alt und in seiner Funktionalität zudem so stark eingeschränkt ist, eignet es sich jedoch aufgrund seiner Einfachheit hervorragend zur Verwendung in kleinen Lehr- oder Beispielprogrammen, die pixelbasiert arbeiten.

Beispiel

Dieses Dateibeispiel zeigt das X11-Logo in einer Auflösung von 64 × 64 Pixeln:

#define w 64
#define h 64
static char img[] = {
   0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xfe, 0xff, 0x01, 0x00,
   0x00, 0x00, 0x00, 0xf8, 0xfc, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x7c,
   0xf8, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x3e, 0xf8, 0xff, 0x07, 0x00,
   0x00, 0x00, 0x00, 0x1f, 0xf0, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x80, 0x0f,
   0xe0, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x80, 0x0f, 0xc0, 0xff, 0x3f, 0x00,
   0x00, 0x00, 0xc0, 0x07, 0xc0, 0xff, 0x3f, 0x00, 0x00, 0x00, 0xe0, 0x03,
   0x80, 0xff, 0x7f, 0x00, 0x00, 0x00, 0xf0, 0x01, 0x00, 0xff, 0xff, 0x00,
   0x00, 0x00, 0xf8, 0x00, 0x00, 0xfe, 0xff, 0x01, 0x00, 0x00, 0xf8, 0x00,
   0x00, 0xfe, 0xff, 0x01, 0x00, 0x00, 0x7c, 0x00, 0x00, 0xfc, 0xff, 0x03,
   0x00, 0x00, 0x3e, 0x00, 0x00, 0xf8, 0xff, 0x07, 0x00, 0x00, 0x1f, 0x00,
   0x00, 0xf0, 0xff, 0x0f, 0x00, 0x80, 0x0f, 0x00, 0x00, 0xf0, 0xff, 0x0f,
   0x00, 0xc0, 0x07, 0x00, 0x00, 0xe0, 0xff, 0x1f, 0x00, 0xc0, 0x07, 0x00,
   0x00, 0xc0, 0xff, 0x3f, 0x00, 0xe0, 0x03, 0x00, 0x00, 0x80, 0xff, 0x7f,
   0x00, 0xf0, 0x01, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0xf8, 0x00, 0x00,
   0x00, 0x00, 0xff, 0xff, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff,
   0x01, 0x7c, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0x03, 0x3e, 0x00, 0x00,
   0x00, 0x00, 0xfc, 0xff, 0x03, 0x1f, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff,
   0x87, 0x0f, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xcf, 0x07, 0x00, 0x00,
   0x00, 0x00, 0xe0, 0xff, 0xcf, 0x07, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff,
   0xe7, 0x03, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xf3, 0x01, 0x00, 0x00,
   0x00, 0x00, 0x80, 0xff, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
   0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xfe, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x7e, 0xfe, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e,
   0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9f, 0xff, 0x07, 0x00, 0x00,
   0x00, 0x00, 0x80, 0xcf, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xe7,
   0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xe7, 0xff, 0x1f, 0x00, 0x00,
   0x00, 0x00, 0xe0, 0xc3, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xc1,
   0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x80, 0xff, 0x7f, 0x00, 0x00,
   0x00, 0x00, 0x7c, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00,
   0xfe, 0xff, 0x01, 0x00, 0x00, 0x00, 0x3e, 0x00, 0xfe, 0xff, 0x01, 0x00,
   0x00, 0x00, 0x1f, 0x00, 0xfc, 0xff, 0x03, 0x00, 0x00, 0x80, 0x0f, 0x00,
   0xf8, 0xff, 0x07, 0x00, 0x00, 0xc0, 0x07, 0x00, 0xf0, 0xff, 0x0f, 0x00,
   0x00, 0xe0, 0x03, 0x00, 0xf0, 0xff, 0x0f, 0x00, 0x00, 0xe0, 0x03, 0x00,
   0xe0, 0xff, 0x1f, 0x00, 0x00, 0xf0, 0x01, 0x00, 0xc0, 0xff, 0x3f, 0x00,
   0x00, 0xf8, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x7c, 0x00, 0x00,
   0x80, 0xff, 0x7f, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00,
   0x00, 0x3e, 0x00, 0x00, 0x00, 0xfe, 0xff, 0x01, 0x00, 0x1f, 0x00, 0x00,
   0x00, 0xfc, 0xff, 0x03, 0x80, 0x0f, 0x00, 0x00, 0x00, 0xfc, 0xff, 0x03,
   0xc0, 0x07, 0x00, 0x00, 0x00, 0xf8, 0xff, 0x07, 0xe0, 0x03, 0x00, 0x00,
   0x00, 0xf0, 0xff, 0x0f, 0xe0, 0x03, 0x00, 0x00, 0x00, 0xe0, 0xff, 0x1f,
   0xf0, 0x01, 0x00, 0x00, 0x00, 0xe0, 0xff, 0x1f, 0xf8, 0x00, 0x00, 0x00,
   0x00, 0xc0, 0xff, 0x3f, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f,
   0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff};

Syntax (Dateiformat)

Die ersten 2 Zeilen legen die Breite und Höhe des codierten Bildes als #define für den C-Präprozessor fest. Danach folgen zeilenweise sequentiell die Pixel des Bildes, codiert als die gesetzten Bits in jedem Byte der Folge. Die Reihenfolge ist dabei vom LSB zum MSB, d. h., das erste Pixel des Bildes, also seine linke obere Ecke, ist das Nullte Bit des ersten Bytes.

Quellen

  1. Der .xbm MIME-Typ ist nicht bei der IANA registriert
  2. Daniel Dardailler, Colas Nahaboo and Arnaud Le Hors: The XPM Story. 15. Juli 1996, archiviert vom Original am 14. November 2018; abgerufen am 28. April 2014.  Info: Der Archivlink wurde automatisch eingesetzt und noch nicht geprüft. Bitte prüfe Original- und Archivlink gemäß Anleitung und entferne dann diesen Hinweis.@1@2Vorlage:Webachiv/IABot/www.w3.org