include/SDL_pixels.h
branchSDL-1.3
changeset 1668 4da1ee79c9af
parent 1662 782fd950bd46
child 1675 d33dcfc3fde7
equal deleted inserted replaced
1667:1fddae038bc8 1668:4da1ee79c9af
   107 
   107 
   108 enum
   108 enum
   109 {
   109 {
   110     SDL_PixelFormat_Unknown,
   110     SDL_PixelFormat_Unknown,
   111     SDL_PixelFormat_Index1LSB =
   111     SDL_PixelFormat_Index1LSB =
   112         SDL_DEFINE_PIXELFORMAT (SDL_PixelType_Index1, SDL_BitmapOrder_1234, 0,
   112         SDL_DEFINE_PIXELFORMAT(SDL_PixelType_Index1, SDL_BitmapOrder_1234, 0,
   113                                 1, 0),
   113                                1, 0),
   114     SDL_PixelFormat_Index1MSB =
   114     SDL_PixelFormat_Index1MSB =
   115         SDL_DEFINE_PIXELFORMAT (SDL_PixelType_Index1, SDL_BitmapOrder_4321, 0,
   115         SDL_DEFINE_PIXELFORMAT(SDL_PixelType_Index1, SDL_BitmapOrder_4321, 0,
   116                                 1, 0),
   116                                1, 0),
   117     SDL_PixelFormat_Index4LSB =
   117     SDL_PixelFormat_Index4LSB =
   118         SDL_DEFINE_PIXELFORMAT (SDL_PixelType_Index4, SDL_BitmapOrder_1234, 0,
   118         SDL_DEFINE_PIXELFORMAT(SDL_PixelType_Index4, SDL_BitmapOrder_1234, 0,
   119                                 2, 0),
   119                                2, 0),
   120     SDL_PixelFormat_Index4MSB =
   120     SDL_PixelFormat_Index4MSB =
   121         SDL_DEFINE_PIXELFORMAT (SDL_PixelType_Index4, SDL_BitmapOrder_4321, 0,
   121         SDL_DEFINE_PIXELFORMAT(SDL_PixelType_Index4, SDL_BitmapOrder_4321, 0,
   122                                 2, 0),
   122                                2, 0),
   123     SDL_PixelFormat_Index8 =
   123     SDL_PixelFormat_Index8 =
   124         SDL_DEFINE_PIXELFORMAT (SDL_PixelType_Index8, 0, 0, 8, 1),
   124         SDL_DEFINE_PIXELFORMAT(SDL_PixelType_Index8, 0, 0, 8, 1),
   125     SDL_PixelFormat_RGB332 =
   125     SDL_PixelFormat_RGB332 =
   126         SDL_DEFINE_PIXELFORMAT (SDL_PixelType_Packed8, SDL_PackedOrder_XRGB,
   126         SDL_DEFINE_PIXELFORMAT(SDL_PixelType_Packed8, SDL_PackedOrder_XRGB,
   127                                 SDL_PackedLayout_332, 8, 1),
   127                                SDL_PackedLayout_332, 8, 1),
   128     SDL_PixelFormat_RGB444 =
   128     SDL_PixelFormat_RGB444 =
   129         SDL_DEFINE_PIXELFORMAT (SDL_PixelType_Packed16, SDL_PackedOrder_XRGB,
   129         SDL_DEFINE_PIXELFORMAT(SDL_PixelType_Packed16, SDL_PackedOrder_XRGB,
   130                                 SDL_PackedLayout_4444, 12, 2),
   130                                SDL_PackedLayout_4444, 12, 2),
   131     SDL_PixelFormat_RGB555 =
   131     SDL_PixelFormat_RGB555 =
   132         SDL_DEFINE_PIXELFORMAT (SDL_PixelType_Packed16, SDL_PackedOrder_XRGB,
   132         SDL_DEFINE_PIXELFORMAT(SDL_PixelType_Packed16, SDL_PackedOrder_XRGB,
   133                                 SDL_PackedLayout_1555, 15, 2),
   133                                SDL_PackedLayout_1555, 15, 2),
   134     SDL_PixelFormat_ARGB4444 =
   134     SDL_PixelFormat_ARGB4444 =
   135         SDL_DEFINE_PIXELFORMAT (SDL_PixelType_Packed16, SDL_PackedOrder_ARGB,
   135         SDL_DEFINE_PIXELFORMAT(SDL_PixelType_Packed16, SDL_PackedOrder_ARGB,
   136                                 SDL_PackedLayout_4444, 16, 2),
   136                                SDL_PackedLayout_4444, 16, 2),
   137     SDL_PixelFormat_ARGB1555 =
   137     SDL_PixelFormat_ARGB1555 =
   138         SDL_DEFINE_PIXELFORMAT (SDL_PixelType_Packed16, SDL_PackedOrder_ARGB,
   138         SDL_DEFINE_PIXELFORMAT(SDL_PixelType_Packed16, SDL_PackedOrder_ARGB,
   139                                 SDL_PackedLayout_1555, 16, 2),
   139                                SDL_PackedLayout_1555, 16, 2),
   140     SDL_PixelFormat_RGB565 =
   140     SDL_PixelFormat_RGB565 =
   141         SDL_DEFINE_PIXELFORMAT (SDL_PixelType_Packed16, SDL_PackedOrder_XRGB,
   141         SDL_DEFINE_PIXELFORMAT(SDL_PixelType_Packed16, SDL_PackedOrder_XRGB,
   142                                 SDL_PackedLayout_565, 16, 2),
   142                                SDL_PackedLayout_565, 16, 2),
   143     SDL_PixelFormat_RGB24 =
   143     SDL_PixelFormat_RGB24 =
   144         SDL_DEFINE_PIXELFORMAT (SDL_PixelType_ArrayU8, SDL_ArrayOrder_RGB, 0,
   144         SDL_DEFINE_PIXELFORMAT(SDL_PixelType_ArrayU8, SDL_ArrayOrder_RGB, 0,
   145                                 24, 3),
   145                                24, 3),
   146     SDL_PixelFormat_BGR24 =
   146     SDL_PixelFormat_BGR24 =
   147         SDL_DEFINE_PIXELFORMAT (SDL_PixelType_ArrayU8, SDL_ArrayOrder_BGR, 0,
   147         SDL_DEFINE_PIXELFORMAT(SDL_PixelType_ArrayU8, SDL_ArrayOrder_BGR, 0,
   148                                 24, 3),
   148                                24, 3),
   149     SDL_PixelFormat_RGB888 =
   149     SDL_PixelFormat_RGB888 =
   150         SDL_DEFINE_PIXELFORMAT (SDL_PixelType_Packed32, SDL_PackedOrder_XRGB,
   150         SDL_DEFINE_PIXELFORMAT(SDL_PixelType_Packed32, SDL_PackedOrder_XRGB,
   151                                 SDL_PackedLayout_8888, 24, 4),
   151                                SDL_PackedLayout_8888, 24, 4),
   152     SDL_PixelFormat_BGR888 =
   152     SDL_PixelFormat_BGR888 =
   153         SDL_DEFINE_PIXELFORMAT (SDL_PixelType_Packed32, SDL_PackedOrder_XBGR,
   153         SDL_DEFINE_PIXELFORMAT(SDL_PixelType_Packed32, SDL_PackedOrder_XBGR,
   154                                 SDL_PackedLayout_8888, 24, 4),
   154                                SDL_PackedLayout_8888, 24, 4),
   155     SDL_PixelFormat_ARGB8888 =
   155     SDL_PixelFormat_ARGB8888 =
   156         SDL_DEFINE_PIXELFORMAT (SDL_PixelType_Packed32, SDL_PackedOrder_ARGB,
   156         SDL_DEFINE_PIXELFORMAT(SDL_PixelType_Packed32, SDL_PackedOrder_ARGB,
   157                                 SDL_PackedLayout_8888, 32, 4),
   157                                SDL_PackedLayout_8888, 32, 4),
   158     SDL_PixelFormat_RGBA8888 =
   158     SDL_PixelFormat_RGBA8888 =
   159         SDL_DEFINE_PIXELFORMAT (SDL_PixelType_Packed32, SDL_PackedOrder_RGBA,
   159         SDL_DEFINE_PIXELFORMAT(SDL_PixelType_Packed32, SDL_PackedOrder_RGBA,
   160                                 SDL_PackedLayout_8888, 32, 4),
   160                                SDL_PackedLayout_8888, 32, 4),
   161     SDL_PixelFormat_ABGR8888 =
   161     SDL_PixelFormat_ABGR8888 =
   162         SDL_DEFINE_PIXELFORMAT (SDL_PixelType_Packed32, SDL_PackedOrder_ABGR,
   162         SDL_DEFINE_PIXELFORMAT(SDL_PixelType_Packed32, SDL_PackedOrder_ABGR,
   163                                 SDL_PackedLayout_8888, 32, 4),
   163                                SDL_PackedLayout_8888, 32, 4),
   164     SDL_PixelFormat_BGRA8888 =
   164     SDL_PixelFormat_BGRA8888 =
   165         SDL_DEFINE_PIXELFORMAT (SDL_PixelType_Packed32, SDL_PackedOrder_BGRA,
   165         SDL_DEFINE_PIXELFORMAT(SDL_PixelType_Packed32, SDL_PackedOrder_BGRA,
   166                                 SDL_PackedLayout_8888, 32, 4),
   166                                SDL_PackedLayout_8888, 32, 4),
   167     SDL_PixelFormat_ARGB2101010 =
   167     SDL_PixelFormat_ARGB2101010 =
   168         SDL_DEFINE_PIXELFORMAT (SDL_PixelType_Packed32, SDL_PackedOrder_ARGB,
   168         SDL_DEFINE_PIXELFORMAT(SDL_PixelType_Packed32, SDL_PackedOrder_ARGB,
   169                                 SDL_PackedLayout_2101010, 32, 4),
   169                                SDL_PackedLayout_2101010, 32, 4),
   170 };
   170 };
   171 
   171 
   172 typedef struct SDL_Color
   172 typedef struct SDL_Color
   173 {
   173 {
   174     Uint8 r;
   174     Uint8 r;
   211 
   211 
   212 /*
   212 /*
   213  * Convert one of the enumerated formats above to a bpp and RGBA masks.
   213  * Convert one of the enumerated formats above to a bpp and RGBA masks.
   214  * Returns SDL_TRUE, or SDL_FALSE if the conversion wasn't possible.
   214  * Returns SDL_TRUE, or SDL_FALSE if the conversion wasn't possible.
   215  */
   215  */
   216 extern DECLSPEC SDL_bool SDL_PixelFormatEnumToMasks (Uint32 format, int *bpp,
   216 extern DECLSPEC SDL_bool SDL_PixelFormatEnumToMasks(Uint32 format, int *bpp,
   217                                                      Uint32 * Rmask,
   217                                                     Uint32 * Rmask,
   218                                                      Uint32 * Gmask,
   218                                                     Uint32 * Gmask,
   219                                                      Uint32 * Bmask,
   219                                                     Uint32 * Bmask,
   220                                                      Uint32 * Amask);
   220                                                     Uint32 * Amask);
   221 
   221 
   222 /*
   222 /*
   223  * Convert a bpp and RGBA masks to one of the enumerated formats above.
   223  * Convert a bpp and RGBA masks to one of the enumerated formats above.
   224  * Returns SDL_PixelFormat_Unknown if the conversion wasn't possible.
   224  * Returns SDL_PixelFormat_Unknown if the conversion wasn't possible.
   225  */
   225  */
   226 extern DECLSPEC Uint32 SDL_MasksToPixelFormatEnum (int bpp, Uint32 Rmask,
   226 extern DECLSPEC Uint32 SDL_MasksToPixelFormatEnum(int bpp, Uint32 Rmask,
   227                                                    Uint32 Gmask, Uint32 Bmask,
   227                                                   Uint32 Gmask, Uint32 Bmask,
   228                                                    Uint32 Amask);
   228                                                   Uint32 Amask);
   229 
   229 
   230 /* Ends C function definitions when using C++ */
   230 /* Ends C function definitions when using C++ */
   231 #ifdef __cplusplus
   231 #ifdef __cplusplus
   232 /* *INDENT-OFF* */
   232 /* *INDENT-OFF* */
   233 }
   233 }