home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Fish 1
/
GoldFishApril1994_CD1.img
/
d1xx
/
d122
/
iff2pcs
/
source
/
pzblit.c
< prev
next >
Wrap
C/C++ Source or Header
|
1987-12-31
|
1KB
|
58 lines
#include "pz.h"
/* Various bitmap/blitter routines for IFF2PCS
** Ali Ozer, Nov 1987
*/
int InitBM (bm, h, w, d)
struct BitMap *bm;
int h, w, d; /* Height, width, depth, in bits, bits, and bitplanes */
{
int cnt;
w = ((w+7) >> 3) << 3; /* We allocate upto 7 extra bits... */
for (cnt = 0; cnt < d; cnt++)
if ((bm->Planes[cnt] = (PLANEPTR) AllocRaster ((long)w, (long)h)) == NULL)
return (false);
bm->BytesPerRow = w >> 3; /* In bytes */
bm->Rows = h;
bm->Depth = d;
return (true);
}
void FreeBM (bm)
struct BitMap *bm;
{
int cnt;
long w = (bm->BytesPerRow) << 3;
long h = (bm->Rows);
for (cnt = 0; cnt < bm->Depth; cnt++)
if (bm->Planes[cnt] != NULL) FreeRaster (bm->Planes[cnt], w, h);
}
CopyFromBMToBM (srcbm, srcx, srcy, destbm, destx, desty, sizex, sizey)
struct BitMap *srcbm, *destbm;
int srcx, srcy, destx, desty, sizex, sizey;
{
/* The "c0" indicates copy; the "ff" indicates include all planes */
BltBitMap (srcbm, (long)srcx, (long)srcy,
destbm, (long)destx, (long)desty,
(long)sizex, (long)sizey, 0x00c0L, 0x00ffL, NULL);
}
XORFromBMToBM (srcbm, srcx, srcy, destbm, destx, desty, sizex, sizey)
struct BitMap *srcbm, *destbm;
int srcx, srcy, destx, desty, sizex, sizey;
{
BltBitMap (srcbm, (long)srcx, (long)srcy,
destbm, (long)destx, (long)desty,
(long)sizex, (long)sizey, 0x0060L, 0x00ffL, NULL);
}