comparison src/video/SDL_pixels.c @ 4982:660d3a432102

Added some missing pixel formats and SDL_GetPixelFormatName()
author Sam Lantinga <slouken@libsdl.org>
date Wed, 12 Jan 2011 14:53:23 -0800
parents f7b03b6838cb
children b49d3869ebd2
comparison
equal deleted inserted replaced
4981:55b82067815b 4982:660d3a432102
36 void *userdata; 36 void *userdata;
37 struct SDL_PaletteWatch *next; 37 struct SDL_PaletteWatch *next;
38 }; 38 };
39 39
40 /* Helper functions */ 40 /* Helper functions */
41
42 const char*
43 SDL_GetPixelFormatName(Uint32 format)
44 {
45 switch (format) {
46 #define CASE(X) case X: return #X;
47 CASE(SDL_PIXELFORMAT_INDEX1LSB)
48 CASE(SDL_PIXELFORMAT_INDEX1MSB)
49 CASE(SDL_PIXELFORMAT_INDEX4LSB)
50 CASE(SDL_PIXELFORMAT_INDEX4MSB)
51 CASE(SDL_PIXELFORMAT_INDEX8)
52 CASE(SDL_PIXELFORMAT_RGB332)
53 CASE(SDL_PIXELFORMAT_RGB444)
54 CASE(SDL_PIXELFORMAT_RGB555)
55 CASE(SDL_PIXELFORMAT_BGR555)
56 CASE(SDL_PIXELFORMAT_ARGB4444)
57 CASE(SDL_PIXELFORMAT_RGBA4444)
58 CASE(SDL_PIXELFORMAT_ABGR4444)
59 CASE(SDL_PIXELFORMAT_BGRA4444)
60 CASE(SDL_PIXELFORMAT_ARGB1555)
61 CASE(SDL_PIXELFORMAT_RGBA5551)
62 CASE(SDL_PIXELFORMAT_ABGR1555)
63 CASE(SDL_PIXELFORMAT_BGRA5551)
64 CASE(SDL_PIXELFORMAT_RGB565)
65 CASE(SDL_PIXELFORMAT_BGR565)
66 CASE(SDL_PIXELFORMAT_RGB24)
67 CASE(SDL_PIXELFORMAT_BGR24)
68 CASE(SDL_PIXELFORMAT_RGB888)
69 CASE(SDL_PIXELFORMAT_BGR888)
70 CASE(SDL_PIXELFORMAT_ARGB8888)
71 CASE(SDL_PIXELFORMAT_RGBA8888)
72 CASE(SDL_PIXELFORMAT_ABGR8888)
73 CASE(SDL_PIXELFORMAT_BGRA8888)
74 CASE(SDL_PIXELFORMAT_ARGB2101010)
75 CASE(SDL_PIXELFORMAT_YV12)
76 CASE(SDL_PIXELFORMAT_IYUV)
77 CASE(SDL_PIXELFORMAT_YUY2)
78 CASE(SDL_PIXELFORMAT_UYVY)
79 CASE(SDL_PIXELFORMAT_YVYU)
80 #undef CASE
81 default:
82 return "SDL_PIXELFORMAT_UNKNOWN";
83 }
84 }
41 85
42 SDL_bool 86 SDL_bool
43 SDL_PixelFormatEnumToMasks(Uint32 format, int *bpp, Uint32 * Rmask, 87 SDL_PixelFormatEnumToMasks(Uint32 format, int *bpp, Uint32 * Rmask,
44 Uint32 * Gmask, Uint32 * Bmask, Uint32 * Amask) 88 Uint32 * Gmask, Uint32 * Bmask, Uint32 * Amask)
45 { 89 {