Metropoli BBS
VIEWER: wgt08.c MODE: TEXT (ASCII)
/*
==============================================================================
                      WordUp Graphics Toolkit Version 5.0 
                             Demonstration Program 8                          
                                                                              
 Shows how the region fill function works with various shapes.                
                                                                              
 *** PROJECT ***                                                             
 This program requires the file WGT5_WC.LIB to be linked.                    
                                                                              
 *** DATA FILES ***                                                          
 NONE                                                                        
                                                           WATCOM C++ VERSION 
==============================================================================
*/

#include <wgt5.h>


void main(void)
{
  short x;
  short oldmode;
  color palette[256];

  printf ("WGT Example #8\n\n");
  printf ("This program demonstrates the wregionfill command. First it will fill a\n");
  printf ("circle and the region around it. Press a key. It will then draw 10,000\n");
  printf ("random pixels and adjust the clipping. Press a key to see the fill command\n");
  printf ("work with the new clipping settings. A third keypress ends the program.\n");
  printf ("\n\nPress any key to continue.\n");
  getch ();

  if ( !vgadetected () )
  {
    printf ("Error - VGA card required for any WGT program.\n");
    exit (0);
  }

  oldmode = wgetmode ();
  vga256 ();
  wcls (0);

  wsetcolor (1);
  wcircle (160, 100, 50);          /* try filling a circle */
  getch ();

  wsetcolor (40);
  wregionfill (160, 100);
  wsetcolor (170);
  wregionfill (0, 0);

  getch();

  wcls (0);
  for (x = 1; x < 10000; x++)     /* try filling 10,000 random pixels */
  {
    wsetcolor (rand () % 255);
    wputpixel (rand () % 320, rand() % 200);
  }
  getch ();
  wsetcolor (40);
  wclip (50, 50, 250, 150);          /* fill works with clipping too! */
  wregionfill (160, 100);

  wsetcolor (7);
  wclip (10, 10, 40, 40);
  wregionfill (20, 20);

  wsetcolor (9);
  wclip (260, 160, 300, 190);
  wregionfill (270, 170);

  wsetcolor (10);
  wclip (0, 0, 319, 199);
  wregionfill (0, 0);

  getch ();
  wsetmode (oldmode);
}
[ RETURN TO DIRECTORY ]