【正文】
*/define F2 15360define SPACE 14624define C 11875define V 12150define B 12386define N 12654define Q 4209define X 11640define Z 11386void penmove(int xx,int yy,int lastxx,int lastyy,void (*buf)){ putimage(xx,yy,buf,XOR_PUT)。 putimage(lastxx,lastyy,buf,XOR_PUT)。}void action(int xx,int yy, int lastxx,int lastyy,void(*buf),int xx1,int yy1,int drawmode){ if(drawmode==2) {setwritemode(1)。 setlinestyle(DOTTED_LINE,0,1)。 line(xx1,yy1,xx,yy)。 line(xx1,yy1,lastxx,lastyy)。 } else{penmove(xx,yy,lastxx,lastyy,buf)。} }int main(void){ int gdriver=DETECT,mode,errorcode。 int i,ucolor。 int ifexit,key,drawmode。 void *buf[15]。 int x,y,lastx,lasty,x1,y1。 int r。 initgraph(amp。gdriver,amp。mode,)。 errorcode=graphresult()。 if(errorcode!=grOk){ printf(Graphics error:%s\n,errorcode)。 printf(Press any key to halt:)。 getch()。 exit(1)。 } cleardevice()。 setfillstyle(1,2)。 setcolor(WHITE)。 settextstyle(1,0,1)。 outtextxy(230,450, HlepB Graduation design of SU HUA XIAN )。 getch()。 textcolor(BLUE)。 setbkcolor(BLUE)。 setcolor(GREEN)。 rectangle(0+5,0+5,getmaxx()5,getmaxy()5)。 line(5,450,635,450)。 setfillstyle(1,1)。 x=getmaxx()/2。 y=getmaxy()/2。 lastx=x。 lasty=y。 for(i=0。i=15。i++) { putpixel(x,y,i)。 buf[i]=malloc(imagesize(x,y,x+1,y+1))。 getimage(x,y,x+1,y+1,buf[i])。 } putpixel(x,y,RED)。 setcolor(0)。 drawmode=0。 /* 0 is putpixel */ ucolor=0。 ifexit=0。 while(!kbhit()amp。amp。(!ifexit)) { key=bioskey(0)。 switch(key) { case W : if(y5) { y=y1。 action(x,y,lastx,lasty,buf[3],x1,y1,drawmode)。 lastx=x。 lasty=y。 } break。 case S : if(y449) { y=y+1。 action(x,y,lastx,lasty,buf[3],x1,y1,drawmode)。 lastx=x。 lasty=y。 } break。 case A : if(x5) { x=x1。 action(x,y,lastx,lasty,buf[3],x1,y1,drawmode)。 lastx=x。 lasty=y。 } break。 case D : if(x(getmaxx()5)) { x=x+1。 action(x,y,lastx,lasty,buf[3],x1,y1,drawmode)。 lastx=x。 lasty=y。 } break。 case ESC :ifexit=1。 clrscr()。 printf( \n\n\n\n\n\n This is my graduation design using simple painting procedure\n of the C language desige, \n Please press any key to return to the window)。 break。 case ENTER : switch (drawmode) { case 0: putimage(x,y,buf[3],XOR_PUT)。 putpixel(x,y,ucolor)。 putimage(x,y,buf[3],XOR_PUT)。 break。 case 1: putimage(x,y,buf[3],XOR_PUT)。 x1=x。 y1=y。 drawmode=2。 break。 case 2: setwritemode(1)。 setlinestyle(DOTTED_LINE,0,1)。 line(x1,y1,x,y)。 setwritemode(0)。 setlinestyle(SOLID_LINE,0,1)。 line(x1,y1,x,y)。 drawmode=0。 putimage(x,y,buf[3],XOR_PUT)。 break。 } /*switch*/ break。 case F1 : if(drawmode!=2) { if(ucolor0)ucolor。 else ucolor=15。 setfillstyle(1,ucolor)。 bar(10,455,30,470)。 setcolor(ucolor)。 } break。 case F2 : if(drawmode!=2) { if(ucolor15)ucolor++。 else ucolor=0。 setfillstyle(1,ucolor)。 bar(10,455,30,470)。 setcolor(ucolor)。 } break。 case SPACE : if(drawmode1)drawmode++。 else drawmode=0。 case C : if(key==C) circle(x,y,50)。break。case V : if(key==V) clrscr()。 break。 case B : if(key==B){ clrscr()。printf( Key operating instrucions\n)。printf( \n)。printf( \n)。 printf( is All sketch of the clearance screen\n)。 printf( is Draw the stereoscopic sketch\n)。printf( is the circle\n)。 printf( is Partial sketch of clearance\n)。 printf( is Help\n)。 printf( is The painting is oval\n)。printf( is Draw the rectangle\n)。printf( is Withdraw the procedure and return to the window way\n\n\n\n)。printf( Please press V key to return to draw to operate the page)。 } break。 case N : if(key==N) ellipse(x,y,0,360,60,40)。 break。 case Q : if (key==Q) rectangle(x,y,y,x)。 break。 case Z : if(key==Z) cleardevice()。 break。 case X : if(key==X) bar3d(100,200,400,300,60,1)。 break。 } /*switch*/ } /*while*/ getch()。 closegraph()。} /*main*/致 謝經(jīng)過兩個(gè)多月的忙碌和工作,本次畢業(yè)已經(jīng)接近尾聲,作為一個(gè)??粕漠厴I(yè)設(shè)計(jì),由于經(jīng)驗(yàn)的匱乏,難免有許多考慮不周全的地方,如果沒有導(dǎo)師黎桓的督促指導(dǎo),以及一起工作的同學(xué)們的支持,想要完成這個(gè)設(shè)計(jì)是難以想象的。在這里,我要首先感謝我的導(dǎo)師黎桓。黎老師平時(shí)里工作繁多,但在我做畢業(yè)設(shè)計(jì)階段,黎老師給予了我極大的關(guān)心和幫助。除了黎桓老師的專業(yè)水平外,他的治學(xué)嚴(yán)謹(jǐn)和科學(xué)研究的精神也是我永遠(yuǎn)學(xué)習(xí)的榜樣,并將積極影響我今后的學(xué)習(xí)和工作。在黎老師的幫助下,使我的課題研究能夠順利開展。在此,我向他表示最真摯的感謝。其次還要感謝和我一起做畢業(yè)設(shè)計(jì)的同學(xué),他們曾給予我很多的支持,為我解答了很多疑問。如果沒有她們的幫助,此次設(shè)計(jì)的完成將變得非常困難。然后還要感謝大學(xué)四年來所有的老師,為我打下專業(yè)知識(shí)的基礎(chǔ);同時(shí)還要感謝所有的同學(xué)們,正是因?yàn)橛辛四銈兊闹С趾凸膭?lì)。此次畢業(yè)設(shè)計(jì)才會(huì)順利完成。最后,感謝我的母?!萋殬I(yè)技術(shù)學(xué)院三年來對(duì)我的大力栽培,同時(shí),我要感謝我的家人,朋友。他們永遠(yuǎn)是我前進(jìn)的動(dòng)力。 38