Mail Archives: djgpp/1997/07/16/19:48:04
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.
- Raw text -