SDL
2.0
|
Go to the source code of this file.
Data Structures | |
struct | SDL_Color |
struct | SDL_Palette |
struct | SDL_PixelFormat |
Macros | |
#define | SDL_DEFINE_PIXELFOURCC(A, B, C, D) SDL_FOURCC(A, B, C, D) |
#define | SDL_DEFINE_PIXELFORMAT(type, order, layout, bits, bytes) |
#define | SDL_PIXELFLAG(X) (((X) >> 28) & 0x0F) |
#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) |
#define | SDL_ISPIXELFORMAT_INDEXED(format) |
#define | SDL_ISPIXELFORMAT_PACKED(format) |
#define | SDL_ISPIXELFORMAT_ARRAY(format) |
#define | SDL_ISPIXELFORMAT_ALPHA(format) |
#define | SDL_ISPIXELFORMAT_FOURCC(format) ((format) && (SDL_PIXELFLAG(format) != 1)) |
#define | SDL_Colour SDL_Color |
Transparency definitions | |
These define alpha as the opacity of a surface. | |
#define | SDL_ALPHA_OPAQUE 255 |
#define | SDL_ALPHA_TRANSPARENT 0 |
Functions | |
const char * | SDL_GetPixelFormatName (Uint32 format) |
Get the human readable name of a pixel format. More... | |
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. More... | |
Uint32 | SDL_MasksToPixelFormatEnum (int bpp, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask) |
Convert a bpp and RGBA masks to an enumerated pixel format. More... | |
SDL_PixelFormat * | SDL_AllocFormat (Uint32 pixel_format) |
Create an SDL_PixelFormat structure from a pixel format enum. More... | |
void | SDL_FreeFormat (SDL_PixelFormat *format) |
Free an SDL_PixelFormat structure. More... | |
SDL_Palette * | SDL_AllocPalette (int ncolors) |
Create a palette structure with the specified number of color entries. More... | |
int | SDL_SetPixelFormatPalette (SDL_PixelFormat *format, SDL_Palette *palette) |
Set the palette for a pixel format structure. More... | |
int | SDL_SetPaletteColors (SDL_Palette *palette, const SDL_Color *colors, int firstcolor, int ncolors) |
Set a range of colors in a palette. More... | |
void | SDL_FreePalette (SDL_Palette *palette) |
Free a palette created with SDL_AllocPalette(). More... | |
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. More... | |
Uint32 | 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. More... | |
void | 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. More... | |
void | 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. More... | |
void | SDL_CalculateGammaRamp (float gamma, Uint16 *ramp) |
Calculate a 256 entry gamma ramp for a gamma value. More... | |
Header for the enumerated pixel format definitions.
Definition in file SDL_pixels.h.
#define SDL_ALPHA_OPAQUE 255 |
Definition at line 46 of file SDL_pixels.h.
Referenced by _clearScreen(), _hasDrawColor(), BlitARGBto555PixelAlpha(), BlitARGBto565PixelAlpha(), BlitRGBtoRGBPixelAlpha(), CorrectAlphaChannel(), loop(), render_testPrimitives(), SDL_DitherColors(), SDL_LoadBMP_RW(), SDL_MapRGB(), SDL_SetColorKey(), WatchGameController(), and WatchJoystick().
#define SDL_ALPHA_TRANSPARENT 0 |
Definition at line 47 of file SDL_pixels.h.
Referenced by SDL_SetColorKey().
#define SDL_BITSPERPIXEL | ( | X | ) | (((X) >> 8) & 0xFF) |
Definition at line 127 of file SDL_pixels.h.
Referenced by cmpmodes(), main(), SDL_CalculatePitch(), SDL_GetClosestDisplayModeForDisplay(), and SDL_PixelFormatEnumToMasks().
#define SDL_BYTESPERPIXEL | ( | X | ) |
Definition at line 128 of file SDL_pixels.h.
Referenced by SDL_CalculatePitch(), SDL_ConvertPixels(), SDL_CreateTexture(), SDL_CreateWindowTexture(), SDL_LockTextureNative(), SDL_PixelFormatEnumToMasks(), SDL_RenderReadPixels(), SDL_UnlockTextureNative(), SDL_UpdateTextureNative(), SDL_UpdateTextureYUV(), and SDL_UpdateTextureYUVPlanar().
#define SDL_Colour SDL_Color |
Definition at line 302 of file SDL_pixels.h.
Definition at line 119 of file SDL_pixels.h.
#define SDL_DEFINE_PIXELFOURCC | ( | A, | |
B, | |||
C, | |||
D | |||
) | SDL_FOURCC(A, B, C, D) |
Definition at line 117 of file SDL_pixels.h.
#define SDL_ISPIXELFORMAT_ALPHA | ( | format | ) |
Definition at line 154 of file SDL_pixels.h.
Referenced by GetClosestSupportedFormat(), main(), SDL_CreateTextureFromSurface(), and SDL_CreateWindowTexture().
#define SDL_ISPIXELFORMAT_ARRAY | ( | format | ) |
Definition at line 146 of file SDL_pixels.h.
#define SDL_ISPIXELFORMAT_FOURCC | ( | format | ) | ((format) && (SDL_PIXELFLAG(format) != 1)) |
Definition at line 167 of file SDL_pixels.h.
Referenced by GetClosestSupportedFormat(), SDL_CalculateBlit(), SDL_ConvertPixels(), SDL_CreateTexture(), SDL_CreateTextureFromSurface(), SDL_CreateWindowTexture(), and SDL_PixelFormatEnumToMasks().
#define SDL_ISPIXELFORMAT_INDEXED | ( | format | ) |
Definition at line 134 of file SDL_pixels.h.
Referenced by SDL_AllocFormat(), SDL_CalculateBlit(), SDL_CreateRGBSurfaceWithFormat(), SDL_CreateSurfaceOnStack(), SDL_CreateTexture(), SDL_LowerBlitScaled(), and SDL_MapSurface().
#define SDL_ISPIXELFORMAT_PACKED | ( | format | ) |
Definition at line 140 of file SDL_pixels.h.
#define SDL_PIXELFLAG | ( | X | ) | (((X) >> 28) & 0x0F) |
Definition at line 123 of file SDL_pixels.h.
#define SDL_PIXELLAYOUT | ( | X | ) | (((X) >> 16) & 0x0F) |
Definition at line 126 of file SDL_pixels.h.
Referenced by cmpmodes(), SDL_PixelFormatEnumToMasks(), and SW_RenderCopyEx().
#define SDL_PIXELORDER | ( | X | ) | (((X) >> 20) & 0x0F) |
Definition at line 125 of file SDL_pixels.h.
Referenced by SDL_PixelFormatEnumToMasks().
#define SDL_PIXELTYPE | ( | X | ) | (((X) >> 24) & 0x0F) |
Definition at line 124 of file SDL_pixels.h.
Referenced by SDL_GetClosestDisplayModeForDisplay(), and SDL_PixelFormatEnumToMasks().
anonymous enum |
Pixel type.
Definition at line 51 of file SDL_pixels.h.
anonymous enum |
Bitmap pixel order, high bit -> low bit.
Enumerator | |
---|---|
SDL_BITMAPORDER_NONE | |
SDL_BITMAPORDER_4321 | |
SDL_BITMAPORDER_1234 |
Definition at line 68 of file SDL_pixels.h.
anonymous enum |
Packed component order, high bit -> low bit.
Enumerator | |
---|---|
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 |
Definition at line 76 of file SDL_pixels.h.
anonymous enum |
Array component order, low byte -> high byte.
Enumerator | |
---|---|
SDL_ARRAYORDER_NONE | |
SDL_ARRAYORDER_RGB | |
SDL_ARRAYORDER_RGBA | |
SDL_ARRAYORDER_ARGB | |
SDL_ARRAYORDER_BGR | |
SDL_ARRAYORDER_BGRA | |
SDL_ARRAYORDER_ABGR |
Definition at line 92 of file SDL_pixels.h.
anonymous enum |
Packed component layout.
Definition at line 104 of file SDL_pixels.h.
anonymous enum |
Definition at line 171 of file SDL_pixels.h.
SDL_PixelFormat* SDL_AllocFormat | ( | Uint32 | pixel_format | ) |
Create an SDL_PixelFormat structure from a pixel format enum.
Definition at line 496 of file SDL_pixels.c.
References SDL_PixelFormat::format, formats, formats_lock, SDL_PixelFormat::next, NULL, SDL_PixelFormat::refcount, SDL_AtomicLock, SDL_AtomicUnlock, SDL_free, SDL_InitFormat(), SDL_InvalidParamError, SDL_ISPIXELFORMAT_INDEXED, SDL_malloc, and SDL_OutOfMemory.
SDL_Palette* SDL_AllocPalette | ( | int | ncolors | ) |
Create a palette structure with the specified number of color entries.
Definition at line 639 of file SDL_pixels.c.
References SDL_Palette::colors, SDL_Palette::ncolors, NULL, SDL_Palette::refcount, SDL_free, SDL_InvalidParamError, SDL_malloc, SDL_memset, SDL_OutOfMemory, and SDL_Palette::version.
Calculate a 256 entry gamma ramp for a gamma value.
Definition at line 1086 of file SDL_pixels.c.
References i, NULL, SDL_InvalidParamError, SDL_memset, and SDL_pow.
void SDL_FreeFormat | ( | SDL_PixelFormat * | format | ) |
Free an SDL_PixelFormat structure.
Definition at line 602 of file SDL_pixels.c.
References formats_lock, SDL_PixelFormat::next, SDL_PixelFormat::palette, SDL_PixelFormat::refcount, SDL_AtomicLock, SDL_AtomicUnlock, SDL_free, SDL_FreePalette(), and SDL_InvalidParamError.
void SDL_FreePalette | ( | SDL_Palette * | palette | ) |
Free a palette created with SDL_AllocPalette().
Definition at line 725 of file SDL_pixels.c.
References SDL_Palette::colors, SDL_Palette::refcount, SDL_free, and SDL_InvalidParamError.
Referenced by SDL_FreeFormat(), and SDL_SetPixelFormatPalette().
const char* SDL_GetPixelFormatName | ( | Uint32 | format | ) |
Get the human readable name of a pixel format.
Definition at line 86 of file SDL_pixels.c.
References CASE, SDL_PIXELFORMAT_ABGR1555, SDL_PIXELFORMAT_ABGR4444, SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB1555, SDL_PIXELFORMAT_ARGB2101010, SDL_PIXELFORMAT_ARGB4444, SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR24, SDL_PIXELFORMAT_BGR555, SDL_PIXELFORMAT_BGR565, SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGRA4444, SDL_PIXELFORMAT_BGRA5551, SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGRX8888, SDL_PIXELFORMAT_INDEX1LSB, SDL_PIXELFORMAT_INDEX1MSB, SDL_PIXELFORMAT_INDEX4LSB, SDL_PIXELFORMAT_INDEX4MSB, SDL_PIXELFORMAT_INDEX8, SDL_PIXELFORMAT_IYUV, SDL_PIXELFORMAT_NV12, SDL_PIXELFORMAT_NV21, SDL_PIXELFORMAT_RGB24, SDL_PIXELFORMAT_RGB332, SDL_PIXELFORMAT_RGB444, SDL_PIXELFORMAT_RGB555, SDL_PIXELFORMAT_RGB565, SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGBA4444, SDL_PIXELFORMAT_RGBA5551, SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGBX8888, SDL_PIXELFORMAT_UYVY, SDL_PIXELFORMAT_YUY2, SDL_PIXELFORMAT_YV12, and SDL_PIXELFORMAT_YVYU.
Get the RGB components from a pixel of the specified format.
Definition at line 826 of file SDL_pixels.c.
References SDL_Color::b, SDL_PixelFormat::Bloss, SDL_PixelFormat::Bmask, SDL_PixelFormat::Bshift, SDL_Palette::colors, SDL_Color::g, SDL_PixelFormat::Gloss, SDL_PixelFormat::Gmask, SDL_PixelFormat::Gshift, SDL_Palette::ncolors, NULL, SDL_PixelFormat::palette, SDL_Color::r, SDL_PixelFormat::Rloss, SDL_PixelFormat::Rmask, SDL_PixelFormat::Rshift, and SDL_expand_byte.
void 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.
Definition at line 849 of file SDL_pixels.c.
References SDL_Color::a, SDL_PixelFormat::Aloss, SDL_PixelFormat::Amask, SDL_PixelFormat::Ashift, SDL_Color::b, SDL_PixelFormat::Bloss, SDL_PixelFormat::Bmask, SDL_PixelFormat::Bshift, SDL_Palette::colors, SDL_Color::g, SDL_PixelFormat::Gloss, SDL_PixelFormat::Gmask, SDL_PixelFormat::Gshift, SDL_Palette::ncolors, NULL, SDL_PixelFormat::palette, SDL_Color::r, SDL_PixelFormat::Rloss, SDL_PixelFormat::Rmask, SDL_PixelFormat::Rshift, and SDL_expand_byte.
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.
Definition at line 799 of file SDL_pixels.c.
References SDL_PixelFormat::Amask, SDL_PixelFormat::Bloss, SDL_PixelFormat::Bshift, SDL_PixelFormat::Gloss, SDL_PixelFormat::Gshift, NULL, SDL_PixelFormat::palette, SDL_PixelFormat::Rloss, SDL_PixelFormat::Rshift, SDL_ALPHA_OPAQUE, and SDL_FindColor().
Maps an RGBA quadruple to a pixel value for a given pixel format.
Definition at line 812 of file SDL_pixels.c.
References SDL_PixelFormat::Aloss, SDL_PixelFormat::Amask, SDL_PixelFormat::Ashift, SDL_PixelFormat::Bloss, SDL_PixelFormat::Bshift, SDL_PixelFormat::Gloss, SDL_PixelFormat::Gshift, NULL, SDL_PixelFormat::palette, SDL_PixelFormat::Rloss, SDL_PixelFormat::Rshift, and SDL_FindColor().
Uint32 SDL_MasksToPixelFormatEnum | ( | int | bpp, |
Uint32 | Rmask, | ||
Uint32 | Gmask, | ||
Uint32 | Bmask, | ||
Uint32 | Amask | ||
) |
Convert a bpp and RGBA masks to an enumerated pixel format.
Definition at line 293 of file SDL_pixels.c.
References SDL_PIXELFORMAT_ABGR1555, SDL_PIXELFORMAT_ABGR4444, SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB1555, SDL_PIXELFORMAT_ARGB2101010, SDL_PIXELFORMAT_ARGB4444, SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR24, SDL_PIXELFORMAT_BGR555, SDL_PIXELFORMAT_BGR565, SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGRA4444, SDL_PIXELFORMAT_BGRA5551, SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGRX8888, SDL_PIXELFORMAT_INDEX1MSB, SDL_PIXELFORMAT_INDEX4MSB, SDL_PIXELFORMAT_INDEX8, SDL_PIXELFORMAT_RGB24, SDL_PIXELFORMAT_RGB332, SDL_PIXELFORMAT_RGB444, SDL_PIXELFORMAT_RGB555, SDL_PIXELFORMAT_RGB565, SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGBA4444, SDL_PIXELFORMAT_RGBA5551, SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGBX8888, and SDL_PIXELFORMAT_UNKNOWN.
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.
Definition at line 134 of file SDL_pixels.c.
References SDL_BITSPERPIXEL, SDL_BYTESPERPIXEL, SDL_FALSE, SDL_ISPIXELFORMAT_FOURCC, SDL_PACKEDLAYOUT_1010102, SDL_PACKEDLAYOUT_1555, SDL_PACKEDLAYOUT_2101010, SDL_PACKEDLAYOUT_332, SDL_PACKEDLAYOUT_4444, SDL_PACKEDLAYOUT_5551, SDL_PACKEDLAYOUT_565, SDL_PACKEDLAYOUT_8888, SDL_PACKEDORDER_ABGR, SDL_PACKEDORDER_ARGB, SDL_PACKEDORDER_BGRA, SDL_PACKEDORDER_BGRX, SDL_PACKEDORDER_RGBA, SDL_PACKEDORDER_RGBX, SDL_PACKEDORDER_XBGR, SDL_PACKEDORDER_XRGB, SDL_PIXELFORMAT_BGR24, SDL_PIXELFORMAT_RGB24, SDL_PIXELLAYOUT, SDL_PIXELORDER, SDL_PIXELTYPE, SDL_PIXELTYPE_PACKED16, SDL_PIXELTYPE_PACKED32, SDL_PIXELTYPE_PACKED8, SDL_SetError, and SDL_TRUE.
Referenced by SDL_InitFormat().
int SDL_SetPaletteColors | ( | SDL_Palette * | palette, |
const SDL_Color * | colors, | ||
int | firstcolor, | ||
int | ncolors | ||
) |
Set a range of colors in a palette.
palette | The palette to modify. |
colors | An array of colors to copy into the palette. |
firstcolor | The index of the first palette entry to modify. |
ncolors | The number of entries to modify. |
Definition at line 698 of file SDL_pixels.c.
References SDL_Palette::colors, SDL_Palette::ncolors, SDL_memcpy, and SDL_Palette::version.
int SDL_SetPixelFormatPalette | ( | SDL_PixelFormat * | format, |
SDL_Palette * | palette | ||
) |
Set the palette for a pixel format structure.
Definition at line 670 of file SDL_pixels.c.
References SDL_PixelFormat::BitsPerPixel, SDL_Palette::ncolors, SDL_PixelFormat::palette, SDL_Palette::refcount, SDL_FreePalette(), and SDL_SetError.