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

  1. /* vputmask.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 "video2.h"
  9.  
  10. void v_putmask (const char *src, const char *mask, int x, int y, int count)
  11. {
  12.   int i, off;
  13.   char *dst;
  14.  
  15.   if (_v_mem != NULL)
  16.     {
  17.       off = (y * _v_width + x) * 2;
  18.       dst = _v_mem + off;
  19.       for (i = 0; i < count; ++i)
  20.         {
  21.           if (*mask++)
  22.             {
  23.               dst[0] = src[0];
  24.               dst[1] = src[1];
  25.             }
  26.           dst += 2; src += 2;
  27.         }
  28.       if (_osmode == OS2_MODE)
  29.         VioShowBuf (off, count * 2, 0);
  30.     }
  31.   else if (_osmode == OS2_MODE)
  32.     for (i = 0; i < count; ++i)
  33.       {
  34.         if (*mask++)
  35.           VioWrtNCell (src, 1, y, x+i, 0);
  36.         src += 2;
  37.       }
  38.   else
  39.     {
  40.       union REGS r;
  41.  
  42.       for (i = 0; i < count; ++i)
  43.         {
  44.           if (*mask++)
  45.             {
  46.               r.h.ah = 0x02;
  47.               r.h.bh = 0;
  48.               r.h.dl = x + i;
  49.               r.h.dh = y;
  50.               _int86 (0x10, &r, &r);
  51.               r.h.ah = 0x09;
  52.               r.h.bh = 0;
  53.               r.h.al = src[0];
  54.               r.h.bl = src[1];
  55.               r.x.cx = 1;
  56.               _int86 (0x10, &r, &r);
  57.               
  58.             }
  59.           src += 2;
  60.         }
  61.       r.h.ah = 0x02;
  62.       r.h.bh = 0;
  63.       r.h.dl = (unsigned char)_v_x;
  64.       r.h.dh = (unsigned char)_v_y;
  65.       _int86 (0x10, &r, &r);
  66.     }
  67. }
  68.