Hello everyone,
I'm trying to accomplish something in SDL and i'm wondering if it can be done easily.
What i want to do it this:
First i create a new texture from a PNG file with this code. No problem so far.
bool CTextureInfo::Unserialize(std::ifstream &_inputfilestream)
{
//png
int pngsize = 0;
_inputfilestream.read(reinterpret_cast<char *>(&pngsize), sizeof(int) );
char *textureBinaries = new char[pngsize];
_inputfilestream.read(reinterpret_cast<char *>(textureBinaries), pngsize);
// Create texture
SDL_RWops *img = SDL_RWFromConstMem(textureBinaries, pngsize);
// This part is building the texture through SDL_image
SDL_Texture *texture = IMG_LoadTexture_RW(CSDL_Setup::GetInstance()->GetRenderer(), img, 0);
}
After this i want to create another texture that will be a copy of the first one, but instead all pixels that are not transparent become white.
See attached image for example of what texture 1 and texture 2 should look like.
However, i am failing really hard to figure how to do this.
I thank you in advance.