home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_200 / 287_03 / vhline.c < prev    next >
Text File  |  1989-05-25  |  2KB  |  58 lines

  1. #include <stdio.h>
  2. #include <gds.h>
  3.  
  4. #define VOIDBLOCK 1
  5.  
  6. /*==============================================================*
  7.  *  This file contains the following routines:                  *
  8.  *                                                              *
  9.  *      Dot(x,y) :-                                             *
  10.  *              Writing a single dot to a frame                 *
  11.  *                                                              *
  12.  *      HorzLine(x,y,length,width)                              *
  13.  *              Drawing a horizontal line starting at (x,y)     *
  14.  *              with length and width in the positive direction *
  15.  *              of x and y respectively.                        *
  16.  *                                                              *
  17.  *      VertLine(x,y,length,width)                              *
  18.  *              Drawing a vertical line starting at (x,y)       *
  19.  *              with length and width in the positive direction *
  20.  *              of y and x respectively                         *
  21.  *                                                              *
  22.  *==============================================================*/
  23.  
  24.  
  25. Dot(x,y)
  26. int x,y;
  27. {
  28.     x += ORGX; 
  29.     y += ORGY;
  30.     if (inside(x,y)) plot(x,y); /* plot if the dot is within the window */
  31. }
  32.  
  33. HorzLine(x,y,length,width)
  34. int x,y,length,width;
  35. {
  36.     if ((length<=0) || (width <= 0)) return; /* width must be positive */
  37.     x += ORGX;              /* get absolute position */
  38.     y += ORGY;
  39.  
  40.     if (blockclip(&x, &y, &length, &width)==VOIDBLOCK) return;
  41.     do {
  42.         horzl(x,y++,length); /* draw a line with width 1 each time */
  43.     } 
  44.     while (--width);
  45. }
  46.  
  47. VertLine(x,y,length,width)
  48. int x,y,length,width;
  49. {
  50.     if ((length<=0) || (width <= 0)) return; /* width must be positive */
  51.     x += ORGX;              /* get absolute position */
  52.     y += ORGY;
  53.  
  54.     if (blockclip(&x, &y, &width, &length)==VOIDBLOCK) return;
  55.     vertl(x,y,length,width);
  56. }
  57.  
  58.