Skip to content
W2.Wizard edited this page Jan 30, 2022 · 26 revisions

XPM42

As of writing this, XPM42 is still a bit WIP 🔨

XPM is a weird format, so much so that it doesn't know if it wants to be written in C or not. To introduce a simple to understand format thats not a complete mess, MLX42 has its own slightly modified format for xpm images.

Layout

Header

  1. !XPM42 file type declaration.
  2. Width, Height, Color count, Mode
Width -> The widht of the image.

Height -> The height of the image.

Color count -> The number of colors in the image.

Mode -> A single character specifying the mode, can be `c` for Color or `m` for monochrome. 
Monochrome will basically create a black and white equivalent of the image.

Table

The table consistes of a character, followed by a space, finally the color value itself.

E.g:

* #FF0000

For transparent pixels, a value of NULL can be specified. *

*As of writing this, this feature is not available yet.

Pixels

After the colors come the literal pixel data, each character will be looked up and the appropriate color is inserted in the pixel buffer

Example

!XPM42
16 7 2 c
* #FF0000
. #000000
**..*...........
*.*.*...........
**..*..**.**..**
*.*.*.*.*.*..*.*
**..*..**.*...**
...............*
.............**.

Clone this wiki locally