home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / EN0720.ZIP / FIGURE10.C next >
Text File  |  1988-08-01  |  762b  |  22 lines

  1. VOID DrawIt (HPS hps, SHORT cxClient, SHORT cyClient)
  2.      {
  3.      POINTL aptl[2] ;
  4.      SHORT  x1, x2, y1, y2 ;
  5.  
  6.      GpiSetPattern (hps, 1L + rand() % 16) ;           // Pattern = 1 to 16
  7.      GpiSetColor (hps, (LONG) (rand() % 16)) ;         // Color = 0 to 15
  8.      GpiSetBackColor (hps, (LONG) (rand () % 16)) ;    // Background color
  9.  
  10.      x1 = rand() % cxClient ;
  11.      x2 = rand() % cxClient ;
  12.      y1 = rand() % cyClient ;
  13.      y2 = rand() % cyClient ;
  14.  
  15.      aptl[0].x = min (x1, x2) ;                        // Lower left corner
  16.      aptl[0].y = min (y1, y2) ;
  17.      aptl[1].x = max (x1, x2) ;                        // Upper right corner
  18.      aptl[1].y = max (y1, y2) ;
  19.  
  20.      GpiBitBlt (hps, NULL, 2L, aptl, ROP_PATCOPY, 0L) ;
  21.      }
  22.