Home
Main website
Display Sidebar
Hide Ads
Recent Changes
View Source:
SDL_PixelFormat(3)
Edit
PageHistory
Diff
Info
LikePages
SDL_!PixelFormat !!!SDL_!PixelFormat NAME STRUCTURE DEFINITION STRUCTURE DATA DESCRIPTION SEE ALSO ---- !!NAME SDL_!PixelFormat- Stores surface format information !!STRUCTURE DEFINITION typedef struct{ SDL_Palette *palette; Uint8 !BitsPerPixel; Uint8 !BytesPerPixel; Uint32 Rmask, Gmask, Bmask, Amask; Uint8 Rshift, Gshift, Bshift, Ashift; Uint8 Rloss, Gloss, Bloss, Aloss; Uint32 colorkey; Uint8 alpha; } SDL_!PixelFormat; !!STRUCTURE DATA __palette__ Pointer to the ''palette'', or __NULL__ if the __!BitsPerPixel____ __!BitsPerPixel__ The number of bits used to represent each pixel in a surface. Usually 8, 16, 24 or 32. __!BytesPerPixel__ The number of bytes used to represent each pixel in a surface. Usually one to four. __[[RGBA]mask__ Binary mask used to retrieve individual color values __[[RGBA]loss__ Precision loss of each color component (2^[[RGBA]loss) __[[RGBA]shift__ Binary left shift of each color component in the pixel value __colorkey__ Pixel value of transparent pixels __alpha__ Overall surface alpha value !!DESCRIPTION A __SDL_!PixelFormat__ describes the format of the pixel data stored at the __pixels__ field of a __SDL_Surface__. Every surface stores a __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. 8-bit pixel formats are the easiest to understand. Since its an 8-bit format, we have 8 __!BitsPerPixel__ and 1 __!BytesPerPixel__. Since __!BytesPerPixel__ is 1, all pixels are represented by a Uint8 which contains an index into __palette__-__colors__. So, to determine the color of a pixel in a 8-bit surface: we read the color index from __surface__-__pixels__ and we use that index to read the __SDL_Color__ structure from __surface__-__format__-__palette__-__colors__. Like so: SDL_Surface *surface; SDL_!PixelFormat *fmt; SDL_Color *color; Uint8 index; . . /* Create surface */ . . fmt=surface- Pixel formats above 8-bit are an entirely different experience. They are considered to be /* Extracting color components from a 32-bit color value */ SDL_!PixelFormat *fmt; SDL_Surface *surface; Uint32 temp, pixel; Uint8 red, green, blue, alpha; . . . fmt=surface- !!SEE ALSO __SDL_Surface__, __SDL_MapRGB__ ----
One page links to
SDL_PixelFormat(3)
:
SDLManPages
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.