From: Shawn Hargreaves Newsgroups: comp.os.msdos.djgpp Subject: Re: Memcpying an Allegro Bitmap to an array??? Date: Wed, 16 Jul 1997 19:48:12 +0100 Organization: None Distribution: world Message-ID: References: NNTP-Posting-Host: talula.demon.co.uk MIME-Version: 1.0 Lines: 22 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk David Jenkins writes: >I'm trying to memcpy a Bitmap into an array, here's some source which >shows what I mean. [snip] >memcpy (scr_buf, buffer, 64000); Assuming that 'buffer' is an Allegro bitmap, this is totally wrong! Look at the definition of the BITMAP struct in allegro.h - it starts with lots of header information, and then contains a table of pointers to the image data. The address of the bitmap object isn't the same as the location of the actual pixels. If your buffer is known to be a memory bitmap, use buffer->line[0] as your address. If it might be a sub-bitmap, you have to copy each horizontal line individually using buffer->line[0], buffer->line[1], etc. If it might be a screen bitmap things get more complicated: see the "video memory access" section in allegro.txt for details... -- 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.