That does not seem really to be modeX in the code. Rather a bitmap where each pixel is a bye index to a palette.
EDIT: Oh that is non planar modeX, ok.
You could create an TLazIntfImage with this data, then create the TBitmap and draw it.
Or update an RGBA bitmap with the color from the palette (using BGRABitmap, Graphics32, OpenGL etc.)