FIBITMAP to SDL_Surface?

Discussion in 'C++' started by Erin100280, Sep 5, 2010.

  1. Erin100280

    Erin100280 New Member

    Joined:
    Sep 5, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    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.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice