sdlGetPixelFormatForMasks function

int sdlGetPixelFormatForMasks(
  1. int bpp,
  2. int rmask,
  3. int gmask,
  4. int bmask,
  5. int amask,
)

Convert a bpp value and RGBA masks to an enumerated pixel format.

This will return SDL_PIXELFORMAT_UNKNOWN if the conversion wasn't possible.

\param bpp a bits per pixel value; usually 15, 16, or 32. \param Rmask the red mask for the format. \param Gmask the green mask for the format. \param Bmask the blue mask for the format. \param Amask the alpha mask for the format. \returns the SDL_PixelFormat value corresponding to the format masks, or SDL_PIXELFORMAT_UNKNOWN if there isn't a match.

\threadsafety It is safe to call this function from any thread.

\since This function is available since SDL 3.1.3.

\sa SDL_GetMasksForPixelFormat

extern SDL_DECLSPEC SDL_PixelFormat SDLCALL SDL_GetPixelFormatForMasks(int bpp, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)

Implementation

int sdlGetPixelFormatForMasks(
    int bpp, int rmask, int gmask, int bmask, int amask) {
  final sdlGetPixelFormatForMasksLookupFunction = libSdl3.lookupFunction<
      Int32 Function(
          Int32 bpp, Uint32 rmask, Uint32 gmask, Uint32 bmask, Uint32 amask),
      int Function(int bpp, int rmask, int gmask, int bmask,
          int amask)>('SDL_GetPixelFormatForMasks');
  return sdlGetPixelFormatForMasksLookupFunction(
      bpp, rmask, gmask, bmask, amask);
}