c語言程序bar,c語言程序設計報告心得體會

本文目錄一覽:

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

(0)
打賞 微信掃一掃 微信掃一掃 支付寶掃一掃 支付寶掃一掃
小藍的頭像小藍
上一篇 2024-12-15 12:41
下一篇 2024-12-15 12:41

相關推薦

  • Python程序需要編譯才能執行

    Python 被廣泛應用於數據分析、人工智能、科學計算等領域,它的靈活性和簡單易學的性質使得越來越多的人喜歡使用 Python 進行編程。然而,在 Python 中程序執行的方式不…

    編程 2025-04-29
  • python強行終止程序快捷鍵

    本文將從多個方面對python強行終止程序快捷鍵進行詳細闡述,並提供相應代碼示例。 一、Ctrl+C快捷鍵 Ctrl+C快捷鍵是在終端中經常用來強行終止運行的程序。當你在終端中運行…

    編程 2025-04-29
  • Python程序文件的拓展

    Python是一門功能豐富、易於學習、可讀性高的編程語言。Python程序文件通常以.py為文件拓展名,被廣泛應用於各種領域,包括Web開發、機器學習、科學計算等。為了更好地發揮P…

    編程 2025-04-29
  • AES加密解密算法的C語言實現

    AES(Advanced Encryption Standard)是一種對稱加密算法,可用於對數據進行加密和解密。在本篇文章中,我們將介紹C語言中如何實現AES算法,並對實現過程進…

    編程 2025-04-29
  • 學習Python對學習C語言有幫助嗎?

    Python和C語言是兩種非常受歡迎的編程語言,在程序開發中都扮演着非常重要的角色。那麼,學習Python對學習C語言有幫助嗎?答案是肯定的。在本文中,我們將從多個角度探討Pyth…

    編程 2025-04-29
  • Python購物車程序

    Python購物車程序是一款基於Python編程語言開發的程序,可以實現購物車的相關功能,包括商品的添加、購買、刪除、統計等。 一、添加商品 添加商品是購物車程序的基礎功能之一,用…

    編程 2025-04-29
  • 爬蟲是一種程序

    爬蟲是一種程序,用於自動獲取互聯網上的信息。本文將從如下多個方面對爬蟲的意義、運行方式、應用場景和技術要點等進行詳細的闡述。 一、爬蟲的意義 1、獲取信息:爬蟲可以自動獲取互聯網上…

    編程 2025-04-29
  • Python被稱為膠水語言

    Python作為一種跨平台的解釋性高級語言,最大的特點是被稱為”膠水語言”。 一、簡單易學 Python的語法簡單易學,更加人性化,這使得它成為了初學者的入…

    編程 2025-04-29
  • Vb運行程序的三種方法

    VB是一種非常實用的編程工具,它可以被用於開發各種不同的應用程序,從簡單的計算器到更複雜的商業軟件。在VB中,有許多不同的方法可以運行程序,包括編譯器、發布程序以及命令行。在本文中…

    編程 2025-04-29
  • Python一元二次方程求解程序

    本文將詳細闡述Python一元二次方程求解程序的相關知識,為讀者提供全面的程序設計思路和操作方法。 一、方程求解 首先,我們需要了解一元二次方程的求解方法。一元二次方程可以寫作: …

    編程 2025-04-29

發表回復

登錄後才能評論