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 PixMap
(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!
=== XPM2 === XPM2 (1990) simplifies the format by removing all [[C (programming language)|C]] code.{{efn|It is also acceptable to use programming language syntaxes for string arrays, but only the C syntax is attested. The "XPM2 C" syntax eventually became the only format in XPM version 3.}}{{efn|For references on this syntax, see https://gitlab.freedesktop.org/xorg/lib/libxpm/-/blob/master/NEWS.old and the "history" section of libXpm 3.4 manual.}} The structure is simplified to <pre> ! XPM2 <Values> <Colors> <Pixels> <Optional Extensions> </pre> * The value section describes the overall dimension of the image similar to the <code>#define</code> statements. * The color section defines the values, and a new concept of the "type" of the color. The types may be '''c''' for "color", '''m''' for "monochrome" output, '''g''' for "grayscale", and '''s''' for "symbolic", explaining what a defined color is supposed to do. * The pixels and optional extensions remain as in the original format. The above file, with width 48, height 4, 2 colors, and 1 character per pixel, becomes: <pre> ! XPM2 48 4 2 1 a c #FFFFFF b c #000000 abaabaababaaabaabababaabaabaababaabaaababaabaaab abaabaababaaabaabababaabaabaababaabaaababaabaaab abaabaababaaabaabababaabaabaababaabaaababaabaaab abaabaababaaabaabababaabaabaababaabaaababaabaaab </pre> ==== Colors ==== In addition to hexcodes, the colors can be any of the [[X11 color names]]. In addition, <code>None</code> indicates transparency.<ref>{{cite web|url=http://www.ibiblio.org/pub/X11/contrib/libraries/xpm.FAQ|title=The XPM FAQ|publisher=[[X.Org Foundation]]|year=1996|access-date=2016-03-12}}</ref><ref>{{cite book|url=https://archive.org/details/mac_Graphics_File_Formats_Second_Edition_1996|title=XPM File Format Summary|isbn=1-56592-161-5|work=Encyclopedia of Graphics File Formats, 2nd Edition|access-date=2014-01-01|url-access=registration |last1=Murray |first1=James D. |last2=Vanryper |first2=William |date=1996 |publisher=O'Reilly & Associates }}</ref> The "symbolic" feature permits adjusting colors depending on the context where they are used. Code such as <code>s border c blue</code> could be adjusted on a blue background. ==== Many-color encoding ==== One tool is known to use only '''a''' to '''p''' for 16 colors, switching to '''aa''' up to '''dp''' for 64 colors, but still reading single character encodings for 64 colors; compare [[Base64]]. With more colors the codes use more characters, e.g. '''aa''' up to '''pp''' for 16 Γ 16 = 256 colors. 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 color code, but might be a bad idea depending on the used text editor. Without control codes, backslash, and quote (needed in XPM1 and XPM3) 128 β 33 β 2 = 93 [[ASCII]] characters are available for single character color codes. Simplified example: 90 US-ASCII characters could be arranged into nine non-overlapping sets of 10 characters. Thus unambiguous strings of nine characters could set the color of each pixel by its XPM palette index with up to 10<sup>9</sup> = {{val|1000000000}} colors (compare to [[GIF]], which supports only 256). For XPM2 it is clear how many lines belong to the image β two header lines, the second header line announcing the number of color codes (2 lines in the example above) and rows (height 4 in the example above), e.g. 2 + 2 + 4 = 8 lines.
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)