test/testsprite2.c
changeset 3183 d1436442215f
parent 2884 9dde605c7540
child 3186 51750b7a966f
     1.1 --- a/test/testsprite2.c	Wed Jun 10 05:51:44 2009 +0000
     1.2 +++ b/test/testsprite2.c	Wed Jun 10 05:54:19 2009 +0000
     1.3 @@ -58,6 +58,21 @@
     1.4      /* Set transparent pixel as the pixel at (0,0) */
     1.5      if (temp->format->palette) {
     1.6          SDL_SetColorKey(temp, SDL_SRCCOLORKEY, *(Uint8 *) temp->pixels);
     1.7 +    } else {
     1.8 +        switch (temp->format->BitsPerPixel) {
     1.9 +        case 15:
    1.10 +            SDL_SetColorKey(temp, SDL_SRCCOLORKEY, (*(Uint16 *) temp->pixels) & 0x00007FFF);
    1.11 +            break;
    1.12 +        case 16:
    1.13 +            SDL_SetColorKey(temp, SDL_SRCCOLORKEY, *(Uint16 *) temp->pixels);
    1.14 +            break;
    1.15 +        case 24:
    1.16 +            SDL_SetColorKey(temp, SDL_SRCCOLORKEY, (*(Uint32 *) temp->pixels) & 0x00FFFFFF);
    1.17 +            break;
    1.18 +        case 32:
    1.19 +            SDL_SetColorKey(temp, SDL_SRCCOLORKEY, *(Uint32 *) temp->pixels);
    1.20 +            break;
    1.21 +        }
    1.22      }
    1.23  
    1.24      /* Create textures from the image */