Skip to content
W2.Wizard edited this page Feb 8, 2022 · 26 revisions

XPM42

MLX42, like MiniLibX offers built-in support for the XPM format however it implements its own variation of it due to design conflicts regarding the XPM3 variant. XPM overall is a weird format, so much so that it doesn't know if it wants to be written in C or not.

The goal of XPM42 is to introduce a simple to understand format that's not a complete mess.

XPM42 supports up to 255 unique characters for individual pixel colors. It also supports transparency via an RGBA8 format in a hexadecimal representation. It does however NOT support Many-color encoding e.g: .X #00000000

Layout

The file format looks like this:

!XPM42            <- File decleration
16 7 2 c          <- Width | Height | Color count | Mode (C: Color or M: Monochrome)
* #FF0000FF       <- Entry always: <Char> <Space> <Hexadecimal>
. #00000000
**..*...........  <- Literal pixel data
*.*.*...........
**..*..**.**..**
*.*.*.*.*.*..*.*
**..*..**.*...**
...............*
.............**.

Clone this wiki locally