Can someone tell me what the format field of the SDL_PixelFormat is for? What does it contain? The documentation of the SDL2 library does not give enough detail.
Here are the bytes of two instances of such an object. The format field covers the first 4 bytes.
04 18 16 16 00 00 00 00
00 00 00 00 00 00 00 00
20 04 00 00 00 00 FF 00
00 FF 00 00 FF 00 00 00
00 00 00 00 00 00 00 08
10 08 00 00 01 00 00 00
50 47 D6 B4 88 59 00 00
04 20 36 16 00 00 00 00
00 00 00 00 00 00 00 00
20 04 00 00 00 00 FF 00
00 FF 00 00 FF 00 00 00
00 00 00 FF 00 00 00 00
10 08 00 18 01 00 00 00
00 00 00 00 00 00 00 00
The first string of bytes comes from a window surface retrieved with SDL_GetWindowSurface, and the other one comes from an image surface created with SDL_LoadBMP.
SDL_DEFINE_PIXELFORMATmacro from SDL_pixels.h.0x16362004seems to matchSDL_PIXELFORMAT_ARGB8888, which would make sense for 32-bit color mode (with alpha channel) created from BMP file .formatfield as a unique identifier.