-
graphics.h
鎖定
- 外文名
- graphics.h
- getaspectr
- 獲取縱橫比函數
- 優 點
- 簡單、高效
graphics.h函數列表
像素函數
- putpixel()畫像素點函數
- getpixel()返回像素色函數
線型函數
- line() 畫線函數
- lineto() 畫線函數
- linerel() 相對畫線函數
- setlinestyle() 設置線型函數
- getlinesettings() 獲取線型設置函數
- setwritemode() 設置畫線模式函數
多邊形函數
- rectangle()畫矩形函數
- bar() 畫條函數
- bar3d() 畫條塊函數
- drawpoly() 畫多邊形函數
曲線函數
- getaspectratio()獲取縱橫比函數
- circle()畫圓函數
- arc() 畫圓弧函數
- ellipse()畫橢圓弧函數
- fillellipse() 畫橢圓區函數
- pieslice() 畫扇區函數
- sector() 畫橢圓扇區函數
- getarccoords()獲取圓弧座標函數
填充函數
- setfillstyle() 設置填充圖樣和顏色函數
- setfillpattern() 設置用户圖樣函數
- floodfill() 填充閉域函數
- fillpoly() 填充多邊形函數
- getfillsettings() 獲取填充設置函數
- getfillpattern() 獲取用户圖樣設置函數
圖像函數
- imagesize() 圖像存儲大小函數
- getimage() 保存圖像函數
- putimage() 輸出圖像函數
對許多圖形應用程序,直線和曲線是非常有用的。但對有些圖形只能靠操作單個像素才能畫出。當然如果沒有畫像素的功能,就無法操作直線和曲線的函數。而且通過大規模使用像素功能,整個圖形就可以保存、寫、擦除和與屏幕上的原有圖形進行疊加。
graphics.h像素函數
- 畫像素點函數
功能:函數putpixel() 在圖形模式下屏幕上畫一個像素點。
用法:函數調用方式為void putpixel(int x,int y,int color);
説明:參數x,y為像素點的座標,color是該像素點的顏色,它可以是顏色符號名,也可以是整型色彩值。
此函數相應的頭文件是graphics.h
返回值:無
例:在屏幕上(6,8)處畫一個紅色像素點:
putpixel(6,8,RED);
- 返回像素函數
功能:函數getpixel()返回像素點顏色值。
用法:該函數調用方式為int getpixel(int x,int y);
説明:參數x,y為像素點座標。
函數的返回值可以不反映實際彩色值,這取決於調色板的設置情況(參見setpalette()函數)。
這個函數相應的頭文件為graphics.h
返回值:返回一個像素點色彩值。
例:把屏幕上(8,6)點的像素顏色值賦給變量color。
int color = getpixel(8,6);
graphics.h線型函數
有三個畫直線的函數,即line(),lineto(),linerel()。這些直線使用整型座標,並相對於當前圖形視口,但不一定受視口限制,如果視口裁剪標誌clip為真,那麼直線將受到視口邊緣截斷;如果clip為假,即使終點座標或新的當前位置在圖形視口或屏幕極限之外,直線截斷到屏幕極限。
有兩種線寬及幾種線型可供選擇,也可以自己定義線圖樣。下面分別介紹直線和線型函數。
- 畫線函數
第一類:
功能:函數line()使用當前繪圖色、線型及線寬,在給定的兩點間畫一直線。
用法:該函數調用方式為void line(int startx,int starty,int endx,int endy);
説明:參數startx,starty為起點座標,endx,endy為終點座標,函數調用前後,圖形狀態下屏幕光標(一般不可見)當前位置不改變。
此函數相應的頭文件為graphics.h
返回值:無
例:見函數60.linerel()中的實例。
第二類:
功能:函數lineto()使用當前繪圖色、線型及線寬,從當前位置畫一直線到指定位置。
用法:此函數調用方式為void lineto(int x,int y);
説明:參數x,y為指定點的座標,函數調用後,當前位置改變到指定點(x,y)。
該函數對應的頭文件為graphics.h
返回值:無
例: 見函數60.linerel()中的實例。
- 相對畫線函數
功能:函數linerel() 使用當前繪圖色、線型及線寬,從當前位置開始,按指定的水平和垂直偏移距離畫一直線。
用法:這個函數調用方式為voidlinerel(int dx,int dy);
説明:參數dx,dy分別是水平偏移距離和垂直偏移距離。
函數調用後,當前位置變為增加偏移距離後的位置,例如,原來的位置是(8,6),調用函數linerel(10,18)後,當前位置為(18,24)。
返回值:無
例:下面的程序為畫線函數調用實例:
#include <graphics.h> void main() { int driver,mode; driver=DETECT; mode=0; initgraph(&driver,&mode,""); setcolor(15); line(66,66,88,88); lineto(100,100); linerel(36,64); getch(); restorecrtmode(); }
- 設置線型函數
功能:setlinestyle() 為畫線函數設置當前線型,包括線型、線圖樣和線寬。
用法:setlinestyle()函數調用方式為void setlinestyle(int stly,unsigned pattern,int wigth);
説明:參數style為線型取值,也可以用相應名稱表示,如表1-10中所示。
參數pattern用於自定義線圖樣,它是16位(bit)字,只有當style=USERBIT_LINE(值為1)時,pattern的值才有意義,使用用户自定義線圖樣,與圖樣中“1”位對應的像素顯示,因此,pattern=0xFFFF,則畫實線;pattern=0x9999,則畫每隔兩個像素交替顯示的虛線,如果要畫長虛線,那麼pattern的值可為0xFF00和0xF00F,當style不為USERBIT_LINE值時,雖然pattern的值不起作用,但仍須為它提供一個值,一般取為0。
參數wigth用來設定線寬,其取值見表1-11,表中給出了兩個值,即1和3,實際上,線寬取值為2也是可以接受的。
若用非法參數調用setlinestyle()函數,那麼graphresult()會返回錯誤代碼,並且當前線型繼續有效。
Turbo C提供的線型與線寬定義在頭文件graphics.h中,表1-10和1-11分別列出了參數的取值與含義。
表1-10 線型
名稱 | 取值 | 含義 |
SOLID_LINE | 0 | 實線 |
DOTTED_LINE | 1 | 點線 |
CENTER_LINE | 2 | 中心線 |
DASHED_LINE | 3 | 虛線 |
USERBIT_LINE | 4 | 用户自定義線型 |
表1-11 線寬
名 稱 | 取 值 | 説 明 |
NORM_WIDTH(常寬) | 1 | 一個像素寬(缺省值) |
THICK_WIDTH(加寬) | 3 | 三個像素寬 |
這個函數的頭文件是graphics.h
返回值:無
例:下面的程序顯示了TC中所提供的線型圖樣:
#include <graphics.h> void main() { int driver,mode;i; driver=DETECT; mode=0; initgraph(&driver,&mode,""); for(i=0;i<4;i++) { setlinestyle(i,0,1); line(i*50,200,i*50+60,200) ; } getch(); restorecrtmode(); }
- 獲取線型設置
功能:函數getlinesettings() 用當前設置的線型、線圖樣和線寬填 寫linesettingstype型結構。
用法:函數調用方式為voidgetlinesettings(struct linesettingstype *info);
説明:此函數調用執行後,當前的線型、線圖樣和線寬值被裝入info指向的結構體裏,從而可從該結構體中獲得線型設置。
linesettingstype結構體定義如下:
struct linesettingstype { int linestyle; unsigned upattern; int thickness; };
其中linestyle用於存放線型,線型值為表1-10中的各值之一。
upattern用為裝入用户自定義線圖樣,這是16位字,每一位等於一個像素,如果哪個位被設置,那麼該像素打開,否則關閉。
thickness為線寬值存放的變量,可參見表1-11。
getlinesettings()函數對應的頭文件為graphics.h
返回值: 返回的線型設置存放在info指向的結構中。
例: 把當前線型的設置寫入info結構:
struct linesettingstype info;
getlinesettings(&info);
- 設置畫線模式
功能:函數setwritemode() 設置畫線模式
用法:函數調用方式為 voidsetwritemode()(int mode);
説明:參數mode只有兩個取值0和1,若mode為0,則新畫的線將覆蓋屏幕上原有的圖形,此為缺省畫線輸出模式。如果mode為1,那麼新畫的像素點與原有圖形的像素點先進行異或(XOR)運算,然後輸出到屏幕上,使用這種畫線輸出模式,第二次畫同一圖形時,將擦除該圖形。調用setwritemode()設置的畫線輸出模式隻影響函數line(),lineto(),linerel(),recangle()和drawpoly()。
setwritemode()函數對應的頭文件是graphics.h
返回值:無
例:設置畫線輸出模式為0:
setwritemode(0);
graphics.h多邊形
對多邊形,無疑可用畫直線函數來畫出它,但直接提供畫多邊形的函數會給用户很大方便。最常見的多邊形有矩形、矩形塊(或稱條形)、多邊形和多邊形塊,我們還把長方形條塊也放到這裏一起考慮,雖然它不是多邊形,但它的特例就是矩形(塊)。下面直接介紹畫多邊形的函數。
- 畫矩形函數
功能: 函數rectangle()用當前繪圖色、線型及線寬,畫一個給定左上角與右下角的矩形(正方形或長方形)。
用法: 此函數調用方式為void rectangle(int left,int top,int right,int bottom);
説明: 參數left,top是左上角點座標,right,bottom是右下角點座標。如果有一個以上角點不在當前圖形視口內,且裁剪標誌clip設置的是真(1),那麼調用該函數後,只有在圖形視口內的矩形部分才被畫出。
這個函數對應的頭文件為graphics.h
返回值:無
例:下面的程序畫一些矩形實例:
#include <graphics.h> void main() { int driver,mode; driver=DETECT; mode=0; initgraph(&driver,&mode,""); rectangle(80,80,220,200); rectangle(140,99,180,300); rectangle(6,6,88,88); rectangle(168,72,260,360); getchar(); restorecrtmode(); }
- 畫條函數
功能:函數bar()用當前填充圖樣和填充色(注意不是給圖色)畫出一個指定上左上角與右下角的實心長條形(長方塊或正方塊),但沒有四條邊線)。
用法:bar()函數調用方式為void bar(int left,int top,int right,int bottom);
説明:參數left,topright,bottom分別為左上角座標與右下角座標,它們和調用函數rectangle()的情形相同,調用此函數前,您可以使用setfillstyle()或setfillpattern()設置當前填充圖樣和填充色。
注意此函數只畫沒有邊線的條形,如果要畫有邊線的的條形,可調用下面的函數bar3d()來畫,並將深度參數設為0,同時topflag參數要設置為真,否則該條形無頂邊線。
對應的頭文件為graphics.h
返回值:無
例:見函數bar3d()中的實例。
- 畫條塊函數
功能: 函數bar3d() 使用當前繪圖色、線型及線寬畫出三維長方形條塊,並用當前填充圖樣和填 充色填充該三維條塊的表面。
用法: 此函數調用方式為voidbar3d(int left,int top,int right,int bottom,int depth,int topflag);
説明: 參數left,top,right,bottom分另為左上角與右下角座標,這與bar()函數中的一樣。參數depth為條塊的深度,以像素為單位,通常按寬度的四分之一計算。深度方向通過屏顯縱橫比調節為約45度(即這時x/y比設置為1:1)。
參數topflag相當於一個布爾參數,如果設置為1(真)那麼條塊上放一頂面;若設置為0(假),則三維條形就沒有頂面,這樣可使多個三維條形疊加在一起。
bar3d()函數對應的頭文件為graphics.h
返回值: 無
例: 下面的程序畫一個條形和條塊:
#include <graphics.h> void main() { int driver, mode; driver=DETECT; mode=0; initgraph(&driver, &mode, ""); setfillstyle(SOLID-FILL, GREEN); bar(60, 80, 220, 160); setfillstyle(SOLID-FILL, RED); bar3d(260, 180, 360, 240, 20, 1); getch(); restorecrtmode(); }
- 多邊形函數
功能: 函數drawpoly() 用當前繪圖色、線型及線寬,畫一個給定若干點所定義的多邊形。
用法: 此函數調用方式為voiddrawpoly(int pnumber,int *points);
説明: 參數pnumber為多邊形的頂點數;參數points指向整型數組,該數組中是多邊形所有頂點(x,y)座標值,即一系列整數對,x座標值在前。顯然整型數組的維數至少為頂點數的2倍,在定義了多邊形所有頂點的數組polypoints時,頂點數目可通過計算sizeof(polypoints)除以2倍的sizeof(int)得到,這裏除以2倍的原因是每個頂點有兩個整數座標值。另外有一點要注意,畫一個n個頂點的閉合圖形,頂點數必須等於n+1,並且最後一點(第n+1)點座標必須等於第一點的座標。
drawpoly()函數對應的頭文件為grpahics.h
返回值: 無
例: 下面的程序畫一個封閉星形圖與一個不封閉星形圖:
#include <graphics.h> void main() { int driver,mode; static int polypoints1[18]={100,100,110,120,100,130,120,125,140,140,130,120, 140,110,120,115,100,100}; static int polypoints2[18]={180,100,210,120,200,130,220,125,240,140,230,120, 240,110,220,115,220,110}; driver=DETECT; mode=0; initgraph(&driver,&mode,""); drawpoly(9,polypoints1); drawpoly(9,polypoints2); getch(); restorecrtmode(); }
graphics.h曲線函數
在一個屏幕上畫得很圓的圖形到另一個屏幕上可能被壓扁或拉長,這是因為每一種顯示卡與之相應的顯示模式都有一個縱橫比。縱橫比是指像素的水平方向大小與垂直方向大小的比值。如VGA顯示卡由於像素基本上是正方形,所以縱橫比為1.000。
為了保證幾何圖形基本按預計情況顯示在屏幕上,用屏顯的縱橫比來計算和糾正不同硬件及顯示卡產生的畸變。計算縱橫比所需要的水平方向和垂直方向的比例係數可調用函數getaspectratio()獲得。
- 縱橫比函數
功能: 函數getaspectratio()返回x方向和y方向的比例係數,用這兩個整型值可計算某一特定屏顯的縱橫比。
用法: 此函數調用方式為voidgetaspectratio(int xasp,int yasp);
説明: 參數xasp指向的變量存放返回的x方向比例係數;參數yasp指向的變量存放返回的y方向比例係數。通常y方向比例係數為10 000, x方向比例係數不大於10 000(這是因為大多數屏幕像素高比寬長)。
注意縱橫比自動用作下面函數arc(),circle()和pieslice()中的標尺因子,使屏幕上圓或弧正常顯示。但用ellipse()函數畫橢圓必須調用本函數獲取縱橫比作為標尺因子,否則不予調整。縱橫比可用於其它幾何圖形,目的是校正和顯示圖形。
getaspectratio()函數對應的頭文件為graphics.h
返回值: 返回x與y方向比例係數分別存放在xasp和yasp所指向的變量中。
例: 下面的程序顯示縱橫比:
int xasp,yasp; float aspectratio; getaspectratio(&xasp,&yasp); aspectratio=xasp/yasp; printf("aspect ratio: %f",aspectratio);
- 畫圓函數
功能: 函數circle()使用當前繪圖色並以實線畫一個完整的圓。
用法:該函數調用方式為void circle(int x,int y,int radius);
説明: 參數x,y為圓心座標,radius為圓半徑,用像素個素表示。注意,調用circle()函數畫圓時不用當前線型。
不同於ellipse()函數,只用單個半徑radius參數調用circle()函數,故屏顯縱橫比可以自動調節,以產生正確的顯示圖。
此函數對應的頭文件為graphics.h
返回值: 無
例: 畫六個同心圓,圓心在(100,100)。
#include <graphics.h> void main() { int driver,mode; driver=DETECT; mode=0; initgraph(&driver,&mode,""); circle(100,100,10); circle(100,100,20); circle(100,100,30); circle(100,100,40); circle(100,100,50); circle(100,100,60); getch(); restorecrtmode(); }
- 畫圓弧函數
功能: 函數arc()使用當前繪圖色並以實線畫一圓弧。
用法: 函數調用方式為void arc(int x,int y,int startangle,int endangle,int radius);
説明: 參數x,y為圓心座標,startangle與endangle分別為起始角與終止角,radius為半徑。圓心座標和半徑以像素個數給出,起始角和終止角以度為單位,0度位於右邊,90度位於頂部,180度位於左邊,底部是270度。同往常一樣,360度與0度重合。角度按逆時針方向增加,但並不要求終止角一定比起始角大。例如指定300度和90度分別為起始角和終止角,與指定300度和450度分別為起始角和終止角可畫出相同的弧。大於360度可作為參數,它將被化到0度 ̄360度範圍裏。函數arc()能畫封閉圓,只要取起始角為0度,終止角為360度即可。此函數中,屏顯縱橫比可自動調節。
arc()函數對應的頭文件為graphics.h
返回值: 無
例: 以(200,200)為圓心,100為半徑,從0度到120度畫圓弧:
#include <graphics.h> void main() { int driver,mode; driver=DETECT; mode=0; initgraph(&driver,&mode,""); setcolor(WHITE); arc(200,200,0,120,100); getch(); restorecrtmode(); }
文件內容
/*graphics.h DefinitionsforGraphicsPackage. Copyright(c)BorlandInternational1987,1988 AllRightsReserved. */ #if__STDC__ #define_Cdecl #else #define_Cdeclcdecl #endif #if!defined(__GRAPHX_DEF_) #define__GRAPHX_DEF_ enumgraphics_errors{/*graphresulterrorreturncodes*/ grOk=0, grNoInitGraph=-1, grNotDetected=-2, grFileNotFound=-3, grInvalidDriver=-4, grNoLoadMem=-5, grNoScanMem=-6, grNoFloodMem=-7, grFontNotFound=-8, grNoFontMem=-9, grInvalidMode=-10, grError=-11,/*genericerror*/ grIOerror=-12, grInvalidFont=-13, grInvalidFontNum=-14, grInvalidVersion=-18 }; enumgraphics_drivers{/*definegraphicsdrivers*/ DETECT,/*requestsautodetection*/ CGA,MCGA,EGA,EGA64,EGAMONO,IBM8514,/*1-6*/ HERCMONO,ATT400,VGA,PC3270,/*7-10*/ CURRENT_DRIVER=-1 }; enumgraphics_modes{/*graphicsmodesforeachdriver*/ CGAC0=0,/*320x200palette0;1page*/ CGAC1=1,/*320x200palette1;1page*/ CGAC2=2,/*320x200palette2:1page*/ CGAC3=3,/*320x200palette3;1page*/ CGAHI=4,/*640x2001page*/ MCGAC0=0,/*320x200palette0;1page*/ MCGAC1=1,/*320x200palette1;1page*/ MCGAC2=2,/*320x200palette2;1page*/ MCGAC3=3,/*320x200palette3;1page*/ MCGAMED=4,/*640x2001page*/ MCGAHI=5,/*640x4801page*/ EGALO=0,/*640x20016color4pages*/ EGAHI=1,/*640x35016color2pages*/ EGA64LO=0,/*640x20016color1page*/ EGA64HI=1,/*640x3504color1page*/ EGAMONOHI=0,/*640x35064Koncard,1page-256Koncard,4pages*/ HERCMONOHI=0,/*720x3482pages*/ ATT400C0=0,/*320x200palette0;1page*/ ATT400C1=1,/*320x200palette1;1page*/ ATT400C2=2,/*320x200palette2;1page*/ ATT400C3=3,/*320x200palette3;1page*/ ATT400MED=4,/*640x2001page*/ ATT400HI=5,/*640x4001page*/ VGALO=0,/*640x20016color4pages*/ VGAMED=1,/*640x35016color2pages*/ VGAHI=2,/*640x48016color1page*/ PC3270HI=0,/*720x3501page*/ IBM8514LO=0,/*640x480256colors*/ IBM8514HI=1/*1024x768256colors*/ }; /*Colorsforsetpaletteandsetallpalette*/ #if!defined(__COLORS) #define__COLORS enumCOLORS{ BLACK,/*darkcolors*/ BLUE, GREEN, CYAN, RED, MAGENTA, BROWN, LIGHTGRAY, DARKGRAY,/*lightcolors*/ LIGHTBLUE, LIGHTGREEN, LIGHTCYAN, LIGHTRED, LIGHTMAGENTA, YELLOW, WHITE }; #endif enumCGA_COLORS{ CGA_LIGHTGREEN=1,/*PaletteC0ColorNames*/ CGA_LIGHTRED=2, CGA_YELLOW=3, CGA_LIGHTCYAN=1,/*PaletteC1ColorNames*/ CGA_LIGHTMAGENTA=2, CGA_WHITE=3, CGA_GREEN=1,/*PaletteC2ColorNames*/ CGA_RED=2, CGA_BROWN=3, CGA_CYAN=1,/*PaletteC3ColorNames*/ CGA_MAGENTA=2, CGA_LIGHTGRAY=3 }; enumEGA_COLORS{ EGA_BLACK=0,/*darkcolors*/ EGA_BLUE=1, EGA_GREEN=2, EGA_CYAN=3, EGA_RED=4, EGA_MAGENTA=5, EGA_BROWN=20, EGA_LIGHTGRAY=7, EGA_DARKGRAY=56,/*lightcolors*/ EGA_LIGHTBLUE=57, EGA_LIGHTGREEN=58, EGA_LIGHTCYAN=59, EGA_LIGHTRED=60, EGA_LIGHTMAGENTA=61, EGA_YELLOW=62, EGA_WHITE=63 }; enumline_styles{/*Linestylesforget/setlinestyle*/ SOLID_LINE=0, DOTTED_LINE=1, CENTER_LINE=2, DASHED_LINE=3, USERBIT_LINE=4,/*Userdefinedlinestyle*/ }; enumline_widths{/*Linewidthsforget/setlinestyle*/ NORM_WIDTH=1, THICK_WIDTH=3, }; enumfont_names{ DEFAULT_FONT=0,/*8x8bitmappedfont*/ TRIPLEX_FONT=1,/*"Stroked"fonts*/ SMALL_FONT=2, SANS_SERIF_FONT=3, GOTHIC_FONT=4 }; #defineHORIZ_DIR0/*lefttoright*/ #defineVERT_DIR1/*bottomtotop*/ #defineUSER_CHAR_SIZE0/*user-definedcharsize*/ enumfill_patterns{/*Fillpatternsforget/setfillstyle*/ EMPTY_FILL,/*fillsareainbackgroundcolor*/ SOLID_FILL,/*fillsareainsolidfillcolor*/ LINE_FILL,/*---fill*/ LTSLASH_FILL,/*///fill*/ SLASH_FILL,/*///fillwiththicklines*/ BKSLASH_FILL,/*\\\fillwiththicklines*/ LTBKSLASH_FILL,/*\\\fill*/ HATCH_FILL,/*lighthatchfill*/ XHATCH_FILL,/*heavycrosshatchfill*/ INTERLEAVE_FILL,/*interleavinglinefill*/ WIDE_DOT_FILL,/*Widelyspaceddotfill*/ CLOSE_DOT_FILL,/*Closelyspaceddotfill*/ USER_FILL/*userdefinedfill*/ }; enumputimage_ops{/*BitBltoperatorsforputimage*/ COPY_PUT,/*MOV*/ XOR_PUT,/*XOR*/ OR_PUT,/*OR*/ AND_PUT,/*AND*/ NOT_PUT/*NOT*/ }; enumtext_just{/*Horizontalandverticaljustification forsettextjustify*/ LEFT_TEXT=0, CENTER_TEXT=1, RIGHT_TEXT=2, BOTTOM_TEXT=0, /*CENTER_TEXT=1,alreadydefinedabove*/ TOP_TEXT=2 }; #defineMAXCOLORS15 structpalettetype{ unsignedcharsize; signedcharcolors[MAXCOLORS+1]; }; structlinesettingstype{ intlinestyle; unsignedupattern; intthickness; }; structtextsettingstype{ intfont; intdirection; intcharsize; inthoriz; intvert; }; structfillsettingstype{ intpattern; intcolor; }; structpointtype{ intx,y; }; structviewporttype{ intleft,top,right,bottom; intclip; }; structarccoordstype{ intx,y; intxstart,ystart,xend,yend; }; voidfar_Cdeclarc(intx,inty,intstangle,intendangle, intradius); voidfar_Cdeclbar(intleft,inttop,intright,intbottom); voidfar_Cdeclbar3d(intleft,inttop,intright,intbottom, intdepth,inttopflag); voidfar_Cdeclcircle(intx,inty,intradius); voidfar_Cdeclcleardevice(void); voidfar_Cdeclclearviewport(void); voidfar_Cdeclclosegraph(void); voidfar_Cdecldetectgraph(intfar*graphdriver,intfar*graphmode); voidfar_Cdecldrawpoly(intnumpoints,intfar*polypoints); voidfar_Cdeclellipse(intx,inty,intstangle,intendangle, intxradius,intyradius); voidfar_Cdeclfillellipse(intx,inty,intxradius,intyradius); voidfar_Cdeclfillpoly(intnumpoints,intfar*polypoints); voidfar_Cdeclfloodfill(intx,inty,intborder); voidfar_Cdeclgetarccoords(structarccoordstypefar*arccoords); voidfar_Cdeclgetaspectratio(intfar*xasp,intfar*yasp); intfar_Cdeclgetbkcolor(void); intfar_Cdeclgetcolor(void); structpalettetype*far_Cdeclgetdefaultpalette(void); char*far_Cdeclgetdrivername(void); voidfar_Cdeclgetfillpattern(charfar*pattern); voidfar_Cdeclgetfillsettings(structfillsettingstypefar*fillinfo); intfar_Cdeclgetgraphmode(void); voidfar_Cdeclgetimage(intleft,inttop,intright,intbottom, voidfar*bitmap); voidfar_Cdeclgetlinesettings(structlinesettingstypefar*lineinfo); intfar_Cdeclgetmaxcolor(void); intfar_Cdeclgetmaxmode(void); intfar_Cdeclgetmaxx(void); intfar_Cdeclgetmaxy(void); char*far_Cdeclgetmodename(intmode_number); voidfar_Cdeclgetmoderange(intgraphdriver,intfar*lomode, intfar*himode); unsignedfar_Cdeclgetpixel(intx,inty); voidfar_Cdeclgetpalette(structpalettetypefar*palette); intfar_Cdeclgetpalettesize(void); voidfar_Cdeclgettextsettings(structtextsettingstypefar*texttypeinfo); voidfar_Cdeclgetviewsettings(structviewporttypefar*viewport); intfar_Cdeclgetx(void); intfar_Cdeclgety(void); voidfar_Cdeclgraphdefaults(void); char*far_Cdeclgrapherrormsg(interrorcode); voidfar_Cdecl_graphfreemem(voidfar*ptr,unsignedsize); voidfar*far_Cdecl_graphgetmem(unsignedsize); intfar_Cdeclgraphresult(void); unsignedfar_Cdeclimagesize(intleft,inttop,intright,intbottom); voidfar_Cdeclinitgraph(intfar*graphdriver, intfar*graphmode, charfar*pathtodriver); intfar_Cdeclinstalluserdriver(charfar*name,inthuge(*detect)(void)); intfar_Cdeclinstalluserfont(charfar*name); voidfar_Cdeclline(intx1,inty1,intx2,inty2); voidfar_Cdecllinerel(intdx,intdy); voidfar_Cdecllineto(intx,inty); voidfar_Cdeclmoverel(intdx,intdy); voidfar_Cdeclmoveto(intx,inty); voidfar_Cdeclouttext(charfar*textstring); voidfar_Cdeclouttextxy(intx,inty,charfar*textstring); voidfar_Cdeclpieslice(intx,inty,intstangle,intendangle, intradius); voidfar_Cdeclputimage(intleft,inttop,voidfar*bitmap,intop); voidfar_Cdeclputpixel(intx,inty,intcolor); voidfar_Cdeclrectangle(intleft,inttop,intright,intbottom); voidfar_Cdeclrestorecrtmode(void); voidfar_Cdeclsector(intX,intY,intStAngle,intEndAngle, intXRadius,intYRadius); voidfar_Cdeclsetactivepage(intpage); voidfar_Cdeclsetallpalette(structpalettetypefar*palette); voidfar_Cdeclsetaspectratio(intxasp,intyasp); voidfar_Cdeclsetbkcolor(intcolor); voidfar_Cdeclsetcolor(intcolor); voidfar_Cdeclsetfillpattern(charfar*upattern,intcolor); voidfar_Cdeclsetfillstyle(intpattern,intcolor); unsignedfar_Cdeclsetgraphbufsize(unsignedbufsize); voidfar_Cdeclsetgraphmode(intmode); voidfar_Cdeclsetlinestyle(intlinestyle,unsignedupattern, intthickness); voidfar_Cdeclsetpalette(intcolornum,intcolor); voidfar_Cdeclsetrgbpalette(intcolornum, intred,intgreen,intblue); voidfar_Cdeclsettextjustify(inthoriz,intvert); voidfar_Cdeclsettextstyle(intfont,intdirection,intcharsize); voidfar_Cdeclsetusercharsize(intmultx,intdivx, intmulty,intdivy); voidfar_Cdeclsetviewport(intleft,inttop,intright,intbottom, intclip); voidfar_Cdeclsetvisualpage(intpage); voidfar_Cdeclsetwritemode(intmode); intfar_Cdecltextheight(charfar*textstring); intfar_Cdecltextwidth(charfar*textstring); /*****graphicsdrivers*****/ int_Cdeclregisterbgidriver(void(*driver)(void)); intfar_Cdeclregisterfarbgidriver(voidfar*driver); /*!!These"functions"areNOTuser-callable!!*/ /*!!Theyaretherejustsoyoucanlinkingraphicsdrivers!!*/ void_CdeclCGA_driver(void); void_CdeclEGAVGA_driver(void); void_CdeclIBM8514_driver(void); void_CdeclHerc_driver(void); void_CdeclATT_driver(void); void_CdeclPC3270_driver(void); externintfar_CdeclCGA_driver_far[]; externintfar_CdeclEGAVGA_driver_far[]; externintfar_CdeclIBM8514_driver_far[]; externintfar_CdeclHerc_driver_far[]; externintfar_CdeclATT_driver_far[]; externintfar_CdeclPC3270_driver_far[]; /*****graphicsfonts*****/ int_Cdeclregisterbgifont(void(*font)(void)); intfar_Cdeclregisterfarbgifont(voidfar*font); /*!!These"functions"areNOTuser-callable,!!*/ /*!!theyaretherejustsoyoucanlinkinfonts!!*/ void_Cdecltriplex_font(void); void_Cdeclsmall_font(void); void_Cdeclsansserif_font(void); void_Cdeclgothic_font(void); externintfar_Cdecltriplex_font_far[]; externintfar_Cdeclsmall_font_far[]; externintfar_Cdeclsansserif_font_far[]; externintfar_Cdeclgothic_font_far[]; #endif