delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/25/21:50:23

From: Chris Frolik <frolikcc AT indy DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Allegro -- direct copying of RLE sprites
Date: Fri, 22 Aug 1997 01:46:37 -0500
Organization: IndyNet - Indys Internet Gateway (info AT indy DOT net)
Lines: 28
Message-ID: <33FD35CD.33DC@indy.net>
NNTP-Posting-Host: ip91-127.ts.indy.net
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Is there a fast and easy way to copy RLE sprites?  If anyone has written
a function to do this, I'd appreciate some help.  The way I am using now
is slow and tedious.  For example:

/* copy_rle_sprite(sprite) -- returns a copy of sprite.  This does more
 * than just copy the pointers -- it copies the data they point to.
 */

RLE_SPRITE *copy_rle_sprite(RLE_SPRITE *sprite)
{
   RLE_SPRITE *new_sprite;
   BITMAP *temp = create_bitmap(sprite->w, sprite->h);
   if (!temp) return NULL;

   clear(temp);
   draw_rle_sprite(temp, sprite, 0, 0);

   new_sprite = get_rle_sprite(temp);
   destroy_bitmap(temp);
   return new_sprite;
}

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?

Thanks,
-Chris

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019