77范文网 - 专业文章范例文档资料分享平台

毕业设计C语言论文(7)

来源:网络收集 时间:2019-06-11 下载这篇文档 手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:或QQ: 处理(尽可能给您提供完整文档),感谢您的支持与谅解。点击这里给我发消息

附 录

附用C语言实现计算机绘图源代码:

#include #include #include #include #include

#define W 4471 /* scan code */ #define S 8051 #define A 7777 #define D 8292 #define ESC 283 #define ENTER 7181

#define F1 15104 /* pagedown&up is uesd to change color */ #define F2 15360

#define SPACE 14624 #define C 11875 #define V 12150 #define B 12386 #define N 12654 #define Q 4209 #define X 11640 #define Z 11386

void penmove(int xx,int yy,int lastxx,int lastyy,void (*buf)) {

putimage(xx,yy,buf,XOR_PUT);

- 31 -

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(&gdriver,&mode,\ errorcode=graphresult(); if(errorcode!=grOk)

{

printf(\ printf(\ getch(); exit(1);

}

cleardevice(); setfillstyle(1,2); setcolor(WHITE); settextstyle(1,0,1);

outtextxy(230,450, \ Graduation design of SU HUA XIAN \

- 32 -

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()&&(!ifexit)) {

key=bioskey(0);

switch(key) {

case W : if(y>5) { y=y-1; action(x,y,lastx,lasty,buf[3],x1,y1,drawmode); lastx=x; lasty=y; }

- 33 -

break; case S : if(y<449) { y=y+1; action(x,y,lastx,lasty,buf[3],x1,y1,drawmode); lastx=x; lasty=y; } break;

case A : if(x>5) { x=x-1; 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( \ 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) {

- 34 -

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(ucolor>0)ucolor--; else ucolor=15; setfillstyle(1,ucolor); bar(10,455,30,470); setcolor(ucolor); } break;

case F2 : if(drawmode!=2) { if(ucolor<15)ucolor++; else ucolor=0; setfillstyle(1,ucolor); bar(10,455,30,470); setcolor(ucolor); } break;

- 35 -

百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库毕业设计C语言论文(7)在线全文阅读。

毕业设计C语言论文(7).doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印 下载失败或者文档不完整,请联系客服人员解决!
本文链接:https://www.77cn.com.cn/wenku/zonghe/655046.html(转载请注明文章来源)
Copyright © 2008-2022 免费范文网 版权所有
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ: 邮箱:tiandhx2@hotmail.com
苏ICP备16052595号-18
× 注册会员免费下载(下载后可以自由复制和排版)
注册会员下载
全站内容免费自由复制
注册会员下载
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: