Mail Archives: djgpp/1997/07/16/11:48:27
From: | David Jenkins <me AT jenkinsdavid DOT demon DOT co DOT uk>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Memcpying an Allegro Bitmap to an array???
|
Date: | Wed, 16 Jul 1997 01:36:34 +0100
|
Organization: | None
|
Distribution: | world
|
Message-ID: | <vvhyGAASeBzzEw6o@jenkinsdavid.demon.co.uk>
|
NNTP-Posting-Host: | jenkinsdavid.demon.co.uk
|
MIME-Version: | 1.0
|
Lines: | 61
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
I'm trying to memcpy a Bitmap into an array, here's some source which
shows what I mean.
The full source is available at
http://www.jenkinsdavid.demon.co.uk/pschle/3dpsyc04.c
I have a butmap I'm using as a buffer 320*200.
unsigned char scr_buf[64000]; /* I set this up before the main(){} i.e
it is a global variable. */
void blur()
{
int d,
px = 160,
py = 100,
pxt = 160,
pyt = 100,
counter = 10,
sx,
sy,
cp,
low_x = 1,
low_y = 1,
max_x = 318,
max_y = 198,
col_tot,
col;
memcpy (scr_buf, buffer, 64000);
for (sx = low_x; sx < max_x; sx++) {
for (sy = low_y; sy < max_y; sy++) {
cp =sx + 320 * sy;
col_tot = scr_buf[cp-1];
col_tot += scr_buf[cp+ 1];
col_tot += scr_buf[cp-320];
col_tot += scr_buf[cp+ 320];
col = (col_tot >> 2) - 4;
if (col < 1)
col = 1;
_putpixel(buffer, sx, sy, col);
}
}
}
--
http://www.jenkinsdavid.demon.co.uk for C programmers.
David Jenkins
- Raw text -