-
FIBITMAP to SDL_Surface?
I'm having problems converting a FIBITMAP to SDL_Surface.
heres the function:
Code:
SDL_Surface *FiBitmapToSdlSurface(FIBITMAP *fb) {
int h = FreeImage_GetHeight(fb), w = FreeImage_GetWidth(fb);
SDL_Surface* surf = SDL_CreateRGBSurfaceFrom(FreeImage_GetBits(fb),
w, h, 32, w * 3, 0xff0000, 0x00ff00, 0x0000ff, 0);
return surf;
}
It gives me a surface of the specified size, but the image is all messed up.
Help would be appreciated.
-
Have you tried using FreeImage_GetBPP(), FreeImage_GetRedMask(),
FreeImage_GetGreenMask() and FreeImage_GetBlueMask(), as recommended by the documentation of FreeImage_GetBits(), instead of hardcoded values as you appear to be doing?