home *** CD-ROM | disk | FTP | other *** search
/ FreeWare Collection 2 / FreeSoftwareCollection2pd199x-jp.img / ms_dos / fmgraph / g_paint.c < prev    next >
Text File  |  1990-06-14  |  903b  |  46 lines

  1. #include    <stdio.h>
  2. #include    <dos.h>
  3.  
  4. struct PAINT {
  5.     unsigned    type,type2;
  6.     int            px,py;
  7.     unsigned    bordrno;
  8.     unsigned    bdrcolor[10];
  9. };
  10.  
  11. extern    unsigned    char    gds_fshift;
  12. extern    unsigned    gds_wrkoff;
  13. extern    unsigned    gds_wrkseg;
  14.  
  15. int    g_paint(int x,int y,unsigned number,unsigned *color)
  16. {
  17.     union REGS    reg;
  18.     struct SREGS    seg;
  19.     struct {
  20.         unsigned    len;
  21.         struct PAINT    paintrec;
  22.     }    gdata;
  23.     int    i;
  24.  
  25.     if((number==0)||(number>10))
  26.         return -1;
  27.     segread(&seg);
  28.     reg.h.ah=gds_fshift+0x0f;
  29.     reg.x.di=(unsigned)&gdata;
  30.     seg.ds=seg.ss;
  31.     gdata.len=10+number*2;
  32.     gdata.paintrec.type=0x4148+number*2;
  33.     gdata.paintrec.type2=5;
  34.     gdata.paintrec.px=x;
  35.     gdata.paintrec.py=y;
  36.     gdata.paintrec.bordrno=number;
  37.     for(i=0; i<number; i++){
  38.         gdata.paintrec.bdrcolor[i]=*color;
  39.         color++;
  40.     }
  41.     reg.x.bx=gds_wrkoff;
  42.     seg.es=gds_wrkseg;
  43.     int86x(0x92,®,®,&seg);
  44.     return (int)reg.h.ah;
  45. }
  46.