   problem with SDL_gfx,
  Hi there :],I've tried to do draw rotated/scaled image with alpha on it.But it doesn't work properly. I want to apply the alpha just on part of the image. I mean everything except background. It does work when I'm not using the SDL_gfxSetAlpha() function.But I need to apply the alpha as well, so I really don't know what can be wrong : /. I'll really appreciate any efforts/help.Here you have some examples what I've done already.Here you can see how it works now, the image was drawn with bacground.So the SetColorKey has no effect after I use the SDL_SetgfxAlpha() on the rotated/scaled image. int main(int, char**){    SDL_Init(SDL_INIT_VIDEO);    SDL_Surface *screen = SDL_SetVideoMode(800,600,0,SDL_SWSURFACE);    SDL_Surface *image = SDL_LoadBMP("cb.bmp");    #if 0   SDL_Surface *temp = SDL_DisplayFormat( image );   SDL_FreeSurface(image);   image = temp;    #endif    SDL_SetColorKey( image, SDL_SRCCOLORKEY, SDL_MapRGB( image->format, 0, 0, 0 ) );    int angle = 0;    bool running = true;    while(running) {   Uint32 colour = SDL_MapRGB(screen->format,0,0xff,0);   SDL_FillRect(screen,0,colour);   SDL_Event event;   while(SDL_PollEvent(&event)) {  if( event.type == SDL_QUIT || (event.type == SDL_KEYDOWN && event.key.keysym.sym == SDLK_ESCAPE)) { running = false;  }   }   ++angle;   if( angle >= 360 ) {  angle = 0;   }   SDL_Surface *rotated = rotozoomSurface(image,angle,1,0);   SDL_gfxSetAlpha(rotated,155);   SDL_BlitSurface(rotated,0,screen,0);   SDL_FreeSurface(rotated);   SDL_Flip(screen);    }    SDL_Quit();    return 0;}[Edited by - banannaj0e on May 8, 2009 5:05:31 AM]
  Could you please post an image of what you did expect to achieve? I don't get it, really...;  sry I mixed-up few things.If I'm drawing a simple image without using the rotating ,scaling functions then everything is ok, also alpha does work and there is no problem at all.But when I'm trying to set alpha on image which is using rotozoom function, then it draws image with black background. It looks like the combination of SDL_gfxSetAlpha and SetColorKey doesn't work on rotated or scaled image.Please could anyone write an example of rotated image with alpha?I'm really sorry for my english :/ Thx in advance.[Edited by - banannaj0e on May 8, 2009 3:01:03 PM];  any ideas? :/   ;  Per pixel alpha (which I guess is what SDL_gfxSetAlpha() uses) is not compatible with colour keying. The documentation for SDL_BlitSurface() describes how the function behaves in the presence of alpha channels, per surface alpha and colourkeys.If you just want to fade a surface (e.g. each pixel shares a uniform alpha value) you can use SDL_SetAlpha() as an alternative to SDL_gfxSetAlpha().Example of use would be instead of SDL_gfxSetAlpha(rotated,155), you would write SDL_SetAlpha(rotated, SDL_SRCALPHA, 155);However, if memory serves SDL_gfx's rotation functions might return a surface with an alpha channel. In this case, I would probably do the following: load the image, convert it to a 32 bit surface with an alpha channel, loop through the pixels and replace pixels that match the colour key with alpha = 0 pixels. It might be possible to replace the convert operation with a blit to a newly allocated 32 surface (once the colourkey is set).SDL_Surface *load(const std::string &file, const SDL_Color &key){#if SDL_BYTEORDER == SDL_BIG_ENDIAN    const Uint32 rmask = 0xff000000;    const Uint32 gmask = 0x00ff0000;    const Uint32 bmask = 0x0000ff00;    const Uint32 amask = 0x000000ff;#else    const Uint32 rmask = 0x000000ff;    const Uint32 gmask = 0x0000ff00;    const Uint32 bmask = 0x00ff0000;    const Uint32 amask = 0xff000000;#endif    SDL_Surface *raw = SDL_LoadBMP(file.c_str());    if(!raw)    {   // error checking    }    Uint32 colourkeyPixel = SDL_MapRGB( raw->format, key.r, key.g, key.b );    SDL_SetColorKey( raw, SDL_SRCCOLORKEY, colourkeyPixel);    SDL_Surface *alpha = SDL_CreateRGBSurface(    SDL_SWSURFACE, width, height, 32,    rmask, gmask, bmask, amask);    if(!alpha)    {   // error checking    }    SDL_BlitSurface(raw, 0, alpha, 0);    SDL_FreeSurface(raw);   return alpha;}Disclaimer: code neither tested nor compiled.   