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

  1. /* winmgr2.c (emx+gcc) -- Copyright (c) 1987-1993 by Eberhard Mattes */
  2.  
  3. #include <stdlib.h>
  4. #include <dos.h>
  5. #define INCL_VIO
  6. #include <os2emx.h>
  7. #include <sys/video.h>
  8. #include <sys/winmgr.h>
  9. #include "winmgr2.h"
  10.  
  11. void _wm_copy2 (char *mask, char *dst, char *src, int width)
  12. {
  13.   while (width-- > 0)
  14.     {
  15.       if (*mask++)
  16.         {
  17.           *dst++ = *src++;
  18.           *dst++ = *src++;
  19.         }
  20.       else
  21.         {
  22.           dst += 2; src += 2;
  23.         }
  24.     }
  25. }
  26.  
  27.  
  28.  
  29. void _wm_clrline2 (char *dst, int width, char a)
  30. {
  31.   while (width-- > 0)
  32.     {
  33.       *dst++ = ' ';
  34.       *dst++ = a;
  35.     }
  36. }
  37.  
  38.  
  39.  
  40. void _wm_line2 (char *mask, char *data, int y, int x0, int x1)
  41. {
  42.   if (y >= 0 && y < _wm_height)
  43.     {
  44.       if (x0 < 0)
  45.         {
  46.           mask -= x0;
  47.           data -= 2*x0;
  48.           x0 = 0;
  49.         }
  50.       if (x1 >= _wm_width)
  51.         x1 = _wm_width-1;
  52.       v_putmask (data, mask, x0, y, 1 + x1 - x0);
  53.     }
  54. }
  55.  
  56.  
  57.  
  58. void _wm_move2 (char *data, int y, int x0, int x1, int dir)
  59. {
  60.   if (y >= 0 && y < _wm_height)
  61.     {
  62.       if (x0 < 0)
  63.         {
  64.           data -= 2 * x0;
  65.           x0 = 0;
  66.         }
  67.       if (x1 >= _wm_width)
  68.         x1 = _wm_width-1;
  69.       if (dir)
  70.         v_putline (data, x0, y, 1 + x1 - x0);
  71.       else
  72.         v_getline (data, x0, y, 1 + x1 - x0);
  73.     }
  74. }
  75.  
  76.  
  77. void _wm_putc2 (char c, int x, int y, int a)
  78. {
  79.   if (x >= 0 && x < _wm_width && y >= 0 && y < _wm_height)
  80.     {
  81.       v_gotoxy (x, y);
  82.       v_attrib (a);
  83.       v_putn (c, 1);
  84.     }
  85. }
  86.  
  87.  
  88. void _wm_puts2 (char *dst, const char *src, int cnt, int a)
  89. {
  90.   while (cnt > 0)
  91.     {
  92.       *dst++ = *src++;
  93.       *dst++ = (char)a;
  94.       --cnt;
  95.     }
  96. }
  97.  
  98.  
  99. void _wm_putsa2 (char *dst, const char *src, int cnt)
  100. {
  101.   memcpy (dst, src, 2*cnt);
  102. }
  103.  
  104.  
  105. void _wm_puta2 (char *dst, int a, int cnt)
  106. {
  107.   ++dst;
  108.   while (cnt > 0)
  109.     {
  110.       *dst = (char)a;
  111.       dst += 2;
  112.       --cnt;
  113.     }
  114. }
  115.