home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / EMXLIB8F.ZIP / EMX / LIB / GRAPH / GVLINE.C < prev    next >
Encoding:
C/C++ Source or Header  |  1993-01-02  |  1.0 KB  |  57 lines

  1. /* gvline.c (emx+gcc) -- Copyright (c) 1987-1993 by Eberhard Mattes */
  2.  
  3. #include <stdlib.h>
  4. #include <graph.h>
  5. #define INCL_VIO
  6. #include <os2emx.h>
  7. #include "graph2.h"
  8.  
  9.  
  10. void g_vline (int x, int y0, int y1,int color)
  11. {
  12.   int f, n;
  13.   unsigned char *p;
  14.  
  15.   if (x >= _g_clipx0 && x <= _g_clipx1)
  16.     {
  17.       f = 1;
  18.       if (y0 < _g_clipy0)
  19.         {
  20.           y0 = _g_clipy0; --f; 
  21.         }
  22.       if (y1 < _g_clipy0)
  23.         {
  24.           if (f == 0)
  25.             return;
  26.           y1 = _g_clipy0;
  27.         }
  28.       f = 1;
  29.       if (y0 > _g_clipy1)
  30.         {
  31.           y0 = _g_clipy1; --f;
  32.         }
  33.       if (y1 > _g_clipy1)
  34.         {
  35.           if (f == 0)
  36.             return;
  37.           y1 = _g_clipy1;
  38.         }
  39.       if (y0 <= y1)
  40.         n = y1 - y0 + 1;
  41.       else
  42.         {
  43.           n = y0 - y1 + 1;
  44.           y0 = y1;
  45.         }
  46.       GLOCK;
  47.       p = _g_mem + x + 320 * y0;
  48.       while (n > 0)
  49.         {
  50.           *p = (unsigned char)color;
  51.           p += 320;
  52.           --n;
  53.         }
  54.       GUNLOCK;
  55.     }
  56. }
  57.