[SDL] Loading pure RLE ( not Bitmap ) Image...
David Olofson
david at olofson.net
Wed Jun 15 16:40:44 PDT 2005
On Thursday 16 June 2005 00.56, Dominique Louis wrote:
> I have some image data that is already RLE encoded, but contains no
> Bitmap headers, so essentially raw RLE. Is there an easy way to load
> this data using SDL?
RLE (Run-Length Encoding) is a vague term, and can be pretty much
anything that's based on the general idea of encoding sequences of
identical (or even similar) objects in some way, for speed and/or
space.
That said, there is a (relatively) easy way:
1. Create a surface (SDL_CreateRGBSurface()) with a fixed,
known pixel format; 24 bit RGB, 32 bit RGBA or whatever.
2. Hack your own decoder that loads the file into a buffer
and decodes it into the 'pixels' array of the surface.
3. Use SDL_ConvertSurface(), SDL_DisplayFormat() or
whatever you need, to convert the surface to a suitable
pixel format for your application - if you need to
convert it at all. (Usually not really necessary unless
speed is critical. SDL converts on-the-fly as needed.)
//David Olofson - Programmer, Composer, Open Source Advocate
.- Audiality -----------------------------------------------.
| Free/Open Source audio engine for games and multimedia. |
| MIDI, modular synthesis, real time effects, scripting,... |
`-----------------------------------> http://audiality.org -'
--- http://olofson.net --- http://www.reologica.se ---
More information about the SDL
mailing list