C语言函数—getaspectratio

函数名

getarccoords

功 能

取得最后一次调用arc的坐标

用 法

void far getarccoords(struct arccoordstype far *arccoords);

程序例

#include <graphics.h> 
#include <stdlib.h> 
#include <stdio.h> 
#include <conio.h> 

int main(void) 
{ 
/* request auto detection */ 
   int gdriver = DETECT, gmode, errorcode; 
   struct arccoordstype arcinfo; 
   int midx, midy; 
   int stangle = 45, endangle = 270; 
   char sstr[80], estr[80]; 

/* initialize graphics and local variables */ 
   initgraph(&gdriver, &gmode, ""); 

/* read result of initialization */ 
   errorcode = graphresult(); 
/* an error occurred */ 
   if (errorcode != grOk) 
   { 
      printf("Graphics error: %sn", 
             grapherrormsg(errorcode)); 
      printf("Press any key to halt:"); 
      getch(); 
/* terminate with an error code */ 
      exit(1); 
   } 

   midx = getmaxx() / 2; 
   midy = getmaxy() / 2; 

/* draw arc and get coordinates */ 
   setcolor(getmaxcolor()); 
   arc(midx, midy, stangle, endangle, 100); 
   getarccoords(&arcinfo); 

/* convert arc information into strings */ 
   sprintf(sstr, "*- (%d, %d)", 
           arcinfo.xstart, arcinfo.ystart); 
   sprintf(estr, "*- (%d, %d)", 
           arcinfo.xend, arcinfo.yend); 

   /* output the arc information */ 
   outtextxy(arcinfo.xstart, 
             arcinfo.ystart, sstr); 
   outtextxy(arcinfo.xend, 
             arcinfo.yend, estr); 

   /* clean up */ 
   getch(); 
   closegraph(); 
   return 0; 
} 
  
  
  

如果引用本站的原创文章,请注明原文链接:,本站保留追究责任的权利!
评论已关闭。