Loading an SDL_Surface with raw pixel data

I’ve got a file containing raw pixel data (it’s a raw image file, 256x256,
indexed colour).

Is there an easy way of loading this into an SDL_Surface?

The way I’m currently doing it is to use the example put pixel function
from the SDL docs to put pixels on one at a time.

Is this the way it’s done, or is there some other way? SDL comes with a BMP
loader, and there’s libraries to load tiff, jpeg, and gif images, but nothing
for raw pixel data (or is there? I couldn’t find one…).–
I will not drive the principal’s car
6AD6 865A BF6E 76BB 1FC2 | www.piku.org.uk/public-key.asc
E4C4 DEEA 7D08 D511 E149 | www.piku.org.uk wnzrf at cvxh.bet.hx (rot13’d)

Hello!

I’ve got a file containing raw pixel data (it’s a raw image
file, 256x256, indexed colour).

Is there an easy way of loading this into an SDL_Surface?

How about
"SDL_CreateRGBSurfaceFrom – Create an SDL_Surface from pixel data" ? :o)

Ciao,
Eike

| Hello!
|
| > I’ve got a file containing raw pixel data (it’s a raw image
| > file, 256x256, indexed colour).
| >
| > Is there an easy way of loading this into an SDL_Surface?
|
| How about
| “SDL_CreateRGBSurfaceFrom – Create an SDL_Surface from pixel data” ? :o)
|

DUH :slight_smile:

(goes off to remember what the ‘R’ in ‘RTFM’ means…)On Mon, Feb 18, 2002 at 02:45:09PM +0100, Eike Sauer wrote:


I will not drive the principal’s car
6AD6 865A BF6E 76BB 1FC2 | www.piku.org.uk/public-key.asc
E4C4 DEEA 7D08 D511 E149 | www.piku.org.uk wnzrf at cvxh.bet.hx (rot13’d)