An .xp file holds no pixels. To show the image, each
cell is drawn as a glyph from a font, in its
foreground colour on its background colour, and the layers are drawn over one another.
Glyphs
A cell’s code is the number of a glyph in the font the image is drawn with. The font is a bitmap of 16 glyphs a row, numbered from 0 in reading order. By default REXPaint uses a standard 256-glyph code page 437 font, the character set of the IBM PC, at several sizes, so in most images the codes are 0 to 255 and mean the characters in the table below.
REXPaint can also use custom fonts. One with more than 16 rows has more than 256 glyphs, and its images can hold codes above 255; such a code means nothing without that font. Custom fonts always treat glyph 32 as a space.
What decides a code’s meaning: the file stores only the 32-bit number (0 to
4,294,967,295). The glyph it stands for is the picture at that position in the font
bitmap REXPaint has loaded, which is the user’s own data and is not part of the
.xp file. So a code is fully described by the file as a number, and its
meaning comes from the font: in the default font, code page 437 as in the table below;
in a custom font, whatever the user drew. The explorer shows a code above 255 as a box
with the code’s low 16 bits inside (a 4 × 4 grid of dots, the highest bit at top left;
a thick border above 65535), and its hover text, cell fields and glyph table say
“glyph from the file’s custom font” and give the number. Codes 0 to 255 are drawn with
the IBM PC 8 × 8 code page 437 font as a stand-in for REXPaint’s own fonts, and labelled
so.
Glyphs 0, 32 and 255 are blank in the standard font, so a cell with one of them shows only its background.
Code page 437
The 256 glyphs, with the Unicode characters they correspond to. Row and column give the
code in hexadecimal: the code of “A” is row 4, column 1, 41, 65. Codes 1 to 31
and 127 are control codes in ASCII, but the IBM font draws pictures for them, and these are
the characters shown. Code 0 is blank and 255 is a no-break space.
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | ☺ | ☻ | ♥ | ♦ | ♣ | ♠ | • | ◘ | ○ | ◙ | ♂ | ♀ | ♪ | ♫ | ☼ | |
| 1 | ► | ◄ | ↕ | ‼ | ¶ | § | ▬ | ↨ | ↑ | ↓ | → | ← | ∟ | ↔ | ▲ | ▼ |
| 2 | ! | " | # | $ | % | & | ' | ( | ) | * | + | , | - | . | / | |
| 3 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | : | ; | < | = | > | ? |
| 4 | @ | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O |
| 5 | P | Q | R | S | T | U | V | W | X | Y | Z | [ | \ | ] | ^ | _ |
| 6 | ` | a | b | c | d | e | f | g | h | i | j | k | l | m | n | o |
| 7 | p | q | r | s | t | u | v | w | x | y | z | { | | | } | ~ | ⌂ |
| 8 | Ç | ü | é | â | ä | à | å | ç | ê | ë | è | ï | î | ì | Ä | Å |
| 9 | É | æ | Æ | ô | ö | ò | û | ù | ÿ | Ö | Ü | ¢ | £ | ¥ | ₧ | ƒ |
| A | á | í | ó | ú | ñ | Ñ | ª | º | ¿ | ⌐ | ¬ | ½ | ¼ | ¡ | « | » |
| B | ░ | ▒ | ▓ | │ | ┤ | ╡ | ╢ | ╖ | ╕ | ╣ | ║ | ╗ | ╝ | ╜ | ╛ | ┐ |
| C | └ | ┴ | ┬ | ├ | ─ | ┼ | ╞ | ╟ | ╚ | ╔ | ╩ | ╦ | ╠ | ═ | ╬ | ╧ |
| D | ╨ | ╤ | ╥ | ╙ | ╘ | ╒ | ╓ | ╫ | ╪ | ┘ | ┌ | █ | ▄ | ▌ | ▐ | ▀ |
| E | α | ß | Γ | π | Σ | σ | µ | τ | Φ | Θ | Ω | δ | ∞ | φ | ε | ∩ |
| F | ≡ | ± | ≥ | ≤ | ⌠ | ⌡ | ÷ | ≈ | ° | ∙ | · | √ | ⁿ | ² | ■ |
Drawing the layers
The first layer in the file is the base layer, which every image has. Each later layer is drawn over the ones before it, so the last layer in the file is on top. Layers are not blended: a cell is drawn whole, glyph and background, or not at all.
To draw the image as REXPaint shows it, take each place in the grid and use the cell of the highest layer there that is not transparent. A place that is transparent on every layer, the base layer included, is drawn black.
1Layer 3 the last in the file: drawn where its cells are not transparenttop2Layer 2 shows through layer 3’s transparent cellsmiddle3Layer 1 the base layer; its own transparent cells are blackbottom
REXPaint can hide layers while editing. Hidden layers are saved with the image, but the format has no field that says a layer is hidden, and REXPaint leaves hidden layers out when it exports the image to other formats.
As text
The text of an image is its codes read row by row through the table above, one line a row, with a transparent cell and glyph 0 as spaces. REXPaint’s own TXT export writes the glyphs of all the visible layers together, without colours, as UTF-8 by default.