Skip to main content

User login

What is OpenID?
  • Log in using OpenID
  • Cancel OpenID login
  • Create new account
  • Request new password
Register
  • Home
  • Browse
    • 2D Art
    • 3D Art
    • Concept Art
    • Textures
    • Music
    • Sound Effects
    • Documents
    • Featured Tutorials
  • Submit Art
  • Collect
    • My Collections
    • Art Collections
  • Forums
  • FAQ
  • Leaderboards
    • All Time
      • Total Points
      • Comments
      • Favorites (All)
      • Favorites (2D)
      • Favorites (3D)
      • Favorites (Concept Art)
      • Favorites (Music)
      • Favorites (Sound)
      • Favorites (Textures)
    • Weekly
      • Total Points
      • Comments
      • Favorites (All)
      • Favorites (2D)
      • Favorites (3D)
      • Favorites (Concept Art)
      • Favorites (Music)
      • Favorites (Sound)
      • Favorites (Textures)
  • ❤ Donate

Primary tabs

  • View
  • Collections
  • Comments(active tab)
  • Followers
  • Friends
  • Favorites
Hey guys, I got a lot of
Wednesday, January 16, 2013 - 23:07

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