imgIsPnm function
Detect PNM image data on a readable/seekable SDL_IOStream.
This function attempts to determine if a file is a given filetype, reading the least amount possible from the SDL_IOStream (usually a few bytes).
There is no distinction made between "not the filetype in question" and basic i/o errors.
This function will always attempt to seek src
back to where it started
when this function was called, but it will not report any errors in doing
so, but assuming seeking works, this means you can immediately use this
with a different IMG_isTYPE function, or load the image without further
seeking.
You do not need to call this function to load data; SDL_image can work to determine file type in many cases in its standard load functions.
\param src a seekable/readable SDL_IOStream to provide image data. \returns non-zero if this is PNM data, zero otherwise.
\since This function is available since SDL_image 3.0.0.
\sa IMG_isAVIF \sa IMG_isICO \sa IMG_isCUR \sa IMG_isBMP \sa IMG_isGIF \sa IMG_isJPG \sa IMG_isJXL \sa IMG_isLBM \sa IMG_isPCX \sa IMG_isPNG \sa IMG_isSVG \sa IMG_isQOI \sa IMG_isTIF \sa IMG_isXCF \sa IMG_isXPM \sa IMG_isXV \sa IMG_isWEBP
extern SDL_DECLSPEC bool SDLCALL IMG_isPNM(SDL_IOStream *src)
Implementation
bool imgIsPnm(Pointer<SdlIoStream> src) {
final imgIsPnmLookupFunction = libSdl3Image.lookupFunction<
Uint8 Function(Pointer<SdlIoStream> src),
int Function(Pointer<SdlIoStream> src)>('IMG_isPNM');
return imgIsPnmLookupFunction(src) == 1;
}