Sign in to follow this  
chbrules

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

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this