From: Shawn Hargreaves Newsgroups: comp.os.msdos.djgpp Subject: Re: Allegro -- direct copying of RLE sprites Date: Fri, 22 Aug 1997 20:38:24 +0100 Organization: None Distribution: world Message-ID: <7Lu9GEAwqe$zEwqW@talula.demon.co.uk> References: <33FD35CD DOT 33DC AT indy DOT net> NNTP-Posting-Host: talula.demon.co.uk MIME-Version: 1.0 Lines: 29 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Chris Frolik writes: >Is there a fast and easy way to copy RLE sprites? If anyone has written [...] >I know this method of creating a bitmap is disgusting and slow. Is >there a faster way to avoid the "middle-man" and just copy from one >RLE_SPRITE to another? There is, but it is also not very elegant. If you look at the definition of the RLE_SPRITE structure in allegro.h you will see that it is: typedef struct RLE_SPRITE /* a RLE compressed sprite */ { int w, h; /* width and height in pixels */ int color_depth; /* color depth of the image */ int size; /* size of sprite data in bytes */ signed char dat[0]; /* RLE bitmap data */ } RLE_SPRITE; Since it is just a single block of binary data, you can compute the size as sizeof(RLE_SPRITE)+sprite->size. Then just malloc that much memory for your new sprite, and memcpy() from the old image to the new... But I have to ask, why do you need to copy these sprites? I find it very hard to imagine why that would be useful... -- Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/ Beauty is a French phonetic corruption of a short cloth neck ornament.