sdlGetPixelFormatName function

String? sdlGetPixelFormatName(
  1. int format
)

Get the human readable name of a pixel format.

\param format the pixel format to query. \returns the human readable name of the specified pixel format or "SDL_PIXELFORMAT_UNKNOWN" if the format isn't recognized.

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

\since This function is available since SDL 3.1.3.

extern SDL_DECLSPEC const char * SDLCALL SDL_GetPixelFormatName(SDL_PixelFormat format)

Implementation

String? sdlGetPixelFormatName(int format) {
  final sdlGetPixelFormatNameLookupFunction = libSdl3.lookupFunction<
      Pointer<Utf8> Function(Int32 format),
      Pointer<Utf8> Function(int format)>('SDL_GetPixelFormatName');
  final result = sdlGetPixelFormatNameLookupFunction(format);
  if (result == nullptr) {
    return null;
  }
  return result.toDartString();
}