Hey guys, I got a lot of insight from the discussion above. But there still a problem I am facing with my code. What I am doing is that I am creating a raw buffer through another code which decodes a PNG image and fills it into the buffer. Then I create a SDL_Surface over that buffer using SDL_CreateRGBSurfaceFrom function.
Now when I display the image on the screen I do not see the alpha values blending properly. Any Suggestions?
What I do is like:
void * ImgBuffer = ReadPNG("FILE.png"); // Creates a raw buffer with Decoded PNG.
Hey guys, I got a lot of insight from the discussion above. But there still a problem I am facing with my code. What I am doing is that I am creating a raw buffer through another code which decodes a PNG image and fills it into the buffer. Then I create a SDL_Surface over that buffer using SDL_CreateRGBSurfaceFrom function.
Now when I display the image on the screen I do not see the alpha values blending properly. Any Suggestions?
What I do is like:
void * ImgBuffer = ReadPNG("FILE.png"); // Creates a raw buffer with Decoded PNG.
SDL_Surface *image = SDL_CreateRGBSurfaceFrom(ImgBuffer, SWSURFACE, w, h, 32, w*4, 0x00000000, 0x00000000, 0x00000000, 0x00000000);
SDL_Rect rect = {0, 0, 100, 100}; // since the image size is 100x100
SDL_BlitSurface(SDL_Screen /*Video Screen*/, NULL, image, &rect);
But this doesn't show the image properly with alpha blending
Any help would be great