delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/07/16/19:48:04

From: Shawn Hargreaves <Shawn AT talula DOT demon DOT co DOT uk>
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: <KE1B1eAsdRzzEwcD@talula.demon.co.uk>
References: <vvhyGAASeBzzEw6o AT jenkinsdavid DOT demon DOT co DOT uk>
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

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 -


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