diff include/SDL_video.h @ 1683:396a35389351 SDL-1.3

Finished palettized display handling. Added support for surface palette sharing.
author Sam Lantinga <slouken@libsdl.org>
date Sat, 17 Jun 2006 06:45:14 +0000
parents 7ae8018b2e5d
children 1577404809f0
line wrap: on
line diff
--- a/include/SDL_video.h	Fri Jun 16 06:00:31 2006 +0000
+++ b/include/SDL_video.h	Sat Jun 17 06:45:14 2006 +0000
@@ -252,6 +252,9 @@
     int pitch;                  /* Read-only */
     void *pixels;               /* Read-write */
 
+    /* texture associated with the surface, if any */
+    SDL_TextureID textureID;
+
     /* information needed for surfaces requiring locks */
     int locked;
     void *lock_data;
@@ -1067,25 +1070,6 @@
                                              Uint16 * blue);
 
 /*
- * Sets a portion of the colormap for the given 8-bit surface.  If 'surface'
- * is not a palettized surface, this function does nothing, returning 0.
- * If all of the colors were set as passed to SDL_SetColors(), it will
- * return 1.  If not all the color entries were set exactly as given,
- * it will return 0, and you should look at the surface palette to
- * determine the actual color palette.
- *
- * When 'surface' is the surface associated with the current display, the
- * display colormap will be updated with the requested colors.  If 
- * SDL_HWPALETTE was set in SDL_SetVideoMode() flags, SDL_SetColors()
- * will always return 1, and the palette is guaranteed to be set the way
- * you desire, even if the window colormap has to be warped or run under
- * emulation.
- */
-extern DECLSPEC int SDLCALL SDL_SetColors(SDL_Surface * surface,
-                                          const SDL_Color * colors,
-                                          int firstcolor, int ncolors);
-
-/*
  * Maps an RGB triple to an opaque pixel value for a given pixel format
  */
 extern DECLSPEC Uint32 SDLCALL SDL_MapRGB
@@ -1138,6 +1122,18 @@
 SDL_CreateRGBSurfaceFromTexture(SDL_TextureID textureID);
 extern DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface * surface);
 
+/**
+ * \fn int SDL_SetSurfacePalette(SDL_Surface *surface, SDL_Palette *palette)
+ *
+ * \brief Set the palette used by a surface.
+ *
+ * \return 0, or -1 if the surface format doesn't use a palette.
+ *
+ * \note A single palette can be shared with many surfaces.
+ */
+extern DECLSPEC int SDLCALL SDL_SetSurfacePalette(SDL_Surface * surface,
+                                                  SDL_Palette * palette);
+
 /*
  * SDL_LockSurface() sets up a surface for directly accessing the pixels.
  * Between calls to SDL_LockSurface()/SDL_UnlockSurface(), you can write