comparison 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
comparison
equal deleted inserted replaced
1682:7ae8018b2e5d 1683:396a35389351
250 SDL_PixelFormat *format; /* Read-only */ 250 SDL_PixelFormat *format; /* Read-only */
251 int w, h; /* Read-only */ 251 int w, h; /* Read-only */
252 int pitch; /* Read-only */ 252 int pitch; /* Read-only */
253 void *pixels; /* Read-write */ 253 void *pixels; /* Read-write */
254 254
255 /* texture associated with the surface, if any */
256 SDL_TextureID textureID;
257
255 /* information needed for surfaces requiring locks */ 258 /* information needed for surfaces requiring locks */
256 int locked; 259 int locked;
257 void *lock_data; 260 void *lock_data;
258 261
259 /* clipping information */ 262 /* clipping information */
1065 */ 1068 */
1066 extern DECLSPEC int SDLCALL SDL_GetGammaRamp(Uint16 * red, Uint16 * green, 1069 extern DECLSPEC int SDLCALL SDL_GetGammaRamp(Uint16 * red, Uint16 * green,
1067 Uint16 * blue); 1070 Uint16 * blue);
1068 1071
1069 /* 1072 /*
1070 * Sets a portion of the colormap for the given 8-bit surface. If 'surface'
1071 * is not a palettized surface, this function does nothing, returning 0.
1072 * If all of the colors were set as passed to SDL_SetColors(), it will
1073 * return 1. If not all the color entries were set exactly as given,
1074 * it will return 0, and you should look at the surface palette to
1075 * determine the actual color palette.
1076 *
1077 * When 'surface' is the surface associated with the current display, the
1078 * display colormap will be updated with the requested colors. If
1079 * SDL_HWPALETTE was set in SDL_SetVideoMode() flags, SDL_SetColors()
1080 * will always return 1, and the palette is guaranteed to be set the way
1081 * you desire, even if the window colormap has to be warped or run under
1082 * emulation.
1083 */
1084 extern DECLSPEC int SDLCALL SDL_SetColors(SDL_Surface * surface,
1085 const SDL_Color * colors,
1086 int firstcolor, int ncolors);
1087
1088 /*
1089 * Maps an RGB triple to an opaque pixel value for a given pixel format 1073 * Maps an RGB triple to an opaque pixel value for a given pixel format
1090 */ 1074 */
1091 extern DECLSPEC Uint32 SDLCALL SDL_MapRGB 1075 extern DECLSPEC Uint32 SDLCALL SDL_MapRGB
1092 (SDL_PixelFormat * format, Uint8 r, Uint8 g, Uint8 b); 1076 (SDL_PixelFormat * format, Uint8 r, Uint8 g, Uint8 b);
1093 1077
1135 Uint32 Bmask, 1119 Uint32 Bmask,
1136 Uint32 Amask); 1120 Uint32 Amask);
1137 extern DECLSPEC SDL_Surface *SDLCALL 1121 extern DECLSPEC SDL_Surface *SDLCALL
1138 SDL_CreateRGBSurfaceFromTexture(SDL_TextureID textureID); 1122 SDL_CreateRGBSurfaceFromTexture(SDL_TextureID textureID);
1139 extern DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface * surface); 1123 extern DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface * surface);
1124
1125 /**
1126 * \fn int SDL_SetSurfacePalette(SDL_Surface *surface, SDL_Palette *palette)
1127 *
1128 * \brief Set the palette used by a surface.
1129 *
1130 * \return 0, or -1 if the surface format doesn't use a palette.
1131 *
1132 * \note A single palette can be shared with many surfaces.
1133 */
1134 extern DECLSPEC int SDLCALL SDL_SetSurfacePalette(SDL_Surface * surface,
1135 SDL_Palette * palette);
1140 1136
1141 /* 1137 /*
1142 * SDL_LockSurface() sets up a surface for directly accessing the pixels. 1138 * SDL_LockSurface() sets up a surface for directly accessing the pixels.
1143 * Between calls to SDL_LockSurface()/SDL_UnlockSurface(), you can write 1139 * Between calls to SDL_LockSurface()/SDL_UnlockSurface(), you can write
1144 * to and read from 'surface->pixels', using the pixel format stored in 1140 * to and read from 'surface->pixels', using the pixel format stored in