include/SDL_pixels.h
author Darren Alton <dalton@stevens.edu>
Thu, 19 Jun 2008 07:11:35 +0000
branchgsoc2008_nds
changeset 2673 24a6b3588eac
parent 2275 12ea0fdc0df2
child 2859 99210400e8b9
permissions -rw-r--r--
Cleaned up and added joypad support from 1.2.9 NDS port. Also some minor video driver bugfixes.
slouken@1895
     1
/*
slouken@1895
     2
    SDL - Simple DirectMedia Layer
slouken@1895
     3
    Copyright (C) 1997-2006 Sam Lantinga
slouken@1895
     4
slouken@1895
     5
    This library is free software; you can redistribute it and/or
slouken@1895
     6
    modify it under the terms of the GNU Lesser General Public
slouken@1895
     7
    License as published by the Free Software Foundation; either
slouken@1895
     8
    version 2.1 of the License, or (at your option) any later version.
slouken@1895
     9
slouken@1895
    10
    This library is distributed in the hope that it will be useful,
slouken@1895
    11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
slouken@1895
    12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
slouken@1895
    13
    Lesser General Public License for more details.
slouken@1895
    14
slouken@1895
    15
    You should have received a copy of the GNU Lesser General Public
slouken@1895
    16
    License along with this library; if not, write to the Free Software
slouken@1895
    17
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
slouken@1895
    18
slouken@1895
    19
    Sam Lantinga
slouken@1895
    20
    slouken@libsdl.org
slouken@1895
    21
*/
slouken@1895
    22
slouken@1895
    23
/**
slouken@1895
    24
 * \file SDL_pixels.h
slouken@1895
    25
 *
slouken@1895
    26
 * Header for the enumerated pixel format definitions
slouken@1895
    27
 */
slouken@1895
    28
slouken@1895
    29
#ifndef _SDL_pixels_h
slouken@1895
    30
#define _SDL_pixels_h
slouken@1895
    31
slouken@1895
    32
#include "begin_code.h"
slouken@1895
    33
/* Set up for C function definitions, even when using C++ */
slouken@1895
    34
#ifdef __cplusplus
slouken@1895
    35
/* *INDENT-OFF* */
slouken@1895
    36
extern "C" {
slouken@1895
    37
/* *INDENT-ON* */
slouken@1895
    38
#endif
slouken@1895
    39
slouken@2275
    40
/* Transparency definitions: These define alpha as the opacity of a surface */
slouken@2275
    41
#define SDL_ALPHA_OPAQUE 255
slouken@2275
    42
#define SDL_ALPHA_TRANSPARENT 0
slouken@2275
    43
slouken@1895
    44
enum
slouken@1895
    45
{                               /* Pixel type */
slouken@1965
    46
    SDL_PIXELTYPE_UNKNOWN,
slouken@1965
    47
    SDL_PIXELTYPE_INDEX1,
slouken@1965
    48
    SDL_PIXELTYPE_INDEX4,
slouken@1965
    49
    SDL_PIXELTYPE_INDEX8,
slouken@1965
    50
    SDL_PIXELTYPE_PACKED8,
slouken@1965
    51
    SDL_PIXELTYPE_PACKED16,
slouken@1965
    52
    SDL_PIXELTYPE_PACKED32,
slouken@1965
    53
    SDL_PIXELTYPE_ARRAYU8,
slouken@1965
    54
    SDL_PIXELTYPE_ARRAYU16,
slouken@1965
    55
    SDL_PIXELTYPE_ARRAYU32,
slouken@1965
    56
    SDL_PIXELTYPE_ARRAYF16,
slouken@2208
    57
    SDL_PIXELTYPE_ARRAYF32
slouken@1895
    58
};
slouken@1895
    59
slouken@1895
    60
enum
slouken@1895
    61
{                               /* bitmap pixel order, high bit -> low bit */
slouken@1965
    62
    SDL_BITMAPORDER_NONE,
slouken@1965
    63
    SDL_BITMAPORDER_4321,
slouken@2208
    64
    SDL_BITMAPORDER_1234
slouken@1895
    65
};
slouken@1895
    66
enum
slouken@1895
    67
{                               /* packed component order, high bit -> low bit */
slouken@1965
    68
    SDL_PACKEDORDER_NONE,
slouken@1965
    69
    SDL_PACKEDORDER_XRGB,
slouken@1965
    70
    SDL_PACKEDORDER_RGBX,
slouken@1965
    71
    SDL_PACKEDORDER_ARGB,
slouken@1965
    72
    SDL_PACKEDORDER_RGBA,
slouken@1965
    73
    SDL_PACKEDORDER_XBGR,
slouken@1965
    74
    SDL_PACKEDORDER_BGRX,
slouken@1965
    75
    SDL_PACKEDORDER_ABGR,
slouken@2208
    76
    SDL_PACKEDORDER_BGRA
slouken@1895
    77
};
slouken@1895
    78
enum
slouken@1895
    79
{                               /* array component order, low byte -> high byte */
slouken@1965
    80
    SDL_ARRAYORDER_NONE,
slouken@1965
    81
    SDL_ARRAYORDER_RGB,
slouken@1965
    82
    SDL_ARRAYORDER_RGBA,
slouken@1965
    83
    SDL_ARRAYORDER_ARGB,
slouken@1965
    84
    SDL_ARRAYORDER_BGR,
slouken@1965
    85
    SDL_ARRAYORDER_BGRA,
slouken@2208
    86
    SDL_ARRAYORDER_ABGR
slouken@1895
    87
};
slouken@1895
    88
slouken@1895
    89
enum
slouken@1895
    90
{                               /* Packed component layout */
slouken@1965
    91
    SDL_PACKEDLAYOUT_NONE,
slouken@1965
    92
    SDL_PACKEDLAYOUT_332,
slouken@1965
    93
    SDL_PACKEDLAYOUT_4444,
slouken@1965
    94
    SDL_PACKEDLAYOUT_1555,
slouken@1965
    95
    SDL_PACKEDLAYOUT_5551,
slouken@1965
    96
    SDL_PACKEDLAYOUT_565,
slouken@1965
    97
    SDL_PACKEDLAYOUT_8888,
slouken@1965
    98
    SDL_PACKEDLAYOUT_2101010,
slouken@2208
    99
    SDL_PACKEDLAYOUT_1010102
slouken@1895
   100
};
slouken@1895
   101
slouken@1895
   102
#define SDL_DEFINE_PIXELFOURCC(A, B, C, D) \
slouken@1895
   103
    ((A) | ((B) << 8) | ((C) << 16) | ((D) << 24))
slouken@1895
   104
slouken@1895
   105
#define SDL_DEFINE_PIXELFORMAT(type, order, layout, bits, bytes) \
slouken@1895
   106
    ((1 << 31) | ((type) << 24) | ((order) << 20) | ((layout) << 16) | \
slouken@1895
   107
     ((bits) << 8) | ((bytes) << 0))
slouken@1895
   108
slouken@1895
   109
#define SDL_PIXELTYPE(X)	(((X) >> 24) & 0x0F)
slouken@1895
   110
#define SDL_PIXELORDER(X)	(((X) >> 20) & 0x0F)
slouken@1895
   111
#define SDL_PIXELLAYOUT(X)	(((X) >> 16) & 0x0F)
slouken@1895
   112
#define SDL_BITSPERPIXEL(X)	(((X) >> 8) & 0xFF)
slouken@1895
   113
#define SDL_BYTESPERPIXEL(X)	(((X) >> 0) & 0xFF)
slouken@1895
   114
slouken@1895
   115
#define SDL_ISPIXELFORMAT_INDEXED(format)   \
slouken@1965
   116
    ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX1) || \
slouken@1965
   117
     (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX4) || \
slouken@1965
   118
     (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX8))
slouken@1895
   119
slouken@1895
   120
#define SDL_ISPIXELFORMAT_FOURCC(format)    \
slouken@1895
   121
    ((format) && !((format) & 0x80000000))
slouken@1895
   122
slouken@1895
   123
enum
slouken@1895
   124
{
slouken@1965
   125
    SDL_PIXELFORMAT_UNKNOWN,
slouken@1965
   126
    SDL_PIXELFORMAT_INDEX1LSB =
slouken@1965
   127
        SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX1, SDL_BITMAPORDER_1234, 0,
slouken@1895
   128
                               1, 0),
slouken@1965
   129
    SDL_PIXELFORMAT_INDEX1MSB =
slouken@1965
   130
        SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX1, SDL_BITMAPORDER_4321, 0,
slouken@1895
   131
                               1, 0),
slouken@1965
   132
    SDL_PIXELFORMAT_INDEX4LSB =
slouken@1965
   133
        SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX4, SDL_BITMAPORDER_1234, 0,
slouken@1895
   134
                               2, 0),
slouken@1965
   135
    SDL_PIXELFORMAT_INDEX4MSB =
slouken@1965
   136
        SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX4, SDL_BITMAPORDER_4321, 0,
slouken@1895
   137
                               2, 0),
slouken@1965
   138
    SDL_PIXELFORMAT_INDEX8 =
slouken@1965
   139
        SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX8, 0, 0, 8, 1),
slouken@1965
   140
    SDL_PIXELFORMAT_RGB332 =
slouken@1965
   141
        SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED8, SDL_PACKEDORDER_XRGB,
slouken@1965
   142
                               SDL_PACKEDLAYOUT_332, 8, 1),
slouken@1965
   143
    SDL_PIXELFORMAT_RGB444 =
slouken@1965
   144
        SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB,
slouken@1965
   145
                               SDL_PACKEDLAYOUT_4444, 12, 2),
slouken@1965
   146
    SDL_PIXELFORMAT_RGB555 =
slouken@1965
   147
        SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB,
slouken@1965
   148
                               SDL_PACKEDLAYOUT_1555, 15, 2),
dalton@2673
   149
    SDL_PIXELFORMAT_BGR555 =
dalton@2673
   150
        SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XBGR,
dalton@2673
   151
                               SDL_PACKEDLAYOUT_1555, 15, 2),
slouken@1965
   152
    SDL_PIXELFORMAT_ARGB4444 =
slouken@1965
   153
        SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ARGB,
slouken@1965
   154
                               SDL_PACKEDLAYOUT_4444, 16, 2),
slouken@1965
   155
    SDL_PIXELFORMAT_ARGB1555 =
slouken@1965
   156
        SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ARGB,
slouken@1965
   157
                               SDL_PACKEDLAYOUT_1555, 16, 2),
dalton@2673
   158
    SDL_PIXELFORMAT_ABGR1555 =
dalton@2673
   159
        SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ABGR,
dalton@2673
   160
                               SDL_PACKEDLAYOUT_1555, 16, 2),
slouken@1965
   161
    SDL_PIXELFORMAT_RGB565 =
slouken@1965
   162
        SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB,
slouken@1965
   163
                               SDL_PACKEDLAYOUT_565, 16, 2),
slouken@1965
   164
    SDL_PIXELFORMAT_RGB24 =
slouken@1965
   165
        SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_ARRAYU8, SDL_ARRAYORDER_RGB, 0,
slouken@1895
   166
                               24, 3),
slouken@1965
   167
    SDL_PIXELFORMAT_BGR24 =
slouken@1965
   168
        SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_ARRAYU8, SDL_ARRAYORDER_BGR, 0,
slouken@1895
   169
                               24, 3),
slouken@1965
   170
    SDL_PIXELFORMAT_RGB888 =
slouken@1965
   171
        SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_XRGB,
slouken@1965
   172
                               SDL_PACKEDLAYOUT_8888, 24, 4),
slouken@1965
   173
    SDL_PIXELFORMAT_BGR888 =
slouken@1965
   174
        SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_XBGR,
slouken@1965
   175
                               SDL_PACKEDLAYOUT_8888, 24, 4),
slouken@1965
   176
    SDL_PIXELFORMAT_ARGB8888 =
slouken@1965
   177
        SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ARGB,
slouken@1965
   178
                               SDL_PACKEDLAYOUT_8888, 32, 4),
slouken@1965
   179
    SDL_PIXELFORMAT_RGBA8888 =
slouken@1965
   180
        SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_RGBA,
slouken@1965
   181
                               SDL_PACKEDLAYOUT_8888, 32, 4),
slouken@1965
   182
    SDL_PIXELFORMAT_ABGR8888 =
slouken@1965
   183
        SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ABGR,
slouken@1965
   184
                               SDL_PACKEDLAYOUT_8888, 32, 4),
slouken@1965
   185
    SDL_PIXELFORMAT_BGRA8888 =
slouken@1965
   186
        SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_BGRA,
slouken@1965
   187
                               SDL_PACKEDLAYOUT_8888, 32, 4),
slouken@1965
   188
    SDL_PIXELFORMAT_ARGB2101010 =
slouken@1965
   189
        SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ARGB,
slouken@1965
   190
                               SDL_PACKEDLAYOUT_2101010, 32, 4),
slouken@1895
   191
slouken@1965
   192
    SDL_PIXELFORMAT_YV12 =      /* Planar mode: Y + V + U  (3 planes) */
slouken@1895
   193
        SDL_DEFINE_PIXELFOURCC('Y', 'V', '1', '2'),
slouken@1965
   194
    SDL_PIXELFORMAT_IYUV =      /* Planar mode: Y + U + V  (3 planes) */
slouken@1895
   195
        SDL_DEFINE_PIXELFOURCC('I', 'Y', 'U', 'V'),
slouken@1965
   196
    SDL_PIXELFORMAT_YUY2 =      /* Packed mode: Y0+U0+Y1+V0 (1 plane) */
slouken@1895
   197
        SDL_DEFINE_PIXELFOURCC('Y', 'U', 'Y', '2'),
slouken@1965
   198
    SDL_PIXELFORMAT_UYVY =      /* Packed mode: U0+Y0+V0+Y1 (1 plane) */
slouken@1895
   199
        SDL_DEFINE_PIXELFOURCC('U', 'Y', 'V', 'Y'),
slouken@1965
   200
    SDL_PIXELFORMAT_YVYU =      /* Packed mode: Y0+V0+Y1+U0 (1 plane) */
slouken@2208
   201
        SDL_DEFINE_PIXELFOURCC('Y', 'V', 'Y', 'U')
slouken@1895
   202
};
slouken@1895
   203
slouken@1895
   204
typedef struct SDL_Color
slouken@1895
   205
{
slouken@1895
   206
    Uint8 r;
slouken@1895
   207
    Uint8 g;
slouken@1895
   208
    Uint8 b;
slouken@1895
   209
    Uint8 unused;
slouken@1895
   210
} SDL_Color;
slouken@1895
   211
#define SDL_Colour SDL_Color
slouken@1895
   212
slouken@1895
   213
typedef struct SDL_Palette SDL_Palette;
slouken@1895
   214
typedef int (*SDL_PaletteChangedFunc) (void *userdata, SDL_Palette * palette);
slouken@1895
   215
slouken@1895
   216
typedef struct SDL_PaletteWatch
slouken@1895
   217
{
slouken@1895
   218
    SDL_PaletteChangedFunc callback;
slouken@1895
   219
    void *userdata;
slouken@1895
   220
    struct SDL_PaletteWatch *next;
slouken@1895
   221
} SDL_PaletteWatch;
slouken@1895
   222
slouken@1895
   223
struct SDL_Palette
slouken@1895
   224
{
slouken@1895
   225
    int ncolors;
slouken@1895
   226
    SDL_Color *colors;
slouken@1895
   227
slouken@1895
   228
    int refcount;
slouken@1895
   229
    SDL_PaletteWatch *watch;
slouken@1895
   230
};
slouken@1895
   231
slouken@1895
   232
/* Everything in the pixel format structure is read-only */
slouken@1895
   233
typedef struct SDL_PixelFormat
slouken@1895
   234
{
slouken@1895
   235
    SDL_Palette *palette;
slouken@1895
   236
    Uint8 BitsPerPixel;
slouken@1895
   237
    Uint8 BytesPerPixel;
slouken@1895
   238
    Uint8 Rloss;
slouken@1895
   239
    Uint8 Gloss;
slouken@1895
   240
    Uint8 Bloss;
slouken@1895
   241
    Uint8 Aloss;
slouken@1895
   242
    Uint8 Rshift;
slouken@1895
   243
    Uint8 Gshift;
slouken@1895
   244
    Uint8 Bshift;
slouken@1895
   245
    Uint8 Ashift;
slouken@1895
   246
    Uint32 Rmask;
slouken@1895
   247
    Uint32 Gmask;
slouken@1895
   248
    Uint32 Bmask;
slouken@1895
   249
    Uint32 Amask;
slouken@1895
   250
} SDL_PixelFormat;
slouken@1895
   251
slouken@1895
   252
/**
slouken@1895
   253
 * \fn SDL_bool SDL_PixelFormatEnumToMasks(Uint32 format, int *bpp, Uint32 * Rmask, Uint32 * Gmask, Uint32 * Bmask, Uint32 * Amask)
slouken@1895
   254
 *
slouken@1895
   255
 * \brief Convert one of the enumerated pixel formats to a bpp and RGBA masks.
slouken@1895
   256
 *
slouken@1895
   257
 * \return SDL_TRUE, or SDL_FALSE if the conversion wasn't possible.
slouken@1895
   258
 *
slouken@1895
   259
 * \sa SDL_MasksToPixelFormatEnum()
slouken@1895
   260
 */
slouken@1895
   261
extern DECLSPEC SDL_bool SDLCALL SDL_PixelFormatEnumToMasks(Uint32 format,
slouken@1895
   262
                                                            int *bpp,
slouken@1895
   263
                                                            Uint32 * Rmask,
slouken@1895
   264
                                                            Uint32 * Gmask,
slouken@1895
   265
                                                            Uint32 * Bmask,
slouken@1895
   266
                                                            Uint32 * Amask);
slouken@1895
   267
slouken@1895
   268
/**
slouken@1895
   269
 * \fn Uint32 SDL_MasksToPixelFormatEnum(int bpp, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
slouken@1895
   270
 *
slouken@1895
   271
 * \brief Convert a bpp and RGBA masks to an enumerated pixel format.
slouken@1895
   272
 *
slouken@1895
   273
 * \return The pixel format, or SDL_PixelFormat_Unknown if the conversion wasn't possible.
slouken@1895
   274
 *
slouken@1895
   275
 * \sa SDL_PixelFormatEnumToMasks()
slouken@1895
   276
 */
slouken@1895
   277
extern DECLSPEC Uint32 SDLCALL SDL_MasksToPixelFormatEnum(int bpp,
slouken@1895
   278
                                                          Uint32 Rmask,
slouken@1895
   279
                                                          Uint32 Gmask,
slouken@1895
   280
                                                          Uint32 Bmask,
slouken@1895
   281
                                                          Uint32 Amask);
slouken@1895
   282
slouken@1895
   283
/**
slouken@1895
   284
 * \fn SDL_Palette *SDL_AllocPalette(int ncolors)
slouken@1895
   285
 *
slouken@1895
   286
 * \brief Create a palette structure with the specified number of color entries.
slouken@1895
   287
 *
slouken@1895
   288
 * \return A new palette, or NULL if there wasn't enough memory
slouken@1895
   289
 *
slouken@1895
   290
 * \note The palette entries are initialized to white.
slouken@1895
   291
 *
slouken@1895
   292
 * \sa SDL_FreePalette()
slouken@1895
   293
 */
slouken@1895
   294
extern DECLSPEC SDL_Palette *SDLCALL SDL_AllocPalette(int ncolors);
slouken@1895
   295
slouken@1895
   296
/**
slouken@1895
   297
 * \fn int SDL_AddPaletteWatch(SDL_Palette *palette, SDL_PaletteChangedFunc callback, void *userdata)
slouken@1895
   298
 *
slouken@1895
   299
 * \brief Add a callback function which is called when the palette changes.
slouken@1895
   300
 *
slouken@1895
   301
 * \sa SDL_DelPaletteWatch()
slouken@1895
   302
 */
slouken@1895
   303
extern DECLSPEC int SDLCALL SDL_AddPaletteWatch(SDL_Palette * palette,
slouken@1895
   304
                                                SDL_PaletteChangedFunc
slouken@1895
   305
                                                callback, void *userdata);
slouken@1895
   306
slouken@1895
   307
/**
slouken@1895
   308
 * \fn void SDL_DelPaletteWatch(SDL_Palette *palette, SDL_PaletteChangedFunc callback, void *userdata)
slouken@1895
   309
 *
slouken@1895
   310
 * \brief Remove a callback function previously added with SDL_AddPaletteWatch()
slouken@1895
   311
 *
slouken@1895
   312
 * \sa SDL_AddPaletteWatch()
slouken@1895
   313
 */
slouken@1895
   314
extern DECLSPEC void SDLCALL SDL_DelPaletteWatch(SDL_Palette * palette,
slouken@1895
   315
                                                 SDL_PaletteChangedFunc
slouken@1895
   316
                                                 callback, void *userdata);
slouken@1895
   317
slouken@1895
   318
/**
slouken@1895
   319
 * \fn int SDL_SetPaletteColors(SDL_Palette *palette, const SDL_Colors *colors, int firstcolor, int numcolors)
slouken@1895
   320
 *
slouken@1895
   321
 * \brief Set a range of colors in a palette.
slouken@1895
   322
 *
slouken@1895
   323
 * \param palette The palette to modify
slouken@1895
   324
 * \param colors An array of colors to copy into the palette
slouken@1895
   325
 * \param firstcolor The index of the first palette entry to modify
slouken@1895
   326
 * \param ncolors The number of entries to modify
slouken@1895
   327
 *
slouken@1895
   328
 * \return 0 on success, or -1 if not all of the colors could be set
slouken@1895
   329
 */
slouken@1895
   330
extern DECLSPEC int SDLCALL SDL_SetPaletteColors(SDL_Palette * palette,
slouken@1895
   331
                                                 const SDL_Color * colors,
slouken@1895
   332
                                                 int firstcolor, int ncolors);
slouken@1895
   333
slouken@1895
   334
/**
slouken@1895
   335
 * \fn void SDL_FreePalette(SDL_Palette *palette)
slouken@1895
   336
 *
slouken@1895
   337
 * \brief Free a palette created with SDL_AllocPalette()
slouken@1895
   338
 *
slouken@1895
   339
 * \sa SDL_AllocPalette()
slouken@1895
   340
 */
slouken@1895
   341
extern DECLSPEC void SDLCALL SDL_FreePalette(SDL_Palette * palette);
slouken@1895
   342
slouken@2275
   343
/**
slouken@2275
   344
 * \fn Uint32 SDL_MapRGB(const SDL_PixelFormat *format,
slouken@2275
   345
 *                       Uint8 r, Uint8 g, Uint8 b)
slouken@2275
   346
 *
slouken@2275
   347
 * \brief Maps an RGB triple to an opaque pixel value for a given pixel format
slouken@2275
   348
 *
slouken@2275
   349
 * \sa SDL_MapRGBA
slouken@2275
   350
 */
slouken@2275
   351
extern DECLSPEC Uint32 SDLCALL SDL_MapRGB(const SDL_PixelFormat * format,
slouken@2275
   352
                                          Uint8 r, Uint8 g, Uint8 b);
slouken@2275
   353
slouken@2275
   354
/**
slouken@2275
   355
 * \fn Uint32 SDL_MapRGBA(const SDL_PixelFormat *fmt,
slouken@2275
   356
 *                        Uint8 r, Uint8 g, Uint8 b, Uint8 a)
slouken@2275
   357
 *
slouken@2275
   358
 * \brief Maps an RGBA quadruple to a pixel value for a given pixel format
slouken@2275
   359
 *
slouken@2275
   360
 * \sa SDL_MapRGB
slouken@2275
   361
 */
slouken@2275
   362
extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA(const SDL_PixelFormat * format,
slouken@2275
   363
                                           Uint8 r, Uint8 g, Uint8 b,
slouken@2275
   364
                                           Uint8 a);
slouken@2275
   365
slouken@2275
   366
/**
slouken@2275
   367
 * \fn void SDL_GetRGB(Uint32 pixel, const SDL_PixelFormat * format,
slouken@2275
   368
 *                     Uint8 * r, Uint8 * g, Uint8 * b)
slouken@2275
   369
 *
slouken@2275
   370
 * \brief Maps a pixel value into the RGB components for a given pixel format
slouken@2275
   371
 *
slouken@2275
   372
 * \sa SDL_GetRGBA
slouken@2275
   373
 */
slouken@2275
   374
extern DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel,
slouken@2275
   375
                                        const SDL_PixelFormat * format,
slouken@2275
   376
                                        Uint8 * r, Uint8 * g, Uint8 * b);
slouken@2275
   377
slouken@2275
   378
/**
slouken@2275
   379
 * \fn void SDL_GetRGBA(Uint32 pixel, const SDL_PixelFormat * format,
slouken@2275
   380
 *                      Uint8 * r, Uint8 * g, Uint8 * b, Uint8 * a)
slouken@2275
   381
 *
slouken@2275
   382
 * \brief Maps a pixel value into the RGBA components for a given pixel format
slouken@2275
   383
 *
slouken@2275
   384
 * \sa SDL_GetRGB
slouken@2275
   385
 */
slouken@2275
   386
extern DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel,
slouken@2275
   387
                                         const SDL_PixelFormat * format,
slouken@2275
   388
                                         Uint8 * r, Uint8 * g, Uint8 * b,
slouken@2275
   389
                                         Uint8 * a);
slouken@2275
   390
slouken@1895
   391
/* Ends C function definitions when using C++ */
slouken@1895
   392
#ifdef __cplusplus
slouken@1895
   393
/* *INDENT-OFF* */
slouken@1895
   394
}
slouken@1895
   395
/* *INDENT-ON* */
slouken@1895
   396
#endif
slouken@1895
   397
#include "close_code.h"
slouken@1895
   398
slouken@1895
   399
#endif /* _SDL_pixels_h */
slouken@1895
   400
slouken@1895
   401
/* vi: set ts=4 sw=4 expandtab: */