本文目錄一覽:
C語言的畫圖函數除了bar函數外還有哪些?
與圖形有關的函數
GRAPHICS.H 庫文件
bar
【功能】畫出一條欄目。
【原型】void far bar(int left,int top,int right,int bottom)
【位置】graphics.hgraphics.h
【參見】bar3d,setfillstyle,rectangle
bar3d
【功能】畫出一條3-D欄目。
【原型】void far bar3d(int left,int top,int right,int bottom,int depth,int topflag)
【位置】graphics.h
【參見】bar
circle
【功能】以(x,y)為圓心按照指定的半徑畫出一個圓。
【原型】void far circle(int x,int y,int radius)
【位置】graphics.h
【參見】arc
cleardevice
【功能】清除圖形畫面。
【原型】void far cleardevice(void)
【位置】graphics.h
【參見】clearviewport
clearviewport
【功能】清除當前可視區域。
【原型】clearviewport(void)
【位置】graphics.h
【參見】setviewport,cleardevice
closegraph
【功能】關閉圖形系統。
【原型】void far closegraph(void)
【位置】graphics.h
【參見】initgraph
detecgraph
【功能】通過檢查硬件確定使用的圖形驅動程序和模式。
【原型】void far detectgraph(int far *graphdriver,int far *graphmode)
【位置】graphics.h
【參見】initgraph,graphresult
drawpoly
【功能】畫出一個多邊形的輪廓。
【原型】void far drawpoly(int numpoints,int far polypoints[])
【位置】graphics.h
【說明】polypoints中包括一共numpoints對數值。其中每一對都給出了多邊形中一個頂點的x和y值。
【參見】fillpoly
ellipse
【功能】畫出一條橢圓形的圓弧。
【原型】void far ellipse(int x,int y,int stangle,int endangle,int xradius,int yradius)
【位置】graphics.h
【說明】中心點在(x,y),stangle和endangle表示一角度為單位的起始角和終止角。Xradius和yradius表示水平軸和垂直軸。
【參見】arc,circle,fillellipse
fillellipose
【功能】畫出橢圓形圓弧,並填充。
【原型】void far fillllipse(int x,int y,int xradius,int yradius)
【位置】graphics.h
【說明】使用(x,y)作為中心點,然後使用當前的填充模式填充圓弧。Xradius和yradius表示水平軸和垂直軸。
【參見】arc,circle,ellipse,pieslice
fillpoly
【功能】畫出一個多邊形,並填充。
【原型】void far fillpoly(int numpoints,int far polypoints[])
【位置】graphics.h
【說明】polypoints中包含有numpoints對數值。其中每一對給出了多邊形一個頂點的x值和y值。
【參見】drawpoly,fill_patterns,floodfill,graphresult,setfillstyle
floodfill
【功能】填充一個有界區域範圍。
【原型】void far floodfill(int x,int y,int border)
【位置】graphics.h
【參見】drawpoly,fillpoly,fill_patterns,graphresult,setfillstyle
getarccoords
【功能】得到最後一次調用arc的坐標值。
【原型】void far getaerccoords(struct arccoordstype far *arccoords)
【位置】graphics.h
【參見】arc
getaspectratio
【功能】得到當前圖形模式的縱橫比。
【原型】void far getaspectratio(int far *xasp,int far *yasp)
【位置】graphics.h
【說明】are及類似函數使用縱橫比令圓圈更加圓,而不會像橢圓。Yasp應當為10000。當象素為VGA平方並且10000時,xasp使用10000數值。
【參見】arc,setaspectratio
getbkcolor
【功能】返回當前背景顏色。
【原型】int far getbkcolor(void)
【位置】graphics.h
【參見】setbkcolor,getcolor,getpalette
getcolor
【功能】返回當前畫筆的顏色。
【原型】int far getcolor(void)
【位置】graphics.h
【參見】getbkcolor,setcolor,getmaxcolor,getpalette
getdefaultpalette
【功能】返回調色板定義結構。
【原型】struct palettetype *far getdefaultpalette(void)
【位置】graphics.h
【說明】返回一個指針,指向調用initgraph初始化時,當前驅動程序的默認調色板結構。
【參見】getpalette,initgraph
getdrivername
【功能】返回一個指針,指向當前圖形驅動程序的名稱。
【原型】char *far getdrivername(void)
【位置】graphics.h
【說明】返回的指針指向標識當前驅動器程序的字符串,從而可以探測到硬件適配器。
【參見】initgraph
getfillpattern
【功能】將用戶定義的填充模式複製到內存中。
【原型】void far getfillpattern(char far *pattern)
【位置】graphics.h
【參見】getfillsettings,setfillpattern,fill_patterns
getfillsettings
【功能】得到當前填充模式及其顏色的有關信息。
【原型】void far getfillsettings(struct fillsettingstype far *fillinfo)
【位置】graphics.h
【參見】floodfill, fillpoly, setfillstyple, pieslice, setfillpattern, bar3d, bar, getfillpattern
getgraphmode
【功能】返回當前圖形模式。
【原型】int far getgraphmode(void)
【位置】graphics.h
【說明】必須先調用initgraph或者setgraphmode。
【參見】setmoderange,restorectrtmode
getimage
【功能】將制定區域的位圖保存到內存中。
【原型】void far getimage(int left,int top,int right,int bottom,void far *bitmap)
【位置】graphics.h
【參見】imagesize,putimage
因為太多了,無法一一列出。比如下面的:
putimage
putpixel
rectangle
registerbgidriver
registerbgifont
restorecrtmode
sector
setactivepage
setallpalette
setaspectratio
setbkcolor
setcolor
setfillpattern
setfillstyle
setgraphbufsize
setgraphmode
setlinestyle
setpalette
setrgbcolor
setrgbpalette
settextjustify
settextstyle
setusercharsize
setviewport
setvisualpage
setwritemode
textheight
textwidth
建議你買本專業的書籍學習查看。
C語言程序里”BAR”是什麼意思
函數名: bar
功 能: 畫一個二維條形圖
用 法: void far bar(int left, int top, int right, int bottom);
程序例:
#include
#include
#include
#include
int main(void)
{
/* request auto detection */
int gdriver = DETECT, gmode, errorcode;
int midx, midy, i;
/* initialize graphics and local variables */
initgraph(gdriver, gmode, “”);
/* read result of initialization */
errorcode = graphresult();
if (errorcode != grOk) /* an error occurred */
{
printf(“Graphics error: %s\n”, grapherrormsg(errorcode));
printf(“Press any key to halt:”);
getch();
exit(1); /* terminate with an error code */
}
midx = getmaxx() / 2;
midy = getmaxy() / 2;
/* loop through the fill patterns */
for (i=SOLID_FILL; i
{
/* set the fill style */
setfillstyle(i, getmaxcolor());
/* draw the bar */
bar(midx-50, midy-50, midx+50,
midy+50);
getch();
}
/* clean up */
closegraph();
return 0;
}
c語言的bar()函數和 rectangle()函數
bar畫一個填充矩形 填充顏色由 setfillstyle決定
rectangle畫一個空矩形框,線條顏色由setcolor決定
原創文章,作者:小藍,如若轉載,請註明出處:https://www.506064.com/zh-hant/n/256508.html