home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / w / wgt3_ex.zip / WGT08.C < prev    next >
C/C++ Source or Header  |  1992-09-08  |  1KB  |  62 lines

  1. #include <conio.h>
  2. #include <wgt.h>
  3. /*   WORDUP Graphics Toolkit   Version 3.0
  4.      Demonstration program 8
  5.  
  6. Shows how the region fill function works with various shapes.
  7.  
  8. Note: Fill is not perfected yet!
  9. */
  10.  
  11. unsigned _stklen=64000;        // set the stack very large to handle
  12.             // any large fill operations
  13.  
  14. int x,y,col;
  15. color palette[256];
  16.  
  17.  
  18. void main(void)
  19. {
  20. vga256();        // initializes system
  21.  
  22.  
  23. for (y=1; y<64; y++)        
  24.    wsetrgb(y,y,y,y,&palette);       // sets first 64 colours to grey
  25.                     // note the use of &
  26. for (y=0; y<64; y++)
  27.    wsetrgb(y+64,y,0,0,&palette);        // next 64 to red
  28. for (y=0; y<64; y++)
  29.    wsetrgb(y+128,0,y,0,&palette);       // green
  30. for (y=0; y<64; y++)
  31.    wsetrgb(y+192,0,0,y,&palette);    // blue
  32.  
  33.    wsetrgb(1,63,63,63,&palette);       // sets color 1 to white
  34.  wsetpalette(0,255,palette);        // and finally change them
  35.                     // all at once
  36.  
  37.  
  38. wcls(0);
  39. wsetcolor(1);
  40. wcircle(160,100,50);        // try filling a circle
  41. getch();
  42. wsetcolor(40);
  43. wregionfill(160,100);
  44. wsetcolor(170);
  45. wregionfill(0,0);
  46.  
  47. getch();
  48. wcls(0);
  49. for (col=1; col<5000; col++)        // try filling 10,000 random pixels
  50.   {
  51.   wsetcolor(rand() % 255);
  52.   wputpixel(rand() % 320,rand() % 200);
  53.   }
  54. getch();
  55. wsetcolor(40);
  56. wclip(50,50,250,150);         // fill works with clipping too!
  57. wregionfill(160,100);
  58.  
  59.  
  60. getch();        // get the key
  61. textmode(C80);        // used to return to text mode
  62. }