home *** CD-ROM | disk | FTP | other *** search
- /**
- ** COLOROPS.C
- **
- ** Copyright (C) 1992, Csaba Biegl
- ** 820 Stirrup Dr, Nashville, TN, 37221
- ** csaba@vuse.vanderbilt.edu
- **
- ** This file is distributed under the terms listed in the document
- ** "copying.cb", available from the author at the address above.
- ** A copy of "copying.cb" should accompany this file; if not, a copy
- ** should be available from where this file was obtained. This file
- ** may not be distributed without a verbatim copy of "copying.cb".
- ** You should also have received a copy of the GNU General Public
- ** License along with this program (it is in the file "copying");
- ** if not, write to the Free Software Foundation, Inc., 675 Mass Ave,
- ** Cambridge, MA 02139, USA.
- **
- ** This program is distributed in the hope that it will be useful,
- ** but WITHOUT ANY WARRANTY; without even the implied warranty of
- ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- ** GNU General Public License for more details.
- **/
-
-
- #include "test.h"
-
- TESTFUNC(colorops)
- {
- int x = GrSizeX();
- int y = GrSizeY();
- int ww = (x * 2) / 3;
- int wh = (y * 2) / 3;
- int c,ii,jj,bg;
- GrFBoxColors bcolors,ocolors,icolors;
- int wdt = ww / 150;
- int bw = x / 16;
- int bh = y / 16;
- int bx,by;
-
- GrSetRGBcolorMode();
-
- bcolors.fbx_intcolor = GrAllocColor(160,100,30);
- bcolors.fbx_topcolor = GrAllocColor(240,150,45);
- bcolors.fbx_leftcolor = GrAllocColor(240,150,45);
- bcolors.fbx_rightcolor = GrAllocColor(80,50,15);
- bcolors.fbx_bottomcolor = GrAllocColor(80,50,15);
-
- ocolors.fbx_intcolor = GrAllocColor(0,120,100);
- ocolors.fbx_topcolor = GrAllocColor(0,180,150);
- ocolors.fbx_leftcolor = GrAllocColor(0,180,150);
- ocolors.fbx_rightcolor = GrAllocColor(0,90,60);
- ocolors.fbx_bottomcolor = GrAllocColor(0,90,60);
-
- icolors.fbx_intcolor = GrAllocColor(30,30,30);
- icolors.fbx_bottomcolor = GrAllocColor(0,180,150);
- icolors.fbx_rightcolor = GrAllocColor(0,180,150);
- icolors.fbx_leftcolor = GrAllocColor(0,90,60);
- icolors.fbx_topcolor = GrAllocColor(0,90,60);
-
- c = GrAllocColor(250,250,0);
- bg = GrNOCOLOR;
-
- for(ii = 0,by = -(bh / 3); ii < 17; ii++) {
- for(jj = 0,bx = (-bw / 2); jj < 17; jj++) {
- GrFramedBox(bx+2*wdt,by+2*wdt,bx+bw-2*wdt-1,by+bh-2*wdt-1,2*wdt,&bcolors);
- bx += bw;
- }
- by += bh;
- }
-
- GrFramedBox(ww/4-5*wdt-1,wh/4-5*wdt-1,ww/4+5*wdt+ww+1,wh/4+5*wdt+wh+1,wdt,&ocolors);
- GrFramedBox(ww/4-1,wh/4-1,ww/4+ww+1,wh/4+wh+1,wdt,&icolors);
-
- GrSetClipBox(ww/4,wh/4,ww/4+ww,wh/4+wh);
-
- drawing(ww/4,wh/4,ww,wh,c,bg);
- while(!kbhit()) {
- drawing(ww/4+(random()%100),
- wh/4+(random()%100),
- ww,
- wh,
- ((random() / 16) & (GrNumColors() - 1)),
- bg
- );
- }
- getkey();
- GrFramedBox(ww/4-1,wh/4-1,ww/4+ww+1,wh/4+wh+1,wdt,&icolors);
- drawing(ww/4,wh/4,ww,wh,c,bg);
- while(!kbhit()) {
- drawing(ww/4+(random()%100),
- wh/4+(random()%100),
- ww,
- wh,
- ((random() / 16) & (GrNumColors() - 1)) | GrXOR,
- bg
- );
- }
- getkey();
- GrFramedBox(ww/4-1,wh/4-1,ww/4+ww+1,wh/4+wh+1,wdt,&icolors);
- drawing(ww/4,wh/4,ww,wh,c,bg);
- while(!kbhit()) {
- drawing(ww/4+(random()%100),
- wh/4+(random()%100),
- ww,
- wh,
- ((random() / 16) & (GrNumColors() - 1)) | GrOR,
- bg
- );
- }
- getkey();
- GrFramedBox(ww/4-1,wh/4-1,ww/4+ww+1,wh/4+wh+1,wdt,&icolors);
- drawing(ww/4,wh/4,ww,wh,c,bg);
- while(!kbhit()) {
- drawing(ww/4+(random()%100),
- wh/4+(random()%100),
- ww,
- wh,
- ((random() / 16) & (GrNumColors() - 1)) | GrAND,
- bg
- );
- }
- getkey();
-
- }
-