Sign in to follow this  
Lode

SDL_Image and buffers

Recommended Posts

Lode    1003
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
Foot Soldier    124
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
Drew_Benton    1861
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

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