/Users/hercules/trunk/SDL/include/SDL_pixels.h File Reference

#include "begin_code.h"
#include "close_code.h"

Go to the source code of this file.

Data Structures

struct  SDL_Color
struct  SDL_PaletteWatch
struct  SDL_Palette
struct  SDL_PixelFormat

Defines

#define SDL_ALPHA_OPAQUE   255
#define SDL_ALPHA_TRANSPARENT   0
#define SDL_DEFINE_PIXELFOURCC(A, B, C, D)   ((A) | ((B) << 8) | ((C) << 16) | ((D) << 24))
#define SDL_DEFINE_PIXELFORMAT(type, order, layout, bits, bytes)
#define SDL_PIXELTYPE(X)   (((X) >> 24) & 0x0F)
#define SDL_PIXELORDER(X)   (((X) >> 20) & 0x0F)
#define SDL_PIXELLAYOUT(X)   (((X) >> 16) & 0x0F)
#define SDL_BITSPERPIXEL(X)   (((X) >> 8) & 0xFF)
#define SDL_BYTESPERPIXEL(X)   (((X) >> 0) & 0xFF)
#define SDL_ISPIXELFORMAT_INDEXED(format)
#define SDL_ISPIXELFORMAT_ALPHA(format)
#define SDL_ISPIXELFORMAT_FOURCC(format)   ((format) && !((format) & 0x80000000))
#define SDL_Colour   SDL_Color

Typedefs

typedef struct SDL_Palette SDL_Palette
typedef int(* SDL_PaletteChangedFunc )(void *userdata, SDL_Palette *palette)

Enumerations

enum  {
  SDL_PIXELTYPE_UNKNOWN, SDL_PIXELTYPE_INDEX1, SDL_PIXELTYPE_INDEX4, SDL_PIXELTYPE_INDEX8,
  SDL_PIXELTYPE_PACKED8, SDL_PIXELTYPE_PACKED16, SDL_PIXELTYPE_PACKED32, SDL_PIXELTYPE_ARRAYU8,
  SDL_PIXELTYPE_ARRAYU16, SDL_PIXELTYPE_ARRAYU32, SDL_PIXELTYPE_ARRAYF16, SDL_PIXELTYPE_ARRAYF32
}
enum  { SDL_BITMAPORDER_NONE, SDL_BITMAPORDER_4321, SDL_BITMAPORDER_1234 }
enum  {
  SDL_PACKEDORDER_NONE, SDL_PACKEDORDER_XRGB, SDL_PACKEDORDER_RGBX, SDL_PACKEDORDER_ARGB,
  SDL_PACKEDORDER_RGBA, SDL_PACKEDORDER_XBGR, SDL_PACKEDORDER_BGRX, SDL_PACKEDORDER_ABGR,
  SDL_PACKEDORDER_BGRA
}
enum  {
  SDL_ARRAYORDER_NONE, SDL_ARRAYORDER_RGB, SDL_ARRAYORDER_RGBA, SDL_ARRAYORDER_ARGB,
  SDL_ARRAYORDER_BGR, SDL_ARRAYORDER_BGRA, SDL_ARRAYORDER_ABGR
}
enum  {
  SDL_PACKEDLAYOUT_NONE, SDL_PACKEDLAYOUT_332, SDL_PACKEDLAYOUT_4444, SDL_PACKEDLAYOUT_1555,
  SDL_PACKEDLAYOUT_5551, SDL_PACKEDLAYOUT_565, SDL_PACKEDLAYOUT_8888, SDL_PACKEDLAYOUT_2101010,
  SDL_PACKEDLAYOUT_1010102
}
enum  {
  SDL_PIXELFORMAT_UNKNOWN, SDL_PIXELFORMAT_INDEX1LSB, SDL_PIXELFORMAT_INDEX1MSB, SDL_PIXELFORMAT_INDEX4LSB,
  SDL_PIXELFORMAT_INDEX4MSB, SDL_PIXELFORMAT_INDEX8, SDL_PIXELFORMAT_RGB332, SDL_PIXELFORMAT_RGB444,
  SDL_PIXELFORMAT_RGB555, SDL_PIXELFORMAT_BGR555, SDL_PIXELFORMAT_ARGB4444, SDL_PIXELFORMAT_ABGR4444,
  SDL_PIXELFORMAT_ARGB1555, SDL_PIXELFORMAT_ABGR1555, SDL_PIXELFORMAT_RGB565, SDL_PIXELFORMAT_BGR565,
  SDL_PIXELFORMAT_RGB24, SDL_PIXELFORMAT_BGR24, SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888,
  SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGRA8888,
  SDL_PIXELFORMAT_ARGB2101010, SDL_PIXELFORMAT_YV12, SDL_PIXELFORMAT_IYUV, SDL_PIXELFORMAT_YUY2,
  SDL_PIXELFORMAT_UYVY, SDL_PIXELFORMAT_YVYU
}

Functions

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_Palette *SDLCALL SDL_AllocPalette (int ncolors)
 Create a palette structure with the specified number of color entries.
DECLSPEC int SDLCALL SDL_AddPaletteWatch (SDL_Palette *palette, SDL_PaletteChangedFunc callback, void *userdata)
 Add a callback function which is called when the palette changes.
DECLSPEC void SDLCALL SDL_DelPaletteWatch (SDL_Palette *palette, SDL_PaletteChangedFunc callback, void *userdata)
 Remove a callback function previously added with SDL_AddPaletteWatch().
DECLSPEC int SDLCALL SDL_SetPaletteColors (SDL_Palette *palette, const SDL_Color *colors, int firstcolor, int ncolors)
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)
 Maps a pixel value into the RGB components for a given pixel format.
DECLSPEC void SDLCALL SDL_GetRGBA (Uint32 pixel, const SDL_PixelFormat *format, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a)
 Maps a pixel value into the RGBA components for a given pixel format.


Detailed Description

Header for the enumerated pixel format definitions

Define Documentation

#define SDL_DEFINE_PIXELFORMAT ( type,
order,
layout,
bits,
bytes   ) 

Value:

((1 << 31) | ((type) << 24) | ((order) << 20) | ((layout) << 16) | \
     ((bits) << 8) | ((bytes) << 0))

#define SDL_ISPIXELFORMAT_ALPHA ( format   ) 

Value:

((SDL_PIXELORDER(format) == SDL_PACKEDORDER_ARGB) || \
     (SDL_PIXELORDER(format) == SDL_PACKEDORDER_RGBA) || \
     (SDL_PIXELORDER(format) == SDL_PACKEDORDER_ABGR) || \
     (SDL_PIXELORDER(format) == SDL_PACKEDORDER_BGRA))

#define SDL_ISPIXELFORMAT_INDEXED ( format   ) 

Value:

((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX1) || \
     (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX4) || \
     (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX8))


Function Documentation

int SDL_AddPaletteWatch ( SDL_Palette *  palette,
SDL_PaletteChangedFunc  callback,
void *  userdata 
)

Add a callback function which is called when the palette changes.

See also:
SDL_DelPaletteWatch()

SDL_Palette * 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()

void SDL_DelPaletteWatch ( SDL_Palette *  palette,
SDL_PaletteChangedFunc  callback,
void *  userdata 
)

Remove a callback function previously added with SDL_AddPaletteWatch().

See also:
SDL_AddPaletteWatch()

void SDL_FreePalette ( SDL_Palette *  palette  ) 

Free a palette created with SDL_AllocPalette().

See also:
SDL_AllocPalette()

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

Maps a pixel value into the RGB components for a given pixel format.

See also:
SDL_GetRGBA

void SDL_GetRGBA ( Uint32  pixel,
const SDL_PixelFormat *  format,
Uint8 r,
Uint8 g,
Uint8 b,
Uint8 a 
)

Maps a pixel value into the RGBA components for a given pixel format.

See also:
SDL_GetRGB

Uint32 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

Uint32 SDL_MapRGBA ( const SDL_PixelFormat *  fmt,
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

Uint32 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()

SDL_bool 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()


Generated on Mon Sep 21 21:32:25 2009 for Simple DirectMedia Layer by  doxygen 1.5.8