SDL Wiki
(This is the legacy documentation for SDL2, the previous stable version; SDL3 is the current stable version.)

SDL_PixelFormat

A structure that contains pixel format information.

Header File

Defined in SDL_pixels.h

Syntax

typedef struct SDL_PixelFormat
{
    Uint32 format;
    SDL_Palette *palette;
    Uint8 BitsPerPixel;
    Uint8 BytesPerPixel;
    Uint8 padding[2];
    Uint32 Rmask;
    Uint32 Gmask;
    Uint32 Bmask;
    Uint32 Amask;
    Uint8 Rloss;
    Uint8 Gloss;
    Uint8 Bloss;
    Uint8 Aloss;
    Uint8 Rshift;
    Uint8 Gshift;
    Uint8 Bshift;
    Uint8 Ashift;
    int refcount;
    struct SDL_PixelFormat *next;
} SDL_PixelFormat;

Remarks

Everything in the pixel format structure is read-only.

A pixel format has either a palette or masks. If a palette is used Rmask, Gmask, Bmask, and Amask will be 0.

An SDL_PixelFormat describes the format of the pixel data stored at the pixels field of an SDL_Surface. Every surface stores an SDL_PixelFormat in the format field.

If you wish to do pixel level modifications on a surface, then understanding how SDL stores its color information is essential.

For information on modern pixel color spaces, see the following Wikipedia article: http://en.wikipedia.org/wiki/RGBA_color_space

See Also


CategoryAPI, CategoryAPIStruct, CategoryPixels


[ edit | delete | history | feedback | raw ]

[ front page | index | search | recent changes | git repo | offline html ]

All wiki content is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0).
Wiki powered by ghwikipp.