Skip to main content
GameDev.net gamedev.net
🔒 Locked

SDL_LoadBMP

Started by Lode Jul 1, 2004 at 11:52 AM 0 replies 650+ views
Original Post
Lode
Lode
SDL_LoadBMP can be used to create an SDL surface from a BMP file. But can SDL_LoadBMP also be used to load a BMP in another type or array? Basicly I'd like to load a BMP into an array of the form char picture[width][height][3] (the [3] is for the RGB color components) and do some stuff with it, and since I'm using SDL it would be no more than normal to use SDL_LoadBMP. But I don't know how to find the width and height of the surface it creates with that BMP, and how to get the pixel values from it.
EvilSteve
EvilSteve

I don't think you could use SDL_LoadBMP to directly load the image into your structure, but you could load the BMP file into an SDL surface, and then use SDL_LockSurface and SDL_UnlockSurface to transfer the pixels from the surface into your own structure. Once loaded into an SDL surface, the width and height of the image can be obtained from surface->w and surface->h respectively.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.