1 /**
2  ** generic/bitmap.c ---- generic (=slow) font or bitmap draw routine
3  **
4  ** Copyright (c) 1995 Csaba Biegl, 820 Stirrup Dr, Nashville, TN 37221
5  ** [e-mail: csaba@vuse.vanderbilt.edu].
6  **
7  ** This file is part of the GRX graphics library.
8  **
9  ** The GRX graphics library is free software; you can redistribute it
10  ** and/or modify it under some conditions; see the "copying.grx" file
11  ** for details.
12  **
13  ** This library is distributed in the hope that it will be useful,
14  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
15  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  **
17  **/
18 
drawbitmap(int x,int y,int w,int h,char far * bmp,int pitch,int start,GrColor fg,GrColor bg)19 void drawbitmap(int x,int y,int w,int h,
20 		char far *bmp,int pitch,int start,GrColor fg,GrColor bg)
21 {
22 	GRX_ENTER();
23 	w += x; h += y;
24 	bmp += (unsigned int)start >> 3;
25 	start &= 7;
26 	do {
27 	    unsigned char far *bitp = (unsigned char far *)bmp;
28 	    unsigned char bits = *bitp;
29 	    unsigned char mask = 0x80 >> start;
30 	    int   xx = x;
31 	    do {
32 		drawpixel(xx,y,(bits & mask) ? fg : bg);
33 		if((mask >>= 1) == 0) bits = *++bitp,mask = 0x80;
34 	    } while(++xx != w);
35 	    bmp += pitch;
36 	} while(++y != h);
37 	GRX_LEAVE();
38 }
39 
40