SDL 2.0
|
Go to the source code of this file.
Data Structures | |
struct | SDL_Color |
struct | SDL_Palette |
struct | SDL_PixelFormat |
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.
#define SDL_ALPHA_TRANSPARENT 0 |
Definition at line 47 of file SDL_pixels.h.
#define SDL_BITSPERPIXEL | ( | X | ) | (((X) >> 8) & 0xFF) |
Definition at line 127 of file SDL_pixels.h.
#define SDL_BYTESPERPIXEL | ( | X | ) |
Definition at line 128 of file SDL_pixels.h.
#define SDL_Colour SDL_Color |
Definition at line 316 of file SDL_pixels.h.
#define SDL_DEFINE_PIXELFORMAT | ( | type, | |
order, | |||
layout, | |||
bits, | |||
bytes | |||
) |
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.
#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.
#define SDL_ISPIXELFORMAT_INDEXED | ( | format | ) |
Definition at line 134 of file SDL_pixels.h.
#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.
#define SDL_PIXELORDER | ( | X | ) | (((X) >> 20) & 0x0F) |
Definition at line 125 of file SDL_pixels.h.
#define SDL_PIXELTYPE | ( | X | ) | (((X) >> 24) & 0x0F) |
Definition at line 124 of file SDL_pixels.h.
enum SDL_ArrayOrder |
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.
enum SDL_BitmapOrder |
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.
enum SDL_PackedLayout |
Packed component layout.
Definition at line 104 of file SDL_pixels.h.
enum SDL_PackedOrder |
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.
enum SDL_PixelFormatEnum |
Definition at line 171 of file SDL_pixels.h.
enum SDL_PixelType |
Pixel type.
Definition at line 51 of file SDL_pixels.h.
SDL_PixelFormat * SDL_AllocFormat | ( | Uint32 | pixel_format | ) |
Create an SDL_PixelFormat structure corresponding to a pixel format.
Returned structure may come from a shared global cache (i.e. not newly allocated), and hence should not be modified, especially the palette. Weird errors such as Blit combination not supported
may occur.
pixel_format | one of the SDL_PixelFormatEnum values |
SDL_Palette * SDL_AllocPalette | ( | int | ncolors | ) |
Create a palette structure with the specified number of color entries.
The palette entries are initialized to white.
ncolors | represents the number of color entries in the color palette |
void SDL_CalculateGammaRamp | ( | float | gamma, |
Uint16 * | ramp | ||
) |
Calculate a 256 entry gamma ramp for a gamma value.
gamma | a gamma value where 0.0 is black and 1.0 is identity |
ramp | an array of 256 values filled in with the gamma ramp |
void SDL_FreeFormat | ( | SDL_PixelFormat * | format | ) |
Free an SDL_PixelFormat structure allocated by SDL_AllocFormat().
format | the SDL_PixelFormat structure to free |
void SDL_FreePalette | ( | SDL_Palette * | palette | ) |
Free a palette created with SDL_AllocPalette().
palette | the SDL_Palette structure to be freed |
const char * SDL_GetPixelFormatName | ( | Uint32 | format | ) |
Get the human readable name of a pixel format.
format | the pixel format to query |
SDL_PIXELFORMAT_UNKNOWN
if the format isn't recognized.void SDL_GetRGB | ( | Uint32 | pixel, |
const SDL_PixelFormat * | format, | ||
Uint8 * | r, | ||
Uint8 * | g, | ||
Uint8 * | b | ||
) |
Get RGB values from a pixel in the specified format.
This function uses the entire 8-bit [0..255] range when converting color components from pixel formats with less than 8-bits per RGB component (e.g., a completely white pixel in 16-bit RGB565 format would return [0xff, 0xff, 0xff] not [0xf8, 0xfc, 0xf8]).
pixel | a pixel value |
format | an SDL_PixelFormat structure describing the format of the pixel |
r | a pointer filled in with the red component |
g | a pointer filled in with the green component |
b | a pointer filled in with the blue component |
void SDL_GetRGBA | ( | Uint32 | pixel, |
const SDL_PixelFormat * | format, | ||
Uint8 * | r, | ||
Uint8 * | g, | ||
Uint8 * | b, | ||
Uint8 * | a | ||
) |
Get RGBA values from a pixel in the specified format.
This function uses the entire 8-bit [0..255] range when converting color components from pixel formats with less than 8-bits per RGB component (e.g., a completely white pixel in 16-bit RGB565 format would return [0xff, 0xff, 0xff] not [0xf8, 0xfc, 0xf8]).
If the surface has no alpha component, the alpha will be returned as 0xff (100% opaque).
pixel | a pixel value |
format | an SDL_PixelFormat structure describing the format of the pixel |
r | a pointer filled in with the red component |
g | a pointer filled in with the green component |
b | a pointer filled in with the blue component |
a | a pointer filled in with the alpha component |
Uint32 SDL_MapRGB | ( | const SDL_PixelFormat * | format, |
Uint8 | r, | ||
Uint8 | g, | ||
Uint8 | b | ||
) |
Map an RGB triple to an opaque pixel value for a given pixel format.
This function maps the RGB color value to the specified pixel format and returns the pixel value best approximating the given RGB color value for the given pixel format.
If the format has a palette (8-bit) the index of the closest matching color in the palette will be returned.
If the specified pixel format has an alpha component it will be returned as all 1 bits (fully opaque).
If the pixel format bpp (color depth) is less than 32-bpp then the unused upper bits of the return value can safely be ignored (e.g., with a 16-bpp format the return value can be assigned to a Uint16, and similarly a Uint8 for an 8-bpp format).
format | an SDL_PixelFormat structure describing the pixel format |
r | the red component of the pixel in the range 0-255 |
g | the green component of the pixel in the range 0-255 |
b | the blue component of the pixel in the range 0-255 |
Map an RGBA quadruple to a pixel value for a given pixel format.
This function maps the RGBA color value to the specified pixel format and returns the pixel value best approximating the given RGBA color value for the given pixel format.
If the specified pixel format has no alpha component the alpha value will be ignored (as it will be in formats with a palette).
If the format has a palette (8-bit) the index of the closest matching color in the palette will be returned.
If the pixel format bpp (color depth) is less than 32-bpp then the unused upper bits of the return value can safely be ignored (e.g., with a 16-bpp format the return value can be assigned to a Uint16, and similarly a Uint8 for an 8-bpp format).
format | an SDL_PixelFormat structure describing the format of the pixel |
r | the red component of the pixel in the range 0-255 |
g | the green component of the pixel in the range 0-255 |
b | the blue component of the pixel in the range 0-255 |
a | the alpha component of the pixel in the range 0-255 |
Uint32 SDL_MasksToPixelFormatEnum | ( | int | bpp, |
Uint32 | Rmask, | ||
Uint32 | Gmask, | ||
Uint32 | Bmask, | ||
Uint32 | Amask | ||
) |
Convert a bpp value and RGBA masks to an enumerated pixel format.
This will return SDL_PIXELFORMAT_UNKNOWN
if the conversion wasn't possible.
bpp | a bits per pixel value; usually 15, 16, or 32 |
Rmask | the red mask for the format |
Gmask | the green mask for the format |
Bmask | the blue mask for the format |
Amask | the alpha mask for the format |
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 value and RGBA masks.
format | one of the SDL_PixelFormatEnum values |
bpp | a bits per pixel value; usually 15, 16, or 32 |
Rmask | a pointer filled in with the red mask for the format |
Gmask | a pointer filled in with the green mask for the format |
Bmask | a pointer filled in with the blue mask for the format |
Amask | a pointer filled in with the alpha mask for the format |
int SDL_SetPaletteColors | ( | SDL_Palette * | palette, |
const SDL_Color * | colors, | ||
int | firstcolor, | ||
int | ncolors | ||
) |
Set a range of colors in a palette.
palette | the SDL_Palette structure to modify |
colors | an array of SDL_Color structures to copy into the palette |
firstcolor | the index of the first palette entry to modify |
ncolors | the number of entries to modify |
int SDL_SetPixelFormatPalette | ( | SDL_PixelFormat * | format, |
SDL_Palette * | palette | ||
) |
Set the palette for a pixel format structure.
format | the SDL_PixelFormat structure that will use the palette |
palette | the SDL_Palette structure that will be used |