Advertisement
Guest User

SDL_SetSurfaceColorMod

a guest
Jul 26th, 2014
322
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.59 KB | None | 0 0
  1. SDL_surface.c
  2.  
  3. int
  4. SDL_SetSurfaceColorMod(SDL_Surface * surface, Uint8 r, Uint8 g, Uint8 b)
  5. {
  6.     int flags;
  7.  
  8.     if (!surface) {
  9.         return -1;
  10.     }
  11.  
  12.     surface->map->info.r = r;
  13.     surface->map->info.g = g;
  14.     surface->map->info.b = b;
  15.  
  16.     flags = surface->map->info.flags;
  17.     if (r != 0xFF || g != 0xFF || b != 0xFF) {
  18.         surface->map->info.flags |= SDL_COPY_MODULATE_COLOR;
  19.     } else {
  20.         surface->map->info.flags &= ~SDL_COPY_MODULATE_COLOR;
  21.     }
  22.     if (surface->map->info.flags != flags) {
  23.         SDL_InvalidateMap(surface->map);
  24.     }
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement