SDL_pixels.h File Reference
`#include "SDL_stdinc.h"`
`#include "SDL_endian.h"`
`#include "begin_code.h"`
`#include "close_code.h"`
Include dependency graph for SDL_pixels.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Data Structures

struct | SDL_Color
struct | SDL_Palette
struct | SDL_PixelFormat

## Transparency definitions

# CategoryPixels

Header for the enumerated pixel format definitions.

These define alpha as the opacity of a surface.

#define | SDL_ALPHA_OPAQUE 255
#define | SDL_ALPHA_TRANSPARENT 0
#define | SDL_DEFINE_PIXELFOURCC(A, B, C, D)
#define | SDL_DEFINE_PIXELFORMAT(type, order, layout, bits, bytes)
#define | SDL_PIXELFLAG(X)
#define | SDL_PIXELTYPE(X)
#define | SDL_PIXELORDER(X)
#define | SDL_PIXELLAYOUT(X)
#define | SDL_BITSPERPIXEL(X)
#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)
#define | SDL_Colour SDL_Color
enum | SDL_PixelType { 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 , SDL_PIXELTYPE_INDEX2 }
enum | SDL_BitmapOrder { SDL_BITMAPORDER_NONE , SDL_BITMAPORDER_4321 , SDL_BITMAPORDER_1234 }
enum | SDL_PackedOrder { 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 { SDL_ARRAYORDER_NONE , SDL_ARRAYORDER_RGB , SDL_ARRAYORDER_RGBA , SDL_ARRAYORDER_ARGB , SDL_ARRAYORDER_BGR , SDL_ARRAYORDER_BGRA , SDL_ARRAYORDER_ABGR }
enum | SDL_PackedLayout { 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_PixelFormatEnum {
SDL_PIXELFORMAT_UNKNOWN ,
SDL_PIXELFORMAT_INDEX1LSB ,
SDL_PIXELFORMAT_INDEX1MSB ,
SDL_PIXELFORMAT_INDEX2LSB ,
SDL_PIXELFORMAT_INDEX2MSB ,
SDL_PIXELFORMAT_INDEX4LSB ,
SDL_PIXELFORMAT_INDEX4MSB ,
SDL_PIXELFORMAT_INDEX8 ,
SDL_PIXELFORMAT_RGB332 ,
SDL_PIXELFORMAT_XRGB4444 ,
SDL_PIXELFORMAT_RGB444 = SDL_PIXELFORMAT_XRGB4444 ,
SDL_PIXELFORMAT_XBGR4444 ,
SDL_PIXELFORMAT_BGR444 = SDL_PIXELFORMAT_XBGR4444 ,
SDL_PIXELFORMAT_XRGB1555 ,
SDL_PIXELFORMAT_RGB555 = SDL_PIXELFORMAT_XRGB1555 ,
SDL_PIXELFORMAT_XBGR1555 ,
SDL_PIXELFORMAT_BGR555 = SDL_PIXELFORMAT_XBGR1555 ,
SDL_PIXELFORMAT_ARGB4444 ,
SDL_PIXELFORMAT_RGBA4444 ,
SDL_PIXELFORMAT_ABGR4444 ,
SDL_PIXELFORMAT_BGRA4444 ,
SDL_PIXELFORMAT_ARGB1555 ,
SDL_PIXELFORMAT_RGBA5551 ,
SDL_PIXELFORMAT_ABGR1555 ,
SDL_PIXELFORMAT_BGRA5551 ,
SDL_PIXELFORMAT_RGB565 ,
SDL_PIXELFORMAT_BGR565 ,
SDL_PIXELFORMAT_RGB24 ,
SDL_PIXELFORMAT_BGR24 ,
SDL_PIXELFORMAT_XRGB8888 ,
SDL_PIXELFORMAT_RGB888 = SDL_PIXELFORMAT_XRGB8888 ,
SDL_PIXELFORMAT_RGBX8888 ,
SDL_PIXELFORMAT_XBGR8888 ,
SDL_PIXELFORMAT_BGR888 = SDL_PIXELFORMAT_XBGR8888 ,
SDL_PIXELFORMAT_BGRX8888 ,
SDL_PIXELFORMAT_ARGB8888 ,
SDL_PIXELFORMAT_RGBA8888 ,
SDL_PIXELFORMAT_ABGR8888 ,
SDL_PIXELFORMAT_BGRA8888 ,
SDL_PIXELFORMAT_ARGB2101010 ,
SDL_PIXELFORMAT_RGBA32 = SDL_PIXELFORMAT_RGBA8888 ,
SDL_PIXELFORMAT_ARGB32 = SDL_PIXELFORMAT_ARGB8888 ,
SDL_PIXELFORMAT_BGRA32 = SDL_PIXELFORMAT_BGRA8888 ,
SDL_PIXELFORMAT_ABGR32 = SDL_PIXELFORMAT_ABGR8888 ,
SDL_PIXELFORMAT_RGBX32 = SDL_PIXELFORMAT_RGBX8888 ,
SDL_PIXELFORMAT_XRGB32 = SDL_PIXELFORMAT_XRGB8888 ,
SDL_PIXELFORMAT_BGRX32 = SDL_PIXELFORMAT_BGRX8888 ,
SDL_PIXELFORMAT_XBGR32 = SDL_PIXELFORMAT_XBGR8888 ,
SDL_PIXELFORMAT_YV12 ,
SDL_PIXELFORMAT_IYUV ,
SDL_PIXELFORMAT_YUY2 ,
SDL_PIXELFORMAT_UYVY ,
SDL_PIXELFORMAT_YVYU ,
SDL_PIXELFORMAT_NV12 ,
SDL_PIXELFORMAT_NV21 ,
SDL_PIXELFORMAT_EXTERNAL_OES =
}

const char * | SDL_GetPixelFormatName (Uint32 format)
SDL_bool | SDL_PixelFormatEnumToMasks (Uint32 format, int *bpp, Uint32 *Rmask, Uint32 *Gmask, Uint32 *Bmask, Uint32 *Amask)
Uint32 | SDL_MasksToPixelFormatEnum (int bpp, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
SDL_PixelFormat * | SDL_AllocFormat (Uint32 pixel_format)
void | SDL_FreeFormat (SDL_PixelFormat *format)
SDL_Palette * | SDL_AllocPalette (int ncolors)
int | SDL_SetPixelFormatPalette (SDL_PixelFormat *format, SDL_Palette *palette)
int | SDL_SetPaletteColors (SDL_Palette *palette, const SDL_Color *colors, int firstcolor, int ncolors)
void | SDL_FreePalette (SDL_Palette *palette)
Uint32 | SDL_MapRGB (const SDL_PixelFormat *format, Uint8 r, Uint8 g, Uint8 b)
Uint32 | SDL_MapRGBA (const SDL_PixelFormat *format, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
void | SDL_GetRGB (Uint32 pixel, const SDL_PixelFormat *format, Uint8 *r, Uint8 *g, Uint8 *b)
void | SDL_GetRGBA (Uint32 pixel, const SDL_PixelFormat *format, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a)
void | SDL_CalculateGammaRamp (float gamma, Uint16 *ramp)

## Macro Definition Documentation

## SDL_ALPHA_OPAQUE

#define SDL_ALPHA_OPAQUE 255

Definition at line 46 of file SDL_pixels.h.

## SDL_ALPHA_TRANSPARENT

#define SDL_ALPHA_TRANSPARENT 0

Definition at line 47 of file SDL_pixels.h.

## SDL_BITSPERPIXEL

#define SDL_BITSPERPIXEL | ( |  | X | ) |

Value:
(((X) >> 8) & 0xFF)

Definition at line 130 of file SDL_pixels.h.

## SDL_BYTESPERPIXEL

#define SDL_BYTESPERPIXEL | ( |  | X | ) |

Value:
(SDL_ISPIXELFORMAT_FOURCC(X) ? \
((((X) == SDL_PIXELFORMAT_YUY2) || \
((X) == SDL_PIXELFORMAT_UYVY) || \
((X) == SDL_PIXELFORMAT_YVYU)) ? 2 : 1) : (((X) >> 0) & 0xFF))
SDL_PIXELFORMAT_YVYU
@ SDL_PIXELFORMAT_YVYU
Definition SDL_pixels.h:312
SDL_PIXELFORMAT_UYVY
@ SDL_PIXELFORMAT_UYVY
Definition SDL_pixels.h:310
SDL_PIXELFORMAT_YUY2
@ SDL_PIXELFORMAT_YUY2
Definition SDL_pixels.h:308
SDL_ISPIXELFORMAT_FOURCC
#define SDL_ISPIXELFORMAT_FOURCC(format)
Definition SDL_pixels.h:171

Definition at line 131 of file SDL_pixels.h.

#define SDL_BYTESPERPIXEL(X) \
(SDL_ISPIXELFORMAT_FOURCC(X) ? \
((((X) == SDL_PIXELFORMAT_YUY2) || \
((X) == SDL_PIXELFORMAT_UYVY) || \
((X) == SDL_PIXELFORMAT_YVYU)) ? 2 : 1) : (((X) >> 0) & 0xFF))

## SDL_Colour

#define SDL_Colour SDL_Color

Definition at line 335 of file SDL_pixels.h.

## SDL_DEFINE_PIXELFORMAT

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

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

Definition at line 122 of file SDL_pixels.h.

#define SDL_DEFINE_PIXELFORMAT(type, order, layout, bits, bytes) \
((1 << 28) | ((type) << 24) | ((order) << 20) | ((layout) << 16) | \
((bits) << 8) | ((bytes) << 0))

## SDL_DEFINE_PIXELFOURCC

#define SDL_DEFINE_PIXELFOURCC | ( |  | A,
|  |  | B,
|  |  | C,
|  |  | D )

Value:
SDL_FOURCC(A, B, C, D)
SDL_FOURCC
#define SDL_FOURCC(A, B, C, D)
Definition SDL_stdinc.h:169

Definition at line 120 of file SDL_pixels.h.

## SDL_ISPIXELFORMAT_ALPHA

#define SDL_ISPIXELFORMAT_ALPHA | ( |  | format | ) |

Value:
((SDL_ISPIXELFORMAT_PACKED(format) && \
((SDL_PIXELORDER(format) == SDL_PACKEDORDER_ARGB) || \
(SDL_PIXELORDER(format) == SDL_PACKEDORDER_RGBA) || \
(SDL_PIXELORDER(format) == SDL_PACKEDORDER_ABGR) || \
(SDL_PIXELORDER(format) == SDL_PACKEDORDER_BGRA))) || \
(SDL_ISPIXELFORMAT_ARRAY(format) && \
((SDL_PIXELORDER(format) == SDL_ARRAYORDER_ARGB) || \
(SDL_PIXELORDER(format) == SDL_ARRAYORDER_RGBA) || \
(SDL_PIXELORDER(format) == SDL_ARRAYORDER_ABGR) || \
(SDL_PIXELORDER(format) == SDL_ARRAYORDER_BGRA))))
SDL_ISPIXELFORMAT_PACKED
#define SDL_ISPIXELFORMAT_PACKED(format)
Definition SDL_pixels.h:144
SDL_PIXELORDER
#define SDL_PIXELORDER(X)
Definition SDL_pixels.h:128
SDL_ARRAYORDER_ARGB
@ SDL_ARRAYORDER_ARGB
Definition SDL_pixels.h:100
SDL_ARRAYORDER_BGRA
@ SDL_ARRAYORDER_BGRA
Definition SDL_pixels.h:102
SDL_ARRAYORDER_ABGR
@ SDL_ARRAYORDER_ABGR
Definition SDL_pixels.h:103
SDL_ARRAYORDER_RGBA
@ SDL_ARRAYORDER_RGBA
Definition SDL_pixels.h:99
SDL_ISPIXELFORMAT_ARRAY
#define SDL_ISPIXELFORMAT_ARRAY(format)
Definition SDL_pixels.h:150
SDL_PACKEDORDER_RGBA
@ SDL_PACKEDORDER_RGBA
Definition SDL_pixels.h:85
SDL_PACKEDORDER_ABGR
@ SDL_PACKEDORDER_ABGR
Definition SDL_pixels.h:88
SDL_PACKEDORDER_BGRA
@ SDL_PACKEDORDER_BGRA
Definition SDL_pixels.h:89
SDL_PACKEDORDER_ARGB
@ SDL_PACKEDORDER_ARGB
Definition SDL_pixels.h:84

Definition at line 158 of file SDL_pixels.h.

#define SDL_ISPIXELFORMAT_ALPHA(format) \
((SDL_ISPIXELFORMAT_PACKED(format) && \
((SDL_PIXELORDER(format) == SDL_PACKEDORDER_ARGB) || \
(SDL_PIXELORDER(format) == SDL_PACKEDORDER_RGBA) || \
(SDL_PIXELORDER(format) == SDL_PACKEDORDER_ABGR) || \
(SDL_PIXELORDER(format) == SDL_PACKEDORDER_BGRA))) || \
(SDL_ISPIXELFORMAT_ARRAY(format) && \
((SDL_PIXELORDER(format) == SDL_ARRAYORDER_ARGB) || \
(SDL_PIXELORDER(format) == SDL_ARRAYORDER_RGBA) || \
(SDL_PIXELORDER(format) == SDL_ARRAYORDER_ABGR) || \
(SDL_PIXELORDER(format) == SDL_ARRAYORDER_BGRA))))

## SDL_ISPIXELFORMAT_ARRAY

#define SDL_ISPIXELFORMAT_ARRAY | ( |  | format | ) |

Value:
(!SDL_ISPIXELFORMAT_FOURCC(format) && \
((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU8) || \
(SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU16) || \
(SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU32) || \
(SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYF16) || \
(SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYF32)))
SDL_PIXELTYPE_ARRAYU16
@ SDL_PIXELTYPE_ARRAYU16
Definition SDL_pixels.h:61
SDL_PIXELTYPE_ARRAYU8
@ SDL_PIXELTYPE_ARRAYU8
Definition SDL_pixels.h:60
SDL_PIXELTYPE_ARRAYF16
@ SDL_PIXELTYPE_ARRAYF16
Definition SDL_pixels.h:63
SDL_PIXELTYPE_ARRAYU32
@ SDL_PIXELTYPE_ARRAYU32
Definition SDL_pixels.h:62
SDL_PIXELTYPE_ARRAYF32
@ SDL_PIXELTYPE_ARRAYF32
Definition SDL_pixels.h:64
SDL_PIXELTYPE
#define SDL_PIXELTYPE(X)
Definition SDL_pixels.h:127

Definition at line 150 of file SDL_pixels.h.

#define SDL_ISPIXELFORMAT_ARRAY(format) \
(!SDL_ISPIXELFORMAT_FOURCC(format) && \
((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU8) || \
(SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU16) || \
(SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU32) || \
(SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYF16) || \
(SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYF32)))

## SDL_ISPIXELFORMAT_FOURCC

#define SDL_ISPIXELFORMAT_FOURCC | ( |  | format | ) |

Value:
((format) && (SDL_PIXELFLAG(format) != 1))
SDL_PIXELFLAG
#define SDL_PIXELFLAG(X)
Definition SDL_pixels.h:126

Definition at line 171 of file SDL_pixels.h.

#define SDL_ISPIXELFORMAT_FOURCC(format) \
((format) && (SDL_PIXELFLAG(format) != 1))

## SDL_ISPIXELFORMAT_INDEXED

#define SDL_ISPIXELFORMAT_INDEXED | ( |  | format | ) |

Value:
(!SDL_ISPIXELFORMAT_FOURCC(format) && \
((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX1) || \
(SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX2) || \
(SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX4) || \
(SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX8)))
SDL_PIXELTYPE_INDEX2
@ SDL_PIXELTYPE_INDEX2
Definition SDL_pixels.h:67
SDL_PIXELTYPE_INDEX4
@ SDL_PIXELTYPE_INDEX4
Definition SDL_pixels.h:55
SDL_PIXELTYPE_INDEX1
@ SDL_PIXELTYPE_INDEX1
Definition SDL_pixels.h:54
SDL_PIXELTYPE_INDEX8
@ SDL_PIXELTYPE_INDEX8
Definition SDL_pixels.h:56

Definition at line 137 of file SDL_pixels.h.

#define SDL_ISPIXELFORMAT_INDEXED(format) \
(!SDL_ISPIXELFORMAT_FOURCC(format) && \
((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX1) || \
(SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX2) || \
(SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX4) || \
(SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX8)))

## SDL_ISPIXELFORMAT_PACKED

#define SDL_ISPIXELFORMAT_PACKED | ( |  | format | ) |

Value:
(!SDL_ISPIXELFORMAT_FOURCC(format) && \
((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED8) || \
(SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED16) || \
(SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED32)))
SDL_PIXELTYPE_PACKED32
@ SDL_PIXELTYPE_PACKED32
Definition SDL_pixels.h:59
SDL_PIXELTYPE_PACKED8
@ SDL_PIXELTYPE_PACKED8
Definition SDL_pixels.h:57
SDL_PIXELTYPE_PACKED16
@ SDL_PIXELTYPE_PACKED16
Definition SDL_pixels.h:58

Definition at line 144 of file SDL_pixels.h.

#define SDL_ISPIXELFORMAT_PACKED(format) \
(!SDL_ISPIXELFORMAT_FOURCC(format) && \
((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED8) || \
(SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED16) || \
(SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED32)))

## SDL_PIXELFLAG

#define SDL_PIXELFLAG | ( |  | X | ) |

Value:
(((X) >> 28) & 0x0F)

Definition at line 126 of file SDL_pixels.h.

## SDL_PIXELLAYOUT

#define SDL_PIXELLAYOUT | ( |  | X | ) |

Value:
(((X) >> 16) & 0x0F)

Definition at line 129 of file SDL_pixels.h.

## SDL_PIXELORDER

#define SDL_PIXELORDER | ( |  | X | ) |

Value:
(((X) >> 20) & 0x0F)

Definition at line 128 of file SDL_pixels.h.

## SDL_PIXELTYPE

#define SDL_PIXELTYPE | ( |  | X | ) |

Value:
(((X) >> 24) & 0x0F)

Definition at line 127 of file SDL_pixels.h.

## Enumeration Type Documentation

## SDL_ArrayOrder

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 95 of file SDL_pixels.h.

{
SDL_ARRAYORDER_NONE,
SDL_ARRAYORDER_RGB,
SDL_ARRAYORDER_RGBA,
SDL_ARRAYORDER_ARGB,
SDL_ARRAYORDER_BGR,
SDL_ARRAYORDER_BGRA,
SDL_ARRAYORDER_ABGR
} SDL_ArrayOrder;
SDL_ArrayOrder
SDL_ArrayOrder
Definition SDL_pixels.h:96
SDL_ARRAYORDER_RGB
@ SDL_ARRAYORDER_RGB
Definition SDL_pixels.h:98
SDL_ARRAYORDER_NONE
@ SDL_ARRAYORDER_NONE
Definition SDL_pixels.h:97
SDL_ARRAYORDER_BGR
@ SDL_ARRAYORDER_BGR
Definition SDL_pixels.h:101

## SDL_BitmapOrder

enum SDL_BitmapOrder

Bitmap pixel order, high bit -> low bit.

Enumerator
SDL_BITMAPORDER_NONE |
SDL_BITMAPORDER_4321 |
SDL_BITMAPORDER_1234 |

Definition at line 71 of file SDL_pixels.h.

{
SDL_BITMAPORDER_NONE,
SDL_BITMAPORDER_4321,
SDL_BITMAPORDER_1234
} SDL_BitmapOrder;
SDL_BitmapOrder
SDL_BitmapOrder
Definition SDL_pixels.h:72
SDL_BITMAPORDER_1234
@ SDL_BITMAPORDER_1234
Definition SDL_pixels.h:75
SDL_BITMAPORDER_NONE
@ SDL_BITMAPORDER_NONE
Definition SDL_pixels.h:73
SDL_BITMAPORDER_4321
@ SDL_BITMAPORDER_4321
Definition SDL_pixels.h:74

## SDL_PackedLayout

enum SDL_PackedLayout

Packed component layout.

Enumerator
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 |

Definition at line 107 of file SDL_pixels.h.

{
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
} SDL_PackedLayout;
SDL_PackedLayout
SDL_PackedLayout
Definition SDL_pixels.h:108
SDL_PACKEDLAYOUT_NONE
@ SDL_PACKEDLAYOUT_NONE
Definition SDL_pixels.h:109
SDL_PACKEDLAYOUT_8888
@ SDL_PACKEDLAYOUT_8888
Definition SDL_pixels.h:115
SDL_PACKEDLAYOUT_1010102
@ SDL_PACKEDLAYOUT_1010102
Definition SDL_pixels.h:117
SDL_PACKEDLAYOUT_565
@ SDL_PACKEDLAYOUT_565
Definition SDL_pixels.h:114
SDL_PACKEDLAYOUT_332
@ SDL_PACKEDLAYOUT_332
Definition SDL_pixels.h:110
SDL_PACKEDLAYOUT_5551
@ SDL_PACKEDLAYOUT_5551
Definition SDL_pixels.h:113
SDL_PACKEDLAYOUT_1555
@ SDL_PACKEDLAYOUT_1555
Definition SDL_pixels.h:112
SDL_PACKEDLAYOUT_4444
@ SDL_PACKEDLAYOUT_4444
Definition SDL_pixels.h:111
SDL_PACKEDLAYOUT_2101010
@ SDL_PACKEDLAYOUT_2101010
Definition SDL_pixels.h:116

## SDL_PackedOrder

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 79 of file SDL_pixels.h.

{
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
} SDL_PackedOrder;
SDL_PackedOrder
SDL_PackedOrder
Definition SDL_pixels.h:80
SDL_PACKEDORDER_NONE
@ SDL_PACKEDORDER_NONE
Definition SDL_pixels.h:81
SDL_PACKEDORDER_RGBX
@ SDL_PACKEDORDER_RGBX
Definition SDL_pixels.h:83
SDL_PACKEDORDER_BGRX
@ SDL_PACKEDORDER_BGRX
Definition SDL_pixels.h:87
SDL_PACKEDORDER_XBGR
@ SDL_PACKEDORDER_XBGR
Definition SDL_pixels.h:86
SDL_PACKEDORDER_XRGB
@ SDL_PACKEDORDER_XRGB
Definition SDL_pixels.h:82

## SDL_PixelFormatEnum

enum SDL_PixelFormatEnum

Enumerator
SDL_PIXELFORMAT_UNKNOWN |
SDL_PIXELFORMAT_INDEX1LSB |
SDL_PIXELFORMAT_INDEX1MSB |
SDL_PIXELFORMAT_INDEX2LSB |
SDL_PIXELFORMAT_INDEX2MSB |
SDL_PIXELFORMAT_INDEX4LSB |
SDL_PIXELFORMAT_INDEX4MSB |
SDL_PIXELFORMAT_INDEX8 |
SDL_PIXELFORMAT_RGB332 |
SDL_PIXELFORMAT_XRGB4444 |
SDL_PIXELFORMAT_RGB444 |
SDL_PIXELFORMAT_XBGR4444 |
SDL_PIXELFORMAT_BGR444 |
SDL_PIXELFORMAT_XRGB1555 |
SDL_PIXELFORMAT_RGB555 |
SDL_PIXELFORMAT_XBGR1555 |
SDL_PIXELFORMAT_BGR555 |
SDL_PIXELFORMAT_ARGB4444 |
SDL_PIXELFORMAT_RGBA4444 |
SDL_PIXELFORMAT_ABGR4444 |
SDL_PIXELFORMAT_BGRA4444 |
SDL_PIXELFORMAT_ARGB1555 |
SDL_PIXELFORMAT_RGBA5551 |
SDL_PIXELFORMAT_ABGR1555 |
SDL_PIXELFORMAT_BGRA5551 |
SDL_PIXELFORMAT_RGB565 |
SDL_PIXELFORMAT_BGR565 |
SDL_PIXELFORMAT_RGB24 |
SDL_PIXELFORMAT_BGR24 |
SDL_PIXELFORMAT_XRGB8888 |
SDL_PIXELFORMAT_RGB888 |
SDL_PIXELFORMAT_RGBX8888 |
SDL_PIXELFORMAT_XBGR8888 |
SDL_PIXELFORMAT_BGR888 |
SDL_PIXELFORMAT_BGRX8888 |
SDL_PIXELFORMAT_ARGB8888 |
SDL_PIXELFORMAT_RGBA8888 |
SDL_PIXELFORMAT_ABGR8888 |
SDL_PIXELFORMAT_BGRA8888 |
SDL_PIXELFORMAT_ARGB2101010 |
SDL_PIXELFORMAT_RGBA32 |
SDL_PIXELFORMAT_ARGB32 |
SDL_PIXELFORMAT_BGRA32 |
SDL_PIXELFORMAT_ABGR32 |
SDL_PIXELFORMAT_RGBX32 |
SDL_PIXELFORMAT_XRGB32 |
SDL_PIXELFORMAT_BGRX32 |
SDL_PIXELFORMAT_XBGR32 |
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)
SDL_PIXELFORMAT_NV12 | Planar mode: Y + U/V interleaved (2 planes)
SDL_PIXELFORMAT_NV21 | Planar mode: Y + V/U interleaved (2 planes)
SDL_PIXELFORMAT_EXTERNAL_OES | Android video texture format

Definition at line 175 of file SDL_pixels.h.

{
SDL_PIXELFORMAT_UNKNOWN,
SDL_PIXELFORMAT_INDEX1LSB =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX1, SDL_BITMAPORDER_4321, 0,
1, 0),
SDL_PIXELFORMAT_INDEX1MSB =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX1, SDL_BITMAPORDER_1234, 0,
1, 0),
SDL_PIXELFORMAT_INDEX2LSB =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX2, SDL_BITMAPORDER_4321, 0,
2, 0),
SDL_PIXELFORMAT_INDEX2MSB =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX2, SDL_BITMAPORDER_1234, 0,
2, 0),
SDL_PIXELFORMAT_INDEX4LSB =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX4, SDL_BITMAPORDER_4321, 0,
4, 0),
SDL_PIXELFORMAT_INDEX4MSB =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX4, SDL_BITMAPORDER_1234, 0,
4, 0),
SDL_PIXELFORMAT_INDEX8 =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX8, 0, 0, 8, 1),
SDL_PIXELFORMAT_RGB332 =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED8, SDL_PACKEDORDER_XRGB,
SDL_PACKEDLAYOUT_332, 8, 1),
SDL_PIXELFORMAT_XRGB4444 =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB,
SDL_PACKEDLAYOUT_4444, 12, 2),
SDL_PIXELFORMAT_RGB444 = SDL_PIXELFORMAT_XRGB4444,
SDL_PIXELFORMAT_XBGR4444 =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XBGR,
SDL_PACKEDLAYOUT_4444, 12, 2),
SDL_PIXELFORMAT_BGR444 = SDL_PIXELFORMAT_XBGR4444,
SDL_PIXELFORMAT_XRGB1555 =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB,
SDL_PACKEDLAYOUT_1555, 15, 2),
SDL_PIXELFORMAT_RGB555 = SDL_PIXELFORMAT_XRGB1555,
SDL_PIXELFORMAT_XBGR1555 =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XBGR,
SDL_PACKEDLAYOUT_1555, 15, 2),
SDL_PIXELFORMAT_BGR555 = SDL_PIXELFORMAT_XBGR1555,
SDL_PIXELFORMAT_ARGB4444 =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ARGB,
SDL_PACKEDLAYOUT_4444, 16, 2),
SDL_PIXELFORMAT_RGBA4444 =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_RGBA,
SDL_PACKEDLAYOUT_4444, 16, 2),
SDL_PIXELFORMAT_ABGR4444 =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ABGR,
SDL_PACKEDLAYOUT_4444, 16, 2),
SDL_PIXELFORMAT_BGRA4444 =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_BGRA,
SDL_PACKEDLAYOUT_4444, 16, 2),
SDL_PIXELFORMAT_ARGB1555 =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ARGB,
SDL_PACKEDLAYOUT_1555, 16, 2),
SDL_PIXELFORMAT_RGBA5551 =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_RGBA,
SDL_PACKEDLAYOUT_5551, 16, 2),
SDL_PIXELFORMAT_ABGR1555 =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ABGR,
SDL_PACKEDLAYOUT_1555, 16, 2),
SDL_PIXELFORMAT_BGRA5551 =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_BGRA,
SDL_PACKEDLAYOUT_5551, 16, 2),
SDL_PIXELFORMAT_RGB565 =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB,
SDL_PACKEDLAYOUT_565, 16, 2),
SDL_PIXELFORMAT_BGR565 =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XBGR,
SDL_PACKEDLAYOUT_565, 16, 2),
SDL_PIXELFORMAT_RGB24 =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_ARRAYU8, SDL_ARRAYORDER_RGB, 0,
24, 3),
SDL_PIXELFORMAT_BGR24 =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_ARRAYU8, SDL_ARRAYORDER_BGR, 0,
24, 3),
SDL_PIXELFORMAT_XRGB8888 =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_XRGB,
SDL_PACKEDLAYOUT_8888, 24, 4),
SDL_PIXELFORMAT_RGB888 = SDL_PIXELFORMAT_XRGB8888,
SDL_PIXELFORMAT_RGBX8888 =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_RGBX,
SDL_PACKEDLAYOUT_8888, 24, 4),
SDL_PIXELFORMAT_XBGR8888 =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_XBGR,
SDL_PACKEDLAYOUT_8888, 24, 4),
SDL_PIXELFORMAT_BGR888 = SDL_PIXELFORMAT_XBGR8888,
SDL_PIXELFORMAT_BGRX8888 =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_BGRX,
SDL_PACKEDLAYOUT_8888, 24, 4),
SDL_PIXELFORMAT_ARGB8888 =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ARGB,
SDL_PACKEDLAYOUT_8888, 32, 4),
SDL_PIXELFORMAT_RGBA8888 =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_RGBA,
SDL_PACKEDLAYOUT_8888, 32, 4),
SDL_PIXELFORMAT_ABGR8888 =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ABGR,
SDL_PACKEDLAYOUT_8888, 32, 4),
SDL_PIXELFORMAT_BGRA8888 =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_BGRA,
SDL_PACKEDLAYOUT_8888, 32, 4),
SDL_PIXELFORMAT_ARGB2101010 =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ARGB,
SDL_PACKEDLAYOUT_2101010, 32, 4),
/* Aliases for RGBA byte arrays of color data, for the current platform */
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
SDL_PIXELFORMAT_RGBA32 = SDL_PIXELFORMAT_RGBA8888,
SDL_PIXELFORMAT_ARGB32 = SDL_PIXELFORMAT_ARGB8888,
SDL_PIXELFORMAT_BGRA32 = SDL_PIXELFORMAT_BGRA8888,
SDL_PIXELFORMAT_ABGR32 = SDL_PIXELFORMAT_ABGR8888,
SDL_PIXELFORMAT_RGBX32 = SDL_PIXELFORMAT_RGBX8888,
SDL_PIXELFORMAT_XRGB32 = SDL_PIXELFORMAT_XRGB8888,
SDL_PIXELFORMAT_BGRX32 = SDL_PIXELFORMAT_BGRX8888,
SDL_PIXELFORMAT_XBGR32 = SDL_PIXELFORMAT_XBGR8888,
#else
SDL_PIXELFORMAT_RGBA32 = SDL_PIXELFORMAT_ABGR8888,
SDL_PIXELFORMAT_ARGB32 = SDL_PIXELFORMAT_BGRA8888,
SDL_PIXELFORMAT_BGRA32 = SDL_PIXELFORMAT_ARGB8888,
SDL_PIXELFORMAT_ABGR32 = SDL_PIXELFORMAT_RGBA8888,
SDL_PIXELFORMAT_RGBX32 = SDL_PIXELFORMAT_XBGR8888,
SDL_PIXELFORMAT_XRGB32 = SDL_PIXELFORMAT_BGRX8888,
SDL_PIXELFORMAT_BGRX32 = SDL_PIXELFORMAT_XRGB8888,
SDL_PIXELFORMAT_XBGR32 = SDL_PIXELFORMAT_RGBX8888,
#endif
SDL_PIXELFORMAT_YV12 = /**< Planar mode: Y + V + U (3 planes) */
SDL_DEFINE_PIXELFOURCC('Y', 'V', '1', '2'),
SDL_PIXELFORMAT_IYUV = /**< Planar mode: Y + U + V (3 planes) */
SDL_DEFINE_PIXELFOURCC('I', 'Y', 'U', 'V'),
SDL_PIXELFORMAT_YUY2 = /**< Packed mode: Y0+U0+Y1+V0 (1 plane) */
SDL_DEFINE_PIXELFOURCC('Y', 'U', 'Y', '2'),
SDL_PIXELFORMAT_UYVY = /**< Packed mode: U0+Y0+V0+Y1 (1 plane) */
SDL_DEFINE_PIXELFOURCC('U', 'Y', 'V', 'Y'),
SDL_PIXELFORMAT_YVYU = /**< Packed mode: Y0+V0+Y1+U0 (1 plane) */
SDL_DEFINE_PIXELFOURCC('Y', 'V', 'Y', 'U'),
SDL_PIXELFORMAT_NV12 = /**< Planar mode: Y + U/V interleaved (2 planes) */
SDL_DEFINE_PIXELFOURCC('N', 'V', '1', '2'),
SDL_PIXELFORMAT_NV21 = /**< Planar mode: Y + V/U interleaved (2 planes) */
SDL_DEFINE_PIXELFOURCC('N', 'V', '2', '1'),
SDL_PIXELFORMAT_EXTERNAL_OES = /**< Android video texture format */
SDL_DEFINE_PIXELFOURCC('O', 'E', 'S', ' ')
} SDL_PixelFormatEnum;
SDL_DEFINE_PIXELFOURCC
#define SDL_DEFINE_PIXELFOURCC(A, B, C, D)
Definition SDL_pixels.h:120
SDL_PixelFormatEnum
SDL_PixelFormatEnum
Definition SDL_pixels.h:176
SDL_PIXELFORMAT_BGR565
@ SDL_PIXELFORMAT_BGR565
Definition SDL_pixels.h:244
SDL_PIXELFORMAT_EXTERNAL_OES
@ SDL_PIXELFORMAT_EXTERNAL_OES
Definition SDL_pixels.h:318
SDL_PIXELFORMAT_RGB332
@ SDL_PIXELFORMAT_RGB332
Definition SDL_pixels.h:198
SDL_PIXELFORMAT_INDEX2LSB
@ SDL_PIXELFORMAT_INDEX2LSB
Definition SDL_pixels.h:184
SDL_PIXELFORMAT_INDEX1LSB
@ SDL_PIXELFORMAT_INDEX1LSB
Definition SDL_pixels.h:178
SDL_PIXELFORMAT_BGR444
@ SDL_PIXELFORMAT_BGR444
Definition SDL_pixels.h:208
SDL_PIXELFORMAT_RGBX32
@ SDL_PIXELFORMAT_RGBX32
Definition SDL_pixels.h:289
SDL_PIXELFORMAT_ABGR4444
@ SDL_PIXELFORMAT_ABGR4444
Definition SDL_pixels.h:223
SDL_PIXELFORMAT_BGRA4444
@ SDL_PIXELFORMAT_BGRA4444
Definition SDL_pixels.h:226
SDL_PIXELFORMAT_BGR24
@ SDL_PIXELFORMAT_BGR24
Definition SDL_pixels.h:250
SDL_PIXELFORMAT_INDEX4MSB
@ SDL_PIXELFORMAT_INDEX4MSB
Definition SDL_pixels.h:193
SDL_PIXELFORMAT_BGRA32
@ SDL_PIXELFORMAT_BGRA32
Definition SDL_pixels.h:287
SDL_PIXELFORMAT_RGB555
@ SDL_PIXELFORMAT_RGB555
Definition SDL_pixels.h:212
SDL_PIXELFORMAT_RGB444
@ SDL_PIXELFORMAT_RGB444
Definition SDL_pixels.h:204
SDL_PIXELFORMAT_INDEX2MSB
@ SDL_PIXELFORMAT_INDEX2MSB
Definition SDL_pixels.h:187
SDL_PIXELFORMAT_RGBA8888
@ SDL_PIXELFORMAT_RGBA8888
Definition SDL_pixels.h:270
SDL_PIXELFORMAT_RGBA5551
@ SDL_PIXELFORMAT_RGBA5551
Definition SDL_pixels.h:232
SDL_PIXELFORMAT_ARGB1555
@ SDL_PIXELFORMAT_ARGB1555
Definition SDL_pixels.h:229
SDL_PIXELFORMAT_XBGR4444
@ SDL_PIXELFORMAT_XBGR4444
Definition SDL_pixels.h:205
SDL_PIXELFORMAT_INDEX8
@ SDL_PIXELFORMAT_INDEX8
Definition SDL_pixels.h:196
SDL_PIXELFORMAT_XRGB8888
@ SDL_PIXELFORMAT_XRGB8888
Definition SDL_pixels.h:253
SDL_PIXELFORMAT_BGRX32
@ SDL_PIXELFORMAT_BGRX32
Definition SDL_pixels.h:291
SDL_PIXELFORMAT_BGR888
@ SDL_PIXELFORMAT_BGR888
Definition SDL_pixels.h:263
SDL_PIXELFORMAT_YV12
@ SDL_PIXELFORMAT_YV12
Definition SDL_pixels.h:304
SDL_PIXELFORMAT_ABGR32
@ SDL_PIXELFORMAT_ABGR32
Definition SDL_pixels.h:288
SDL_PIXELFORMAT_BGRX8888
@ SDL_PIXELFORMAT_BGRX8888
Definition SDL_pixels.h:264
SDL_PIXELFORMAT_RGB24
@ SDL_PIXELFORMAT_RGB24
Definition SDL_pixels.h:247
SDL_PIXELFORMAT_RGB888
@ SDL_PIXELFORMAT_RGB888
Definition SDL_pixels.h:256
SDL_PIXELFORMAT_ABGR8888
@ SDL_PIXELFORMAT_ABGR8888
Definition SDL_pixels.h:273
SDL_PIXELFORMAT_XBGR32
@ SDL_PIXELFORMAT_XBGR32
Definition SDL_pixels.h:292
SDL_PIXELFORMAT_NV12
@ SDL_PIXELFORMAT_NV12
Definition SDL_pixels.h:314
SDL_PIXELFORMAT_BGRA8888
@ SDL_PIXELFORMAT_BGRA8888
Definition SDL_pixels.h:276
SDL_PIXELFORMAT_ARGB32
@ SDL_PIXELFORMAT_ARGB32
Definition SDL_pixels.h:286
SDL_PIXELFORMAT_ABGR1555
@ SDL_PIXELFORMAT_ABGR1555
Definition SDL_pixels.h:235
SDL_PIXELFORMAT_NV21
@ SDL_PIXELFORMAT_NV21
Definition SDL_pixels.h:316
SDL_PIXELFORMAT_IYUV
@ SDL_PIXELFORMAT_IYUV
Definition SDL_pixels.h:306
SDL_PIXELFORMAT_ARGB8888
@ SDL_PIXELFORMAT_ARGB8888
Definition SDL_pixels.h:267
SDL_PIXELFORMAT_XRGB32
@ SDL_PIXELFORMAT_XRGB32
Definition SDL_pixels.h:290
SDL_PIXELFORMAT_XBGR1555
@ SDL_PIXELFORMAT_XBGR1555
Definition SDL_pixels.h:213
SDL_PIXELFORMAT_XRGB4444
@ SDL_PIXELFORMAT_XRGB4444
Definition SDL_pixels.h:201
SDL_PIXELFORMAT_ARGB4444
@ SDL_PIXELFORMAT_ARGB4444
Definition SDL_pixels.h:217
SDL_PIXELFORMAT_RGBA32
@ SDL_PIXELFORMAT_RGBA32
Definition SDL_pixels.h:285
SDL_PIXELFORMAT_INDEX1MSB
@ SDL_PIXELFORMAT_INDEX1MSB
Definition SDL_pixels.h:181
SDL_PIXELFORMAT_INDEX4LSB
@ SDL_PIXELFORMAT_INDEX4LSB
Definition SDL_pixels.h:190
SDL_PIXELFORMAT_RGBX8888
@ SDL_PIXELFORMAT_RGBX8888
Definition SDL_pixels.h:257
SDL_PIXELFORMAT_BGRA5551
@ SDL_PIXELFORMAT_BGRA5551
Definition SDL_pixels.h:238
SDL_PIXELFORMAT_XRGB1555
@ SDL_PIXELFORMAT_XRGB1555
Definition SDL_pixels.h:209
SDL_PIXELFORMAT_RGB565
@ SDL_PIXELFORMAT_RGB565
Definition SDL_pixels.h:241
SDL_PIXELFORMAT_XBGR8888
@ SDL_PIXELFORMAT_XBGR8888
Definition SDL_pixels.h:260
SDL_PIXELFORMAT_ARGB2101010
@ SDL_PIXELFORMAT_ARGB2101010
Definition SDL_pixels.h:279
SDL_PIXELFORMAT_BGR555
@ SDL_PIXELFORMAT_BGR555
Definition SDL_pixels.h:216
SDL_PIXELFORMAT_UNKNOWN
@ SDL_PIXELFORMAT_UNKNOWN
Definition SDL_pixels.h:177
SDL_PIXELFORMAT_RGBA4444
@ SDL_PIXELFORMAT_RGBA4444
Definition SDL_pixels.h:220
SDL_DEFINE_PIXELFORMAT
#define SDL_DEFINE_PIXELFORMAT(type, order, layout, bits, bytes)
Definition SDL_pixels.h:122

## SDL_PixelType

enum SDL_PixelType

Pixel type.

Enumerator
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 |
SDL_PIXELTYPE_INDEX2 |

Definition at line 51 of file SDL_pixels.h.

{
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,
/* This must be at the end of the list to avoid breaking the existing ABI */
SDL_PIXELTYPE_INDEX2
} SDL_PixelType;
SDL_PixelType
SDL_PixelType
Definition SDL_pixels.h:52
SDL_PIXELTYPE_UNKNOWN
@ SDL_PIXELTYPE_UNKNOWN
Definition SDL_pixels.h:53

## Function Documentation

## SDL_AllocFormat()

SDL_PixelFormat * SDL_AllocFormat | ( | Uint32 | pixel_format | ) |

extern

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.

Parameters

  pixel_format | one of the SDL_PixelFormatEnum values.

Returns
  the new SDL_PixelFormat structure or NULL on failure; call SDL_GetError() for more information.

Since
  This function is available since SDL 2.0.0.

See also
  SDL_FreeFormat

## SDL_AllocPalette()

SDL_Palette * SDL_AllocPalette | ( | int | ncolors | ) |

extern

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

The palette entries are initialized to white.

Parameters

  ncolors | represents the number of color entries in the color palette.

Returns
  a new SDL_Palette structure on success or NULL on failure (e.g. if there wasn't enough memory); call SDL_GetError() for more information.

Since
  This function is available since SDL 2.0.0.

See also
  SDL_FreePalette

## SDL_CalculateGammaRamp()

void SDL_CalculateGammaRamp | ( | float | gamma,
|  | Uint16 * | ramp )

extern

Calculate a 256 entry gamma ramp for a gamma value.

Parameters

  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.

Since
  This function is available since SDL 2.0.0.

See also
  SDL_SetWindowGammaRamp

## SDL_FreeFormat()

void SDL_FreeFormat | ( | SDL_PixelFormat * | format | ) |

extern

Free an SDL_PixelFormat structure allocated by SDL_AllocFormat().

Parameters

  format | the SDL_PixelFormat structure to free.

Since
  This function is available since SDL 2.0.0.

See also
  SDL_AllocFormat

## SDL_FreePalette()

void SDL_FreePalette | ( | SDL_Palette * | palette | ) |

extern

Free a palette created with SDL_AllocPalette().

Parameters

  palette | the SDL_Palette structure to be freed.

Since
  This function is available since SDL 2.0.0.

See also
  SDL_AllocPalette

## SDL_GetPixelFormatName()

const char * SDL_GetPixelFormatName | ( | Uint32 | format | ) |

extern

Get the human readable name of a pixel format.

Parameters

  format | the pixel format to query.

Returns
  the human readable name of the specified pixel format or SDL_PIXELFORMAT_UNKNOWN if the format isn't recognized.

Since
  This function is available since SDL 2.0.0.

## SDL_GetRGB()

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

extern

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]).

Parameters

  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.

Since
  This function is available since SDL 2.0.0.

See also
  SDL_GetRGBA
  SDL_MapRGB
  SDL_MapRGBA

## SDL_GetRGBA()

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

extern

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).

Parameters

  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.

Since
  This function is available since SDL 2.0.0.

See also
  SDL_GetRGB
  SDL_MapRGB
  SDL_MapRGBA

## SDL_MapRGB()

Uint32 SDL_MapRGB | ( | const SDL_PixelFormat * | format,
|  | Uint8 | r,
|  | Uint8 | g,
|  | Uint8 | b )

extern

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).

Parameters

  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.

Returns
  a pixel value.

Since
  This function is available since SDL 2.0.0.

See also
  SDL_GetRGB
  SDL_GetRGBA
  SDL_MapRGBA

## SDL_MapRGBA()

Uint32 SDL_MapRGBA | ( | const SDL_PixelFormat * | format,
|  | Uint8 | r,
|  | Uint8 | g,
|  | Uint8 | b,
|  | Uint8 | a )

extern

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).

Parameters

  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.

Returns
  a pixel value.

Since
  This function is available since SDL 2.0.0.

See also
  SDL_GetRGB
  SDL_GetRGBA
  SDL_MapRGB

## SDL_MasksToPixelFormatEnum()

Uint32 SDL_MasksToPixelFormatEnum | ( | int | bpp,
|  | Uint32 | Rmask,
|  | Uint32 | Gmask,
|  | Uint32 | Bmask,
|  | Uint32 | Amask )

extern

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

This will return SDL_PIXELFORMAT_UNKNOWN if the conversion wasn't possible.

Parameters

  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.

Returns
  one of the SDL_PixelFormatEnum values.

Since
  This function is available since SDL 2.0.0.

See also
  SDL_PixelFormatEnumToMasks

## SDL_PixelFormatEnumToMasks()

SDL_bool SDL_PixelFormatEnumToMasks | ( | Uint32 | format,
|  | int * | bpp,
|  | Uint32 * | Rmask,
|  | Uint32 * | Gmask,
|  | Uint32 * | Bmask,
|  | Uint32 * | Amask )

extern

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

Parameters

  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.

Returns
  SDL_TRUE on success or SDL_FALSE if the conversion wasn't possible; call SDL_GetError() for more information.

Since
  This function is available since SDL 2.0.0.

See also
  SDL_MasksToPixelFormatEnum

## SDL_SetPaletteColors()

int SDL_SetPaletteColors | ( | SDL_Palette * | palette,
|  | const SDL_Color * | colors,
|  | int | firstcolor,
|  | int | ncolors )

extern

Set a range of colors in a palette.

Parameters

  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.

Returns
  0 on success or a negative error code if not all of the colors could be set; call SDL_GetError() for more information.

Since
  This function is available since SDL 2.0.0.

See also
  SDL_AllocPalette
  SDL_CreateRGBSurface

## SDL_SetPixelFormatPalette()

int SDL_SetPixelFormatPalette | ( | SDL_PixelFormat * | format,
|  | SDL_Palette * | palette )

extern

Set the palette for a pixel format structure.

Parameters

  format | the SDL_PixelFormat structure that will use the palette.
  palette | the SDL_Palette structure that will be used.

Returns
  0 on success or a negative error code on failure; call SDL_GetError() for more information.

Since
  This function is available since SDL 2.0.0.

See also
  SDL_AllocPalette
  SDL_FreePalette