SDL standard library

Dependents:   H261_encoder

Embed: (wiki syntax)

« Back to documentation index

SDL_pixels.h File Reference

SDL_pixels.h File Reference

Header for the enumerated pixel format definitions. More...

Go to the source code of this file.

Data Structures

struct  SDL_PixelFormat

Typedefs

typedef struct SDL_PixelFormat SDL_PixelFormat

Enumerations

enum  
 

Pixel type.

More...
enum  
 

Bitmap pixel order, high bit -> low bit.

More...
enum  
 

Packed component order, high bit -> low bit.

More...
enum  
 

Array component order, low byte -> high byte.

More...
enum  
 

Packed component layout.

More...
enum  { ,
  SDL_PIXELFORMAT_YV12, SDL_PIXELFORMAT_IYUV, SDL_PIXELFORMAT_YUY2, SDL_PIXELFORMAT_UYVY,
  SDL_PIXELFORMAT_YVYU
}

Functions

DECLSPEC const char *SDLCALL SDL_GetPixelFormatName (Uint32 format)
 Get the human readable name of a pixel format.
DECLSPEC SDL_bool SDLCALL SDL_PixelFormatEnumToMasks (Uint32 format, int *bpp, Uint32 *Rmask, Uint32 *Gmask, Uint32 *Bmask, Uint32 *Amask)
 Convert one of the enumerated pixel formats to a bpp and RGBA masks.
DECLSPEC Uint32 SDLCALL SDL_MasksToPixelFormatEnum (int bpp, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
 Convert a bpp and RGBA masks to an enumerated pixel format.
DECLSPEC SDL_PixelFormat *SDLCALL SDL_AllocFormat (Uint32 pixel_format)
 Create an SDL_PixelFormat structure from a pixel format enum.
DECLSPEC void SDLCALL SDL_FreeFormat (SDL_PixelFormat *format)
 Free an SDL_PixelFormat structure.
DECLSPEC SDL_Palette *SDLCALL SDL_AllocPalette (int ncolors)
 Create a palette structure with the specified number of color entries.
DECLSPEC int SDLCALL SDL_SetPixelFormatPalette (SDL_PixelFormat *format, SDL_Palette *palette)
 Set the palette for a pixel format structure.
DECLSPEC int SDLCALL SDL_SetPaletteColors (SDL_Palette *palette, const SDL_Color *colors, int firstcolor, int ncolors)
 Set a range of colors in a palette.
DECLSPEC void SDLCALL SDL_FreePalette (SDL_Palette *palette)
 Free a palette created with SDL_AllocPalette().
DECLSPEC Uint32 SDLCALL SDL_MapRGB (const SDL_PixelFormat *format, Uint8 r, Uint8 g, Uint8 b)
 Maps an RGB triple to an opaque pixel value for a given pixel format.
DECLSPEC Uint32 SDLCALL SDL_MapRGBA (const SDL_PixelFormat *format, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Maps an RGBA quadruple to a pixel value for a given pixel format.
DECLSPEC void SDLCALL SDL_GetRGB (Uint32 pixel, const SDL_PixelFormat *format, Uint8 *r, Uint8 *g, Uint8 *b)
 Get the RGB components from a pixel of the specified format.
DECLSPEC void SDLCALL SDL_GetRGBA (Uint32 pixel, const SDL_PixelFormat *format, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a)
 Get the RGBA components from a pixel of the specified format.
DECLSPEC void SDLCALL SDL_CalculateGammaRamp (float gamma, Uint16 *ramp)
 Calculate a 256 entry gamma ramp for a gamma value.

Detailed Description

Header for the enumerated pixel format definitions.

Definition in file SDL_pixels.h.


Typedef Documentation

Note:
Everything in the pixel format structure is read-only.

Enumeration Type Documentation

anonymous enum

Pixel type.

Definition at line 50 of file SDL_pixels.h.

anonymous enum

Bitmap pixel order, high bit -> low bit.

Definition at line 67 of file SDL_pixels.h.

anonymous enum

Packed component order, high bit -> low bit.

Definition at line 75 of file SDL_pixels.h.

anonymous enum

Array component order, low byte -> high byte.

Definition at line 89 of file SDL_pixels.h.

anonymous enum

Packed component layout.

Definition at line 101 of file SDL_pixels.h.

anonymous enum
Enumerator:
SDL_PIXELFORMAT_YV12 

Planar mode: Y + V + U (3 planes)

SDL_PIXELFORMAT_IYUV 

Planar mode: Y + U + V (3 planes)

SDL_PIXELFORMAT_YUY2 

Packed mode: Y0+U0+Y1+V0 (1 plane)

SDL_PIXELFORMAT_UYVY 

Packed mode: U0+Y0+V0+Y1 (1 plane)

SDL_PIXELFORMAT_YVYU 

Packed mode: Y0+V0+Y1+U0 (1 plane)

Definition at line 149 of file SDL_pixels.h.


Function Documentation

DECLSPEC SDL_PixelFormat* SDLCALL SDL_AllocFormat ( Uint32  pixel_format )

Create an SDL_PixelFormat structure from a pixel format enum.

DECLSPEC SDL_Palette* SDLCALL SDL_AllocPalette ( int  ncolors )

Create a palette structure with the specified number of color entries.

Returns:
A new palette, or NULL if there wasn't enough memory.
Note:
The palette entries are initialized to white.
See also:
SDL_FreePalette()
DECLSPEC void SDLCALL SDL_CalculateGammaRamp ( float  gamma,
Uint16 ramp 
)

Calculate a 256 entry gamma ramp for a gamma value.

DECLSPEC void SDLCALL SDL_FreeFormat ( SDL_PixelFormat format )

Free an SDL_PixelFormat structure.

DECLSPEC void SDLCALL SDL_FreePalette ( SDL_Palette *  palette )

Free a palette created with SDL_AllocPalette().

See also:
SDL_AllocPalette()
DECLSPEC const char* SDLCALL SDL_GetPixelFormatName ( Uint32  format )

Get the human readable name of a pixel format.

DECLSPEC void SDLCALL SDL_GetRGB ( Uint32  pixel,
const SDL_PixelFormat format,
Uint8 r,
Uint8 g,
Uint8 b 
)

Get the RGB components from a pixel of the specified format.

See also:
SDL_GetRGBA
DECLSPEC void SDLCALL SDL_GetRGBA ( Uint32  pixel,
const SDL_PixelFormat format,
Uint8 r,
Uint8 g,
Uint8 b,
Uint8 a 
)

Get the RGBA components from a pixel of the specified format.

See also:
SDL_GetRGB
DECLSPEC Uint32 SDLCALL SDL_MapRGB ( const SDL_PixelFormat format,
Uint8  r,
Uint8  g,
Uint8  b 
)

Maps an RGB triple to an opaque pixel value for a given pixel format.

See also:
SDL_MapRGBA
DECLSPEC Uint32 SDLCALL SDL_MapRGBA ( const SDL_PixelFormat format,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Maps an RGBA quadruple to a pixel value for a given pixel format.

See also:
SDL_MapRGB
DECLSPEC Uint32 SDLCALL SDL_MasksToPixelFormatEnum ( int  bpp,
Uint32  Rmask,
Uint32  Gmask,
Uint32  Bmask,
Uint32  Amask 
)

Convert a bpp and RGBA masks to an enumerated pixel format.

Returns:
The pixel format, or SDL_PIXELFORMAT_UNKNOWN if the conversion wasn't possible.
See also:
SDL_PixelFormatEnumToMasks()
DECLSPEC SDL_bool SDLCALL SDL_PixelFormatEnumToMasks ( Uint32  format,
int *  bpp,
Uint32 Rmask,
Uint32 Gmask,
Uint32 Bmask,
Uint32 Amask 
)

Convert one of the enumerated pixel formats to a bpp and RGBA masks.

Returns:
SDL_TRUE, or SDL_FALSE if the conversion wasn't possible.
See also:
SDL_MasksToPixelFormatEnum()
DECLSPEC int SDLCALL SDL_SetPaletteColors ( SDL_Palette *  palette,
const SDL_Color *  colors,
int  firstcolor,
int  ncolors 
)

Set a range of colors in a palette.

Parameters:
paletteThe palette to modify.
colorsAn array of colors to copy into the palette.
firstcolorThe index of the first palette entry to modify.
ncolorsThe number of entries to modify.
Returns:
0 on success, or -1 if not all of the colors could be set.
DECLSPEC int SDLCALL SDL_SetPixelFormatPalette ( SDL_PixelFormat format,
SDL_Palette *  palette 
)

Set the palette for a pixel format structure.