include/SDL_pixels.h
changeset 5288 d4381f3b0d1e
parent 5264 7ace5f8f432f
child 5434 fb5e9db92a77
     1.1 --- a/include/SDL_pixels.h	Sun Feb 13 01:31:07 2011 -0800
     1.2 +++ b/include/SDL_pixels.h	Sun Feb 13 13:46:10 2011 -0800
     1.3 @@ -253,24 +253,20 @@
     1.4  } SDL_Color;
     1.5  #define SDL_Colour SDL_Color
     1.6  
     1.7 -typedef struct SDL_Palette SDL_Palette;
     1.8 -typedef int (*SDL_PaletteChangedFunc) (void *userdata, SDL_Palette * palette);
     1.9 -typedef struct SDL_PaletteWatch SDL_PaletteWatch;
    1.10 -
    1.11 -struct SDL_Palette
    1.12 +typedef struct SDL_Palette
    1.13  {
    1.14      int ncolors;
    1.15      SDL_Color *colors;
    1.16 -
    1.17 +    Uint32 version;
    1.18      int refcount;
    1.19 -    SDL_PaletteWatch *watch;
    1.20 -};
    1.21 +} SDL_Palette;
    1.22  
    1.23  /**
    1.24   *  \note Everything in the pixel format structure is read-only.
    1.25   */
    1.26  typedef struct SDL_PixelFormat
    1.27  {
    1.28 +    Uint32 format;
    1.29      SDL_Palette *palette;
    1.30      Uint8 BitsPerPixel;
    1.31      Uint8 BytesPerPixel;
    1.32 @@ -286,6 +282,8 @@
    1.33      Uint32 Gmask;
    1.34      Uint32 Bmask;
    1.35      Uint32 Amask;
    1.36 +    int refcount;
    1.37 +    struct SDL_PixelFormat *next;
    1.38  } SDL_PixelFormat;
    1.39  
    1.40  /**
    1.41 @@ -322,6 +320,16 @@
    1.42                                                            Uint32 Amask);
    1.43  
    1.44  /**
    1.45 + *  \brief Create an SDL_PixelFormat structure from a pixel format enum.
    1.46 + */
    1.47 +extern DECLSPEC SDL_PixelFormat * SDLCALL SDL_AllocFormat(Uint32 pixel_format);
    1.48 +
    1.49 +/**
    1.50 + *  \brief Free an SDL_PixelFormat structure.
    1.51 + */
    1.52 +extern DECLSPEC void SDLCALL SDL_FreeFormat(SDL_PixelFormat *format);
    1.53 +
    1.54 +/**
    1.55   *  \brief Create a palette structure with the specified number of color 
    1.56   *         entries.
    1.57   *  
    1.58 @@ -334,23 +342,10 @@
    1.59  extern DECLSPEC SDL_Palette *SDLCALL SDL_AllocPalette(int ncolors);
    1.60  
    1.61  /**
    1.62 - *  \brief Add a callback function which is called when the palette changes.
    1.63 - *  
    1.64 - *  \sa SDL_DelPaletteWatch()
    1.65 + *  \brief Set the palette for a pixel format structure.
    1.66   */
    1.67 -extern DECLSPEC int SDLCALL SDL_AddPaletteWatch(SDL_Palette * palette,
    1.68 -                                                SDL_PaletteChangedFunc
    1.69 -                                                callback, void *userdata);
    1.70 -
    1.71 -/**
    1.72 - *  \brief Remove a callback function previously added with 
    1.73 - *         SDL_AddPaletteWatch().
    1.74 - *  
    1.75 - *  \sa SDL_AddPaletteWatch()
    1.76 - */
    1.77 -extern DECLSPEC void SDLCALL SDL_DelPaletteWatch(SDL_Palette * palette,
    1.78 -                                                 SDL_PaletteChangedFunc
    1.79 -                                                 callback, void *userdata);
    1.80 +extern DECLSPEC int SDLCALL SDL_SetPixelFormatPalette(SDL_PixelFormat * format,
    1.81 +                                                      SDL_Palette *palette);
    1.82  
    1.83  /**
    1.84   *  \brief Set a range of colors in a palette.