home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_300 / 328_01 / wframe.c < prev   
C/C++ Source or Header  |  1991-03-17  |  1KB  |  62 lines

  1. /*! wframe
  2.  *
  3.  *
  4.  *    draw a  box on the screen using direct video RAM access
  5.  *
  6.  */
  7. #include  "wsys.h"
  8.  
  9.  
  10.  
  11. void wframe (    int left, int top, int right, int bottom,
  12.         int boxtype, unsigned char box_attr)
  13.     {
  14.     int     x,y;
  15.     struct WBOX_PATTERN  box;
  16.     
  17.     /* copy the box to local memory, 
  18.      * so it can be accessed without using index methods
  19.      * and faster in LARGE model.
  20.      */
  21.     box = wbox[boxtype];
  22.     
  23.  
  24.     /* draw top of box */
  25.     wputcabs ( left, top, box.nw, box_attr, WGOVERWRITE );
  26.     for ( x = left+1; x <right; ++x )
  27.         {
  28.         wputcabs ( x, top, box.horiz, box_attr,
  29.             WGOVERWRITE );
  30.         }
  31.     wputcabs ( right, top,  box.ne, box_attr, WGOVERWRITE );
  32.  
  33.     /* draw lines with vertical edge borders and clear centers */
  34.     for ( y = top+1; y < bottom; ++y )
  35.         {
  36.         /* one loop iteration per horizontal line */
  37.  
  38.         /* draw left hand edge of box */
  39.         wputcabs ( left, y, box.vert, box_attr, WGOVERWRITE );
  40.  
  41.         /* draw right-hand edge of box */
  42.         wputcabs ( right, y, box.vert, box_attr, WGOVERWRITE);
  43.         } /*end of loop to draw lines with vertical edges */
  44.  
  45.  
  46.     /*  draw bottom edge of box */
  47.     wputcabs ( left, bottom, box.sw, box_attr, WGOVERWRITE );
  48.     for ( x = left+1; x <right; ++x )
  49.         {
  50.         wputcabs ( x, bottom, box.horiz, box_attr,
  51.             WGOVERWRITE );
  52.         }
  53.     wputcabs ( right, bottom, box.se, box_attr, WGOVERWRITE );
  54.  
  55.  
  56.  
  57.  
  58.  
  59. return;  /* end of wframe  */
  60. }
  61.  
  62.