Jump to content
  • Advertisement
Sign in to follow this  
chbrules

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

This topic is 4443 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!