I can load a PNG image into memory and get the raw pixel data from that using libpng, and I can also create windows with a blank background using XCB or plain X11.
What should I do next to display an image inside a window?
The XLib method is as follows:
XImagestructure with depth appropriate to your visual
The second step can be achieved by calling
XPutPixel for each individual pixel. You will have to convert RGB values to pixel values. For 15,- 16,- 24- or 32-bit visuals this is a trivial manipulation with bitmasks (use
visual->red_mask to determine where to put the red component, etc). If you want to support 8-bit depth you have to use dithering, and allocate and use an appropriate colormap, probably a 216-element colour cube. Fortunately 8-bit-only hardware is rare these days.
XPutPixel is too slow for you, you will have to implement what it does in line. Use e.g. this source for guidance.
xcb has a library called xcb-util-image with the functionality parallel to that of XImage. I'm not familiar with it.