Implementing PseudoColor support on TrueColor screens

Sleep ireallyhatespam at yandex.com
Tue Jun 2 06:28:13 UTC 2020


Is there any documentation, article or book on how to convert the colors 
displayed by a program that was originally written to work on 8 bit 
screens? The problem I am facing seems to be related to how pixels are 
represented in the 'data' member of the XImage structure, which results 
in a squashed image and colors being displayed incorrectly. The only 
reference I have are two functions in the Quake source code: 
xlib_rgb24()[1] and st3_fixup()[2], which are used to convert the colors 
(but I cannot comprehend them because the format is unknown to me), but 
I found nothing that could make the image fill the window[3] properly. I 
could use SDL to easily get around this issue but I specifically want to 
use Xlib.

I appreciate any help to learn.

[1] 
<https://github.com/id-Software/Quake/blob/bf4ac424ce754894ac8f1dae6a3981954bc9852d/WinQuake/vid_x.c#L156>
[2] 
<https://github.com/id-Software/Quake/blob/bf4ac424ce754894ac8f1dae6a3981954bc9852d/WinQuake/vid_x.c#L219>
[3] https://postimg.cc/MfRz0Dk7
[4] https://i.postimg.cc/brVdhC3B/doom.png


More information about the xorg mailing list