Wiki Page Content

Differences between revisions 3 and 4
Revision 3 as of 2013-11-02 13:28:24
Size: 927
Comment: Removed empty Related Functions section and added remarks comment, see SGFunctions.
Revision 4 as of 2016-10-17 00:00:57
Size: 1281
Editor: DanielG
Comment: add code example
Deletions are marked like this. Additions are marked like this.
Line 22: Line 22:
You can add your code example here SDL_Surface* surface = ...; // a valid surface from wherever.
SDL_PixelFormat* pixelFormat = surface->format;
Uint32 pixelFormatEnum = pixelFormat->format;
const char* surfacePixelFormatName = SDL_GetPixelFormatName(pixelFormatEnum);
printf("The surface's pixelformat is %s\n", surfacePixelFormatName);
// prints something like "The surface's pixelformat is SDL_PIXELFORMAT_ABGR8888"

SDL_GetPixelFormatName

Use this function to get the human readable name of a pixel format.

Syntax

const char* SDL_GetPixelFormatName(Uint32 format)

Function Parameters

format

the pixel format to query

Return Value

Returns the human readable name of the specified pixel format or "SDL_PIXELFORMAT_UNKNOWN" if the format isn't recognized.

Code Examples

SDL_Surface* surface = ...; // a valid surface from wherever.
SDL_PixelFormat* pixelFormat = surface->format;
Uint32 pixelFormatEnum = pixelFormat->format;
const char* surfacePixelFormatName = SDL_GetPixelFormatName(pixelFormatEnum);
printf("The surface's pixelformat is %s\n", surfacePixelFormatName);
// prints something like "The surface's pixelformat is SDL_PIXELFORMAT_ABGR8888"

Remarks

You can add useful comments here


CategoryAPI, CategoryPixels

None: SDL_GetPixelFormatName (last edited 2016-10-20 20:48:44 by PhilippWiesemann)

(Page Info.)
Feedback
Please include your contact information if you'd like to receive a reply.
Submit