123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321 |
- #ifndef _SDL_pixels_h
- #define _SDL_pixels_h
- #include "begin_code.h"
- #ifdef __cplusplus
- extern "C" {
- #endif
- #define SDL_ALPHA_OPAQUE 255
- #define SDL_ALPHA_TRANSPARENT 0
- 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
- };
- #define SDL_DEFINE_PIXELFOURCC(A, B, C, D) SDL_FOURCC(A, B, C, D)
- #define SDL_DEFINE_PIXELFORMAT(type, order, layout, bits, bytes) \
- ((1 << 28) | ((type) << 24) | ((order) << 20) | ((layout) << 16) | \
- ((bits) << 8) | ((bytes) << 0))
- #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) \
- (SDL_ISPIXELFORMAT_FOURCC(X) ? \
- ((((X) == SDL_PIXELFORMAT_YUY2) || \
- ((X) == SDL_PIXELFORMAT_UYVY) || \
- ((X) == SDL_PIXELFORMAT_YVYU)) ? 2 : 1) : (((X) >> 0) & 0xFF))
- #define SDL_ISPIXELFORMAT_INDEXED(format) \
- (!SDL_ISPIXELFORMAT_FOURCC(format) && \
- ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX1) || \
- (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX4) || \
- (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX8)))
- #define SDL_ISPIXELFORMAT_ALPHA(format) \
- (!SDL_ISPIXELFORMAT_FOURCC(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)))
- #define SDL_ISPIXELFORMAT_FOURCC(format) \
- ((format) && (SDL_PIXELFLAG(format) != 1))
- enum
- {
- 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_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_RGB444 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB,
- SDL_PACKEDLAYOUT_4444, 12, 2),
- SDL_PIXELFORMAT_RGB555 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB,
- SDL_PACKEDLAYOUT_1555, 15, 2),
- SDL_PIXELFORMAT_BGR555 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XBGR,
- SDL_PACKEDLAYOUT_1555, 15, 2),
- 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_RGB888 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_XRGB,
- SDL_PACKEDLAYOUT_8888, 24, 4),
- SDL_PIXELFORMAT_RGBX8888 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_RGBX,
- SDL_PACKEDLAYOUT_8888, 24, 4),
- SDL_PIXELFORMAT_BGR888 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_XBGR,
- SDL_PACKEDLAYOUT_8888, 24, 4),
- 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),
- SDL_PIXELFORMAT_YV12 =
- SDL_DEFINE_PIXELFOURCC('Y', 'V', '1', '2'),
- SDL_PIXELFORMAT_IYUV =
- SDL_DEFINE_PIXELFOURCC('I', 'Y', 'U', 'V'),
- SDL_PIXELFORMAT_YUY2 =
- SDL_DEFINE_PIXELFOURCC('Y', 'U', 'Y', '2'),
- SDL_PIXELFORMAT_UYVY =
- SDL_DEFINE_PIXELFOURCC('U', 'Y', 'V', 'Y'),
- SDL_PIXELFORMAT_YVYU =
- SDL_DEFINE_PIXELFOURCC('Y', 'V', 'Y', 'U')
- };
- typedef struct SDL_Color
- {
- Uint8 r;
- Uint8 g;
- Uint8 b;
- Uint8 a;
- } SDL_Color;
- #define SDL_Colour SDL_Color
- typedef struct SDL_Palette
- {
- int ncolors;
- SDL_Color *colors;
- Uint32 version;
- int refcount;
- } SDL_Palette;
- typedef struct SDL_PixelFormat
- {
- Uint32 format;
- SDL_Palette *palette;
- Uint8 BitsPerPixel;
- Uint8 BytesPerPixel;
- Uint8 padding[2];
- Uint32 Rmask;
- Uint32 Gmask;
- Uint32 Bmask;
- Uint32 Amask;
- Uint8 Rloss;
- Uint8 Gloss;
- Uint8 Bloss;
- Uint8 Aloss;
- Uint8 Rshift;
- Uint8 Gshift;
- Uint8 Bshift;
- Uint8 Ashift;
- int refcount;
- struct SDL_PixelFormat *next;
- } SDL_PixelFormat;
- extern DECLSPEC const char* SDLCALL SDL_GetPixelFormatName(Uint32 format);
- typedef SDL_bool SDLCALL tSDL_PixelFormatEnumToMasks(Uint32 format,
- int *bpp,
- Uint32 * Rmask,
- Uint32 * Gmask,
- Uint32 * Bmask,
- Uint32 * Amask);
- typedef Uint32 SDLCALL tSDL_MasksToPixelFormatEnum(int bpp,
- Uint32 Rmask,
- Uint32 Gmask,
- Uint32 Bmask,
- Uint32 Amask);
- typedef SDL_PixelFormat * SDLCALL tSDL_AllocFormat(Uint32 pixel_format);
- typedef void SDLCALL tSDL_FreeFormat(SDL_PixelFormat *format);
- typedef SDL_Palette * SDLCALL tSDL_AllocPalette(int ncolors);
- typedef int SDLCALL tSDL_SetPixelFormatPalette(SDL_PixelFormat * format,
- SDL_Palette *palette);
- typedef int SDLCALL tSDL_SetPaletteColors(SDL_Palette * palette,
- const SDL_Color * colors,
- int firstcolor, int ncolors);
- typedef void SDLCALL tSDL_FreePalette(SDL_Palette * palette);
- typedef Uint32 SDLCALL tSDL_MapRGB(const SDL_PixelFormat * format,
- Uint8 r, Uint8 g, Uint8 b);
- typedef Uint32 SDLCALL tSDL_MapRGBA(const SDL_PixelFormat * format,
- Uint8 r, Uint8 g, Uint8 b,
- Uint8 a);
- typedef void SDLCALL tSDL_GetRGB(Uint32 pixel,
- const SDL_PixelFormat * format,
- Uint8 * r, Uint8 * g, Uint8 * b);
- typedef void SDLCALL tSDL_GetRGBA(Uint32 pixel,
- const SDL_PixelFormat * format,
- Uint8 * r, Uint8 * g, Uint8 * b,
- Uint8 * a);
- typedef void SDLCALL tSDL_CalculateGammaRamp(float gamma, Uint16 * ramp);
- extern tSDL_PixelFormatEnumToMasks *SDL_PixelFormatEnumToMasks;
- extern tSDL_MasksToPixelFormatEnum *SDL_MasksToPixelFormatEnum;
- extern tSDL_AllocFormat *SDL_AllocFormat;
- extern tSDL_FreeFormat *SDL_FreeFormat;
- extern tSDL_AllocPalette *SDL_AllocPalette;
- extern tSDL_SetPixelFormatPalette *SDL_SetPixelFormatPalette;
- extern tSDL_SetPaletteColors *SDL_SetPaletteColors;
- extern tSDL_FreePalette *SDL_FreePalette;
- extern tSDL_MapRGB *SDL_MapRGB;
- extern tSDL_MapRGBA *SDL_MapRGBA;
- extern tSDL_GetRGB *SDL_GetRGB;
- extern tSDL_GetRGBA *SDL_GetRGBA;
- extern tSDL_CalculateGammaRamp *SDL_CalculateGammaRamp;
- #ifdef __cplusplus
- }
- #endif
- #include "close_code.h"
- #endif
|