1 /**
2  ** DRAWING.H ---- a stupid little drawing used all over in test programs
3  **
4  ** Copyright (c) 1995 Csaba Biegl, 820 Stirrup Dr, Nashville, TN 37221
5  ** [e-mail: csaba@vuse.vanderbilt.edu] See "doc/copying.cb" for details.
6  **/
7 
8 #include "rand.h"
9 
drawing(int xpos,int ypos,int xsize,int ysize,long fg,long bg)10 void drawing(int xpos,int ypos,int xsize,int ysize,long fg,long bg)
11 {
12 #   define XP(x)   (int)((((long)(x) * (long)xsize) / 100L) + xpos)
13 #   define YP(y)   (int)((((long)(y) * (long)ysize) / 100L) + ypos)
14 	int ii;
15 	if(bg != GrNOCOLOR) {
16 		GrFilledBox(xpos,ypos,xpos+xsize-1,ypos+ysize-1,bg);
17 	}
18 	GrLine(XP(10),YP(10),XP(40),YP(40),fg);
19 	GrLine(XP(40),YP(10),XP(10),YP(40),fg);
20 	GrLine(XP(35),YP(10),XP(65),YP(40),fg);
21 	GrLine(XP(35),YP(40),XP(65),YP(10),fg);
22 	GrLine(XP(70),YP(10),XP(90),YP(40),fg);
23 	GrLine(XP(70),YP(40),XP(90),YP(10),fg);
24 	for(ii = 0; ii < 5; ii++) {
25 		GrBox(XP(70+2*ii),YP(10+3*ii),XP(90-2*ii),YP(40-3*ii),fg);
26 	}
27 	GrFilledBox(XP(10),YP(50),XP(60),YP(90),fg);
28 	GrBox(XP(70),YP(50),XP(90),YP(90),fg);
29 	for(ii = 0; ii < 100; ii++) {
30 		GrPlot(XP((RND() % 20U) + 70),YP((RND() % 40U) + 50),fg);
31 	}
32 }
33 
34 #undef XP
35 #undef YP
36 
37