2-fer: File Archives (non-compressed)/Loading Images to SDL from RAM

Started by
0 comments, last by DeadXorAlive 18 years ago
Pretty much the idea I have is to create a texture filetype which is a bitmap encapsulated with some information pertaining to the specifics of the image like alpha level, x/y size, etc.. I guess it's not so much as issue of file archives as it is placing information inside a bitmap to create a new file format. But once I manage to do that, what about loading the bitmap into SDL? I'm not exactly sure how SDL reads the files, and how would I tell it to skip the header portion and start somewhere else when there's only 1 load image function (that I know of) from file?
-Conrad
Advertisement
If you want to do this (why?), I would think SDL_RWops might be what you need. Tutorial linky and another one. The add-on libraries work with SDL_RWops too, so it won't be a hassle to implement this for SDL_Image also. I haven't done anything with this myself, but my guess is that you could write a loader that parses your custom header, and create an RWops structure from the rest of the data (from the file pointer or whatever, there are some options look at the first linky), which can be fed to the sdl image loading function iirc.
EDIT: so yeah there are more image loading functions, the ones that use the RWops stuff. There aren't documented in my .chm file, maybe the wiki does and you can find something in the links I mentioned. Anyway, you could always look at the source too.

This topic is closed to new replies.

Advertisement