Jump to content
  • Advertisement
Sign in to follow this  
Lode

SDL_Image and buffers

This topic is 4812 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

I know how to use SDL_Image to load images from a file of the HD. Is it also possible to use it to load png images not from a file, but from a buffer? I want to make my own file format namely, in which I store different png images and other information at once, so I can't use SDL_Image to load that file directly, I have to load it myself and put the separate png's in different buffers. How to use SDL_Imge to load images from such buffers? Thanks.

Share this post


Link to post
Share on other sites
Advertisement
I made an image file format, and here is the function that made it easy:

http://sdldoc.csn.ul.ie/sdlcreatergbsurfacefrom.php

It created an SDL_Surface based on a pointer and stuff. I don't know much about PNG, but it is has vertical byte alignment, be sure to strip that out.

Share this post


Link to post
Share on other sites
Quote:
Original post by Foot Soldier
I made an image file format, and here is the function that made it easy:

SDL_CreateRGBSurfaceFrom


That is the first time I've seen someone actually use that instead of RWops [smile] Very creative, I will have to give that a try myself now.

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!