-
Notifications
You must be signed in to change notification settings - Fork 72
XPM42
W2.Wizard edited this page Feb 11, 2022
·
26 revisions
XPM42 is MLX42's own custom modified format in order to replace the outdated and messy XPM3 format. XPM42 is very similar to XPM3 (which is very similar to XPM2, surprise surprise!) so conversion is straight forward just basically just simplified.
XPM overall is a weird format, and introduces some artefacts due to color limitation but if you want to convert an XPM3 file to XPM42 you can use the python script in the tools directory.
The file format looks like this:
!XPM42 <- File declaration
16 7 2 1 c <- Width | Height | Color count | Characters per Pixel | Mode (C: Color or M: Monochrome)
* #FF0000FF <- Entry always: <Char> <Space> <Hexadecimal> Colors MUST have all four channels (RGBA)
. #00000000
**..*........... <- Literal pixel data
*.*.*...........
**..*..**.**..**
*.*.*.*.*.*..*.*
**..*..**.*...**
...............*
.............**.

MLX offers a few simple tools and functions to use XPM42, you can draw multiple XPMs on a single image or import an XPM directly as an image. Once an XPM is drawn it can be safely deleted.