SDL Forum Index
SDL
Simple DirectMedia Layer Forums
Reply to topic
SDL_image PNG surfaces showing up as black
Blaze


Joined: 05 Jul 2015
Posts: 11
Reply with quote
I have a strange bug with my program, where x ( a green x ) and o ( a red o ), both solid color PNG images with a transparent background, get drawn to the screen completely black. The non-transparent shape remains the same.

The code where the images are loaded:

x = IMG_Load( "x.png" );
o = IMG_Load( "o.png" );

The code where the images are drawn to the main window surface:

case SQUARE_X:
SDL_BlitSurface( x, NULL, surface, &board[i][j] );
break;
case SQUARE_O:
SDL_BlitSurface( o, NULL, surface, &board[i][j] );

I don't have a good idea what might be causing this.
View user's profileSend private message
Update
Blaze


Joined: 05 Jul 2015
Posts: 11
Reply with quote
After I edited my background image (adding yellow text) the O's now get drawn with the same color as the text. The X's remain black.
View user's profileSend private message
Blaze


Joined: 05 Jul 2015
Posts: 11
Reply with quote
SOLVED: my background image was an 8-bit PNG instead of a 32-bit one.
View user's profileSend private message
SDL_image PNG surfaces showing up as black
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT  
Page 1 of 1  

  
  
 Reply to topic