【正文】
*/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)過兩個多月的忙碌和工作,本次畢業(yè)已經(jīng)接近尾聲,作為一個專科生的畢業(yè)設計,由于經(jīng)驗的匱乏,難免有許多考慮不周全的地方,如果沒有導師黎桓的督促指導,以及一起工作的同學們的支持,想要完成這個設計是難以想象的。在這里,我要首先感謝我的導師黎桓。黎老師平時里工作繁多,但在我做畢業(yè)設計階段,黎老師給予了我極大的關心和幫助。除了黎桓老師的專業(yè)水平外,他的治學嚴謹和科學研究的精神也是我永遠學習的榜樣,并將積極影響我今后的學習和工作。在黎老師的幫助下,使我的課題研究能夠順利開展。在此,我向他表示最真摯的感謝。其次還要感謝和我一起做畢業(yè)設計的同學,他們曾給予我很多的支持,為我解答了很多疑問。如果沒有她們的幫助,此次設計的完成將變得非常困難。然后還要感謝大學四年來所有的老師,為我打下專業(yè)知識的基礎;同時還要感謝所有的同學們,正是因為有了你們的支持和鼓勵。此次畢業(yè)設計才會順利完成。最后,感謝我的母?!萋殬I(yè)技術學院三年來對我的大力栽培,同時,我要感謝我的家人,朋友。他們永遠是我前進的動力。 38