I am trying to load images into SDL from files which I compress and decompress and check for integrity an load by hand etc. myself, so I can''t just use a standard SDL_LoadBMP("blah.bmp");. Anyone know how I would do this?
"There is no dark side of the moon really,
As a matter of fact, its all dark."
SDL Image Loading
www.wotsit.org
You should be able to find the specs for the .bmp format there. Just load all the .bmp info into a dynamically allocated SDL_Surface, and return a pointer to it. (I think )
[edited by - Xanth on January 18, 2003 12:47:37 PM]
You should be able to find the specs for the .bmp format there. Just load all the .bmp info into a dynamically allocated SDL_Surface, and return a pointer to it. (I think )
[edited by - Xanth on January 18, 2003 12:47:37 PM]
Yes. You must implement a SDL_RWops structure. This structure holds your custom functions for reading or writing data from a storage place (which doesn''t need to be a file). Then use SDL_LoadBMP_RW to load the bitmap using your custom compression algorithms.
Note that if you implement the SDL_RWops thing, you can load all kind of images using the SDL_Image library which is SDL_RWops compatible. This means you can use the same compression algorithm to compress bmp files or tga files or whatever, and the loading is still handled by SDL_image.
Note that if you implement the SDL_RWops thing, you can load all kind of images using the SDL_Image library which is SDL_RWops compatible. This means you can use the same compression algorithm to compress bmp files or tga files or whatever, and the loading is still handled by SDL_image.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement