home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / dos / screen / scrn02 / wzoom.c < prev    next >
Encoding:
C/C++ Source or Header  |  1987-10-27  |  2.0 KB  |  65 lines

  1. /* wzoom.c - window with zoom-in effect    like PROCOMM            */
  2. /*           This function saves the used area to a user defined     */  
  3. /*         buffer which may be restored with scrn_restore.        */
  4. /*                                    */
  5. /*    AUTHOR    Tim Spencer - Compuserve [73657,1400]            */
  6. /*    DATE    March 13, 1987                        */
  7. /*  ALTERED R. Hensel                    */
  8. /*  DATE    Noovember 27 1987           */
  9. /*  Reason  allow choice of single or double line box  */
  10.             
  11. #include "video.h"
  12.  
  13. void scrn_wzoom(left,right,top,bottom,buff,type,sc)
  14.  int left,right,top,bottom;    /* boundries */
  15.  int type;               /* single or double line */
  16.  char *buff;            /* user defined pointer to screen storage */
  17.  SCRN *sc;
  18.  {
  19.      unsigned l = left, r = right ,t = top, b = bottom;/* create work copies */
  20.                                /*  of parameters */    
  21.      int temp_cga = sc->cga_card;
  22.     
  23.      scrn_save(left,right,top,bottom,buff,sc); /* save the area to buff */
  24.      sc->cga_card = 1;    /* slow it down a little for mono & ega cards */
  25.     
  26.  
  27.      /* shrink the box until top meets bottom or left meets right */
  28.  
  29.      while (l < r-1 && t < b-1) { 
  30.     ++l;              
  31.     --r;
  32.     ++t;
  33.     --b;
  34.     }
  35.  
  36.      /* expand the parameters once to make sure none are the same */
  37.  
  38.      scrn_border(l,r,t,b,type,sc);  
  39.     l -= 1;               
  40.     r += 1;               
  41.     t -= 1;
  42.     b += 1;
  43.             
  44.     /* now keep drawing the box, blanking it's area, expanding, etc. */
  45.     /*  until any border reaches it's boundry                 */
  46.         
  47.     while (l > left && r < right && t > top && b < bottom) { 
  48.     scrn_border(l,r,t,b,type,sc);
  49.     vid_up(0,l+1,r-1,t+1,b-1,sc->attrib); /* blank the area using the  */
  50.                           /* attribute defined in sc   */
  51.     l -= 1;                          
  52.     r += 1;
  53.     t -= 1;
  54.     b += 1;
  55.     }
  56.     
  57.     /* Draw the final box and clear it's area */
  58.  
  59.      scrn_border(left,right,top,bottom,type,sc);
  60.      vid_up(0,left+1,right-1,top+1,bottom-1,sc->attrib);
  61.  
  62.      sc->cga_card = temp_cga;    /* restore original cga truth */        
  63. }
  64.  
  65.