1/*  Part of the SDL3 pack for SWI-Prolog.
    2
    3    SDL_pixels.h — pixel format enumeration.
    4
    5    @see https://wiki.libsdl.org/SDL3/SDL_pixels
    6*/
    7
    8:- module(sdl_pixels, [
    9    sdl_pixel_format/2
   10]).   11
   12:- multifile error:has_type/2.   13error:has_type(sdl_pixel_format, X) :- sdl_pixel_format(X, _).
   14
   15:- multifile prolog:error_message//1.   16prolog:error_message(type_error(sdl_pixel_format, Culprit)) -->
   17   { findall(F, sdl_pixel_format(F, _), Fs) },
   18   [ 'sdl_pixel_format (one of ~q), found ~q'-[Fs, Culprit] ].
 sdl_pixel_format(?Format:atom, ?Value:integer) is nondet
Enumerate the SDL pixel formats and their exact bit values. Each format is a Prolog atom linked to its SDL 32-bit pixel format value.

The user-facing format atoms are:

The *8888, *24 and *565 formats are platform-independent. The *32 aliases are platform-dependent: they resolve to the concrete 8888 formats according to the CPU byte order of the running platform, as shown in the values below (valid for little-endian builds). The pack ships as a unit (.pl + .so built for the same platform), so this is always consistent.

See also
- https://wiki.libsdl.org/SDL3/SDL_PixelFormat
   42sdl_pixel_format(argb8888, 0x16362004).
   43sdl_pixel_format(rgba8888, 0x16462004).
   44sdl_pixel_format(bgra8888, 0x16862004).
   45sdl_pixel_format(abgr8888, 0x16762004).
   46sdl_pixel_format(xrgb8888, 0x16161804).
   47sdl_pixel_format(xbgr8888, 0x16561804).
   48sdl_pixel_format(rgbx8888, 0x16261804).
   49sdl_pixel_format(bgrx8888, 0x16661804).
   50sdl_pixel_format(argb32, 0x16862004).  % = bgra8888 on LE
   51sdl_pixel_format(rgba32, 0x16762004).  % = abgr8888 on LE
   52sdl_pixel_format(bgra32, 0x16362004).  % = argb8888 on LE
   53sdl_pixel_format(abgr32, 0x16462004).  % = rgba8888 on LE
   54sdl_pixel_format(xrgb32, 0x16661804).  % = bgrx8888 on LE
   55sdl_pixel_format(xbgr32, 0x16261804).  % = rgbx8888 on LE
   56sdl_pixel_format(rgbx32, 0x16561804).  % = xbgr8888 on LE
   57sdl_pixel_format(bgrx32, 0x16161804).  % = xrgb8888 on LE
   58sdl_pixel_format(rgb24, 0x17101803).
   59sdl_pixel_format(bgr24, 0x17401803).
   60sdl_pixel_format(rgb565, 0x15151002).
   61sdl_pixel_format(bgr565, 0x15551002)