Mercurial > sdl-ios-xcode
diff src/video/SDL_surface.c @ 3103:7be21a78777e
Added SDL_GetColorKey()
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Fri, 03 Apr 2009 13:27:33 +0000 |
parents | 8cc00819c8d6 |
children | 147d6ef5be03 |
line wrap: on
line diff
--- a/src/video/SDL_surface.c Sat Mar 28 06:00:42 2009 +0000 +++ b/src/video/SDL_surface.c Fri Apr 03 13:27:33 2009 +0000 @@ -272,6 +272,23 @@ return 0; } +int +SDL_GetColorKey(SDL_Surface * surface, Uint32 * key) +{ + if (!surface) { + return -1; + } + + if (!(surface->map->info.flags & SDL_COPY_COLORKEY)) { + return -1; + } + + if (key) { + *key = surface->map->info.colorkey; + } + return 0; +} + /* This is a fairly slow function to switch from colorkey to alpha */ static void SDL_ConvertColorkeyToAlpha(SDL_Surface * surface)