home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / dos / grafik / vifs / unitsqua.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-08-13  |  1.0 KB  |  49 lines

  1. /*
  2.  *    unitsquare.c  --  unit square function for edtrans().
  3.  *
  4.  *    9 july 1989  Olle Olsson.
  5.  */
  6.  
  7. #include "edtrans.h"
  8.  
  9. void unitsquare( dp, color, menu )
  10. ifsdes *dp;        /* descriptor */
  11. int color;        /* color to use */
  12. menudescr *menu;    /* menu for edispall() */
  13. {
  14. int x0, x1, y0, y1;
  15. register area *ap = &dp -> area;
  16.  
  17. /* find the coordinates */
  18. /* (y is upside down) */
  19. x0 = MAX_COL * (0 - ap -> xlow) / ap -> xlen;
  20. x1 = MAX_COL * (1 - ap -> xlow) / ap -> xlen;
  21. y0 = MAX_ROW * (1 - (0 - ap -> ylow) / ap -> ylen);
  22. y1 = MAX_ROW * (1 - (1 - ap -> ylow) / ap -> ylen);
  23.  
  24. #ifdef UNITSQ_REDRAW
  25. /* draw the the square, then the transforms on top */
  26. gm_hide();
  27. cleardevice();
  28.  
  29. setcolor( color );
  30. setlinestyle( DOTTED_LINE, 0, NORM_WIDTH );
  31. rectangle( x0, y0, x1, y1 );
  32.  
  33. edispall( dp, menu, 0, 0 );
  34.  
  35. #else
  36. /* This will leave some debris where the transforms crosses
  37.  * the unit square, but if there is a fractal displayed it won' be erased.
  38.  */
  39.  
  40. gm_hide();
  41. setcolor( color );
  42. setlinestyle( DOTTED_LINE, 0, NORM_WIDTH );
  43. rectangle( x0, y0, x1, y1 );
  44. gm_show();
  45.  
  46. #endif
  47. }
  48.  
  49.