Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


SDL_jesse

Member Since 03 Mar 2012
Offline Last Active Mar 03 2012 08:46 PM

Posts I've Made

In Topic: Transparent png not transparent with sdl_image

03 March 2012 - 06:20 AM

not only size , I have to flip the image also and some other things according to the game logic . Can I use putPiexl() and getPiexl() to do this?

In Topic: Transparent png not transparent with sdl_image

03 March 2012 - 05:55 AM

thank you for that , but I should change the size of the image ,so I can't use SDL_BlitSurface() to do this in my game.I have to draw it pixel by pixel.
the code above can work with PNG-8 ,but it can't work with PNG-24 or PNG-32

In Topic: Transparent png not transparent with sdl_image

03 March 2012 - 05:33 AM

sorry , I am a freshman in SDL ,it does not help,the main code is here,:
int main(int argc, char *argv[]) {

SDL_Init(SDL_INIT_VIDEO);
SDL_Surface *pScreen = ::SDL_SetVideoMode(640, 480, 0, SDL_SWSURFACE | SDL_DOUBLEBUF);
SDL_Surface *image = IMG_Load("jbutton.png");
SDL_SetAlpha(image, SDL_SRCALPHA, SDL_ALPHA_TRANSPARENT);
SDL_Surface *screen = SDL_DisplayFormatAlpha(image);
for(int i=0;i<image->w;i++)
{
for(int j=0;j<image->h;j++)
{
Uint32 color=getPixel(screen,i,j);
putPixel(pScreen,i,j,color);

}
}
// SDL_BlitSurface(img, 0, video, 0); //this will be ok
SDL_Flip(pScreen);
SDL_Delay(5000);

SDL_Quit();
return 0;
}

In Topic: Transparent png not transparent with sdl_image

03 March 2012 - 04:36 AM

Does any one has ideas about it ? thank you for your reply!

PARTNERS