home *** CD-ROM | disk | FTP | other *** search
/ FreeWare Collection 2 / FreeSoftwareCollection2pd199x-jp.img / ms_dos / fmgraph / g_oarc.c < prev    next >
Text File  |  1990-06-14  |  1KB  |  68 lines

  1. #include    <stdio.h>
  2. #include    <math.h>
  3. #include    <dos.h>
  4.  
  5. struct FIXED {
  6.     unsigned    major,minor;
  7. };
  8.  
  9. struct OVALARC {
  10.     unsigned    type;
  11.     int        cx,cy,dx,nul1,nul2,dy;
  12.     struct FIXED    strd,edrd;
  13. };
  14.  
  15. extern    unsigned    char    gds_fshift;
  16. extern    unsigned    gds_wrkoff;
  17. extern    unsigned    gds_wrkseg;
  18.  
  19. int    g_oval_arc(int x,int y,int rx,int ry,double start,double end)
  20. {
  21.     union REGS    reg;
  22.     struct SREGS    seg;
  23.     double    iwork,fwork;
  24.     struct {
  25.         unsigned    len;
  26.         struct OVALARC    arc;
  27.     }    gdata;
  28.  
  29.     segread(&seg);
  30.     reg.h.ah=gds_fshift+0x0f;
  31.     reg.x.di=(unsigned)&gdata;
  32.     seg.ds=seg.ss;
  33.     gdata.len=22;
  34.     gdata.arc.type=0x4254;
  35.     gdata.arc.cx=x;
  36.     gdata.arc.cy=y;
  37.     gdata.arc.dx=rx;
  38.     gdata.arc.nul1=0;
  39.     gdata.arc.nul2=0;
  40.     gdata.arc.dy=ry;
  41.     if(start>=0){
  42.         fwork=modf(start,&iwork);
  43.         gdata.arc.strd.major=0;
  44.     }
  45.     else{
  46.         fwork=fabs(start);
  47.         fwork=modf(fwork,&iwork);
  48.         gdata.arc.strd.major=0x8000;
  49.     }
  50.     gdata.arc.strd.major+=(unsigned)iwork;
  51.     gdata.arc.strd.minor=(unsigned)(fwork*65536.0);
  52.     if(end>=0){
  53.         fwork=modf(end,&iwork);
  54.         gdata.arc.edrd.major=0;
  55.     }
  56.     else{
  57.         fwork=fabs(end);
  58.         fwork=modf(fwork,&iwork);
  59.         gdata.arc.edrd.major=0x8000;
  60.     }
  61.     gdata.arc.edrd.major+=(unsigned)iwork;
  62.     gdata.arc.edrd.minor=(unsigned)(fwork*65536.0);
  63.     reg.x.bx=gds_wrkoff;
  64.     seg.es=gds_wrkseg;
  65.     int86x(0x92,®,®,&seg);
  66.     return (int)reg.h.ah;
  67. }
  68.