Before we start here is the fullcode.
//Color key image
SDL_SetColorKey(fileSurface,SDL_TRUE,SDL_MapRGB(fileSurface->format,0x0,0xFF,0xFF)); //Change SDL_MapRGB TEST
newTexture = SDL_CreateTextureFromSurface( renderer , fileSurface );
Its get transparent good :
When i change that
SDL_MapRGB to some diffrent values like :
SDL_SetColorKey(fileSurface,SDL_TRUE,SDL_MapRGB(fileSurface->format,0xFF,0xFF,0xFF)); //Change SDL_MapRGB TEST
It goes to this :
If you read the docs ( https://wiki.libsdl.org/SDL_SetColorKey ) you’ll
see that the last parameter passed to SDL_SetColorKey is the colour that
you want to be transparent. In the first case you showed you’re passing
0x00FFFF, which is the aqua colour of your background, so the background
In the next case you’re passing 0xFFFFFF, which is white. There’s no
white in your image, so nothing is transparent. If you changed it to
all zeroes, then it’d be black and you’d get the aqua rectangle with the
little dude cut out of it.
OMG. Thanks a lot @Ken_Paulson . The problem was i was relating it with the Background it self. Basically i thought the color of RGB Was suppose to be same with the background image color, and i got all sorts of confused. When you told me this i understood your Making the color with the RGB Values given in the picture transparent. Thanks a lot sir!