SDL_LoadBMP Problems... Colors Garbled

Started by
5 comments, last by samuraicrow 16 years, 11 months ago
Hi, I've been spending a while trying to write a program to take a screenshot of the desktop, save it as a BMP and then load that BMP as an SDL Surface. Well, I've done the first part but when I go to load it it... appears wrong. All my image programs load it fine, paint, Windows Photo Gallery it all loads fine. But when my program loads it as an SDL Surface the colours are completely wrong. Heres what appears: http://xs215.xs.to/xs215/07211/badsdl.jpg Obiously....that's not what I see. I'm running the normal vista theme. To load it my code it quite simply:
    loadedImage = SDL_LoadBMP( filename.c_str() );
Dying for help... so... please help! Thanks. [Edited by - squimmy on May 21, 2007 3:57:41 PM]
Advertisement
Not really an SDL user, but is there some graphics initialization code that SDL requires that isn't getting called first?

Jesus saves ... the rest of you take 2d4 fire damage.

Nah, I know the loading code is fine. If I make a bmp with paint or somethings it's fine. It's the screenshot code, which is the same as:

http://www.codeguru.com/Cpp/G-M/bitmap/capturing/article.php/c4915



In fact, if I use that proggie, same problem occurs when I go to load the saved BMP.
Are you sure you're loading a BMP file? The link you provided is for a JPG.
Yes, very.

To show you the result I just had to take a screenshot with prntscrn and paste it to paint, which saved it as a jpg.
Anybody?

If nobody knows this, then it would also be helpful if somebody could tell my why I am getting the following error when compiling jpeglib.h, even though in the WindowBitmap project that file compiles fine:

c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\JPEGLIB.H(910): error C2061: syntax error : identifier 'FILE'


Thanks.
IIRC the BMP format doesn't support Alpha-channel images. If your Vista install is using alpha-blending then it's likely that there's some new BMP format in use that supports RGBA mapping or something that isn't included in the SDL BMP loader.

This topic is closed to new replies.

Advertisement