Pointer to the \fIpalette\fR, or \fBNULL\fP if the \fBBitsPerPixel\fR>8
.TP20
\fBBitsPerPixel\fR
The number of bits used to represent each pixel in a surface\&. Usually 8, 16, 24 or 32\&.
.TP20
\fBBytesPerPixel\fR
The number of bytes used to represent each pixel in a surface\&. Usually one to four\&.
.TP20
\fB[RGBA]mask\fR
Binary mask used to retrieve individual color values
.TP20
\fB[RGBA]loss\fR
Precision loss of each color component (2^[RGBA]loss)
.TP20
\fB[RGBA]shift\fR
Binary left shift of each color component in the pixel value
.TP20
\fBcolorkey\fR
Pixel value of transparent pixels
.TP20
\fBalpha\fR
Overall surface alpha value
.SH"DESCRIPTION"
.PP
A \fBSDL_PixelFormat\fR describes the format of the pixel data stored at the \fBpixels\fR field of a \fI\fBSDL_Surface\fR\fR\&. Every surface stores a \fBSDL_PixelFormat\fR in the \fBformat\fR field\&.
.PP
If you wish to do pixel level modifications on a surface, then understanding how SDL stores its color information is essential\&.
.PP
8-bit pixel formats are the easiest to understand\&. Since its an 8-bit format, we have 8 \fBBitsPerPixel\fR and 1 \fBBytesPerPixel\fR\&. Since \fBBytesPerPixel\fR is 1, all pixels are represented by a Uint8 which contains an index into \fBpalette\fR->\fBcolors\fR\&. So, to determine the color of a pixel in a 8-bit surface: we read the color index from \fBsurface\fR->\fBpixels\fR and we use that index to read the \fI\fBSDL_Color\fR\fR structure from \fBsurface\fR->\fBformat\fR->\fBpalette\fR->\fBcolors\fR\&. Like so:
Pixel formats above 8-bit are an entirely different experience\&. They are considered to be "TrueColor" formats and the color information is stored in the pixels themselves, not in a palette\&. The mask, shift and loss fields tell us how the color information is encoded\&. The mask fields allow us to isolate each color component, the shift fields tell us the number of bits to the right of each component in the pixel value and the loss fields tell us the number of bits lost from each component when packing 8-bit color component in a pixel\&.