ImageVerifierCode 换一换
格式:DOCX , 页数:38 ,大小:22.43KB ,
资源ID:12661623      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/12661623.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(画图软件C程序代码.docx)为本站会员(b****3)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

画图软件C程序代码.docx

1、画图软件C程序代码#include #include #include #include #include #include #include #include /* 定义常量 */* 向上翻页移键 */#define PAGEUP 0x4900/* 向下翻页移键 */#define PAGEDOWN 0x5100/*Escape 键 */#define ESC 0x011b/* 左移键 */#define LEFT 0x4b00/* 右移键 */#define RIGHT 0x4d00/* 下移键 */#define DOWN 0x5000/* 上移键 */#define UP 0x4800

2、/* 空格键 */#define SPACE 0x3920#define NO_PRESSED 0#define LEFT_PRESSED 1#define RIGHT_PRESSED 2#define pi 3.1415926/* 定义全局变量 */int Rx,Ry,R;int TOPx,TOPy,BOTTOMx,BOTTOMy;int Centx,Centy;int lineStartx,lineStarty,lineEndx,lineEndy;int linePoint_x20,linePoint_y20;/*这里的字模数组均由“点阵字模工具”生成,你可以用你自己需要的点阵信息来 替换

3、示例中的字模信息,注意字模大小要一致,否则显示会出问题。 */ char zhi16K=/* 以下是 直 的 16点阵楷体 字模, 32 byte */0x01,0x00,0x01,0x00,0x01,0xF0,0x1E,0x00,0x02,0x00,0x07,0xC0,0x08,0x40,0x0F,0x40,0x08,0x40,0x0F,0x40,0x08,0x40,0x0F,0x40,0x08,0x40,0x0F,0xFC,0x70,0x00,0x00,0x00,;char xian16K=/* 以下是 线 的 16 点阵楷体 字模,0x00,0x80,0x00,0x90,0x08,0x8

4、8,0x10,0x80,0x24,0xF0,0x45,0x80,0x78,0xB0,0x11,0xC0,0x2C,0x88,0x70,0x50,0x04,0x60,0x18,0xA4,0x63,0x14,0x00,0x0C,0x00,0x04,0x00,0x00,;char ju16K=/* 以下是 矩 的 16 点阵楷体 字模,0x00,0x00,0x08,0x00,0x08,0x78,0x10,0x80,0x1E,0x80,0x28,0xF8,0x48,0x88,0x0E,0x88,0xF8,0xF0,0x08,0x80,0x14,0x80,0x12,0x9E,0x20,0xE0,0x40

5、,0x00,0x00,0x00,0x00,0x00,;char xing16K=/* 以下是 形 的 16 点阵楷体 字模,0x00,0x00,0x07,0x88,0x3A,0x08,0x12,0x10,0x12,0x20,0x17,0x48,0xFA,0x10,0x12,0x20,0x12,0xC8,0x12,0x08,0x22,0x10,0x42,0x20,0x00,0x40,0x00,0x80,0x03,0x00,0x00,0x00,;char yuan16K=/* 以下是 圆 的 16 点阵楷体 字模,0x00,0xF8,0x3F,0x08,0x23,0x88,0x24,0x88,0x

6、27,0x08,0x21,0xC8,0x2E,0x48,0x29,0x48,0x29,0x48,0x22,0x88,0x24,0x48,0x28,0x08,0x3F,0xE8,0x00,0x10,0x00,0x00,0x00,0x00,;char qing16K=/* 以下是 清 的 16 点阵楷体 字模,0x00,0x80,0x00,0xE0,0x33,0x80,0x10,0xE0,0x03,0x80,0x40,0xFC,0x2F,0x00,0x01,0xE0,0x12,0x20,0x13,0xA0,0x22,0x20,0x63,0xA0,32 byte */32 byte */32 byt

7、e */32 byte */32 byte */0x42,0x20,0x02,0x60,0x00,0x20,0x00,0x00,;char ping16K=/* 以下是 屏 的 16 点阵楷体 字模,0x00,0xF0,0x0F,0x30,0x08,0x60,0x0F,0x80,0x0A,0x20,0x09,0x40,0x08,0xF8,0x17,0x20,0x11,0x3E,0x2F,0xE0,0x21,0x20,0x42,0x20,0x82,0x20,0x04,0x20,0x08,0x20,0x00,0x00,;char bao16K=/* 以下是 保 的 16 点阵楷体 字模,0x00,

8、0x00,0x09,0xF0,0x0A,0x10,0x12,0x10,0x13,0xE0,0x30,0x80,0x50,0xFC,0x9F,0x80,0x11,0xC0,0x12,0xA0,0x14,0x98,0x18,0x8E,0x10,0x80,0x10,0x80,0x00,0x00,0x00,0x00,;char cun16K=/* 以下是 存 的 16 点阵楷体 字模,0x01,0x00,0x01,0x00,0x01,0xF0,0x1E,0x00,0x02,0x70,0x05,0x90,0x08,0x20,0x08,0x40,0x18,0x7E,0x2B,0xA0,0xC8,0x20,

9、0x08,0x20,0x08,0x20,0x08,0xA0,0x00,0x40,0x00,0x00,;char jia16K=/* 以下是 加 的 16 点阵楷体 字模,0x00,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x0F,0x00,0x79,0x3C,0x09,0x44,0x11,0x44,0x11,0x44,0x22,0x44,0x22,0x78,0x4A,0x00,0x84,0x00,0x00,0x00,0x00,0x00,0x00,0x00,;char zai16K=/* 以下是 载 的 16 点阵楷体 字模,0x00,0x80,0x08,0xA0,

10、0x08,0x90,0x0E,0x80,0x38,0xF0,0x0F,0x80,0x78,0x50,0x0E,0x50,0x34,0x20,0x1E,0x20,0x34,0x50,0x0E,0x92,0x75,0x0A,0x04,0x06,0x04,0x02,0x00,0x00,;char bang16K=/* 以下是 帮 的 16 点阵楷体 字模,32 byte */32 byte */32 byte */32 byte */32 byte */32 byte */0x04,0x00,0x07,0x38,0x1C,0x48,0x06,0x50,0x1C,0x50,0x07,0x48,0x78

11、,0x58,0x11,0x40,0x21,0xF0,0x4F,0x10,0x09,0x10,0x09,0x50,0x09,0x20,0x01,0x00,0x01,0x00,0x00,0x00,;char zhu16K=/* 以下是 助 的 16点阵楷体 字模, 32 byte */0x00,0x00,0x00,0x20,0x0C,0x20,0x34,0x20,0x24,0x20,0x34,0x38,0x25,0xC8,0x34,0x48,0x24,0x48,0x26,0x88,0x38,0x88,0xE1,0x28,0x02,0x10,0x04,0x00,0x00,0x00,0x00,0x00

12、,;/* 自定义函数 */void outChinese(char *mat,int matsize,int x,int y,int color);void fill(int startx,int starty,int endx,int endy,int color);void showHelp();void save();void load();int mouseStatus(int* x,int* y);int setMousePos(int x, int y);void DrawMouse(float x,float y);void DrawLine();void DrawRectang

13、le();void LineToCircle(int x0,int y0,int r);void DrawCircle();long factorial(int n);float berFunction(int i,int n,double t);void DrawBezier();/* 根据点阵信息显示中文函数 */void outChinese(char *mat,int matsize,int x,int y,int color)/* 依次:字模指针、点阵大小、起始坐标 (x,y) 、颜色 */int i, j, k, n;n = (matsize - 1) / 8 + 1;for(j

14、= 0; j matsize; j+)for(i = 0; i n; i+)for(k = 0;k k) /*测试为 1 的位则显示 */ putpixel(x + i * 8 + k, y + j, color);/* 填充函数 */void fill(int startx,int starty,int endx,int endy,int color)int i,j;for(i=startx;i=endx;i+) for(j=starty;j=endy;j+)/* 在指定位置以指定颜色画一像素 */ putpixel(i,j,color);/* 显示用户帮助函数 */void showHel

15、p()setcolor(14);1 Press left button to start until to line end.);2 Use UP,DOWN,LEFT,RIGHT keys to move it.);3 Use PAGEUP key to enlarge it, and PAGEDOWN key to shrinkouttextxy(45,50,Line:); setcolor(WHITE); outtextxy(45,50, outtextxy(45,65, outtextxy(45,80,it.);outtextxy(45,95,4 Use SPACE key to rot

16、ate it.);setcolor(WHITE);outtextxy(45,120,outtextxy(45,135,outtextxy(45,150, shrink it.);setcolor(14);outtextxy(45,120,Rectangle:);1 Press left button to start until to right corner.);2 Use UP,DOWN,LEFT,RIGHT keys to move it.);3 Use PAGEUP key to enlarge it, and PAGEDOWN key tosetcolor(14);outtextxy

17、(45,170,Circle:);setcolor(WHITE);outtextxy(45,170,outtextxy(45,185,1 Press left button to start until to end.);2 Use PAGEUP key to enlarge it, and PAGEDOWN key toshrink it.); setcolor(14); outtextxy(45,205,Bezier:); setcolor(WHITE);outtextxy(45,205, Press left button to start, and right button to en

18、d.);outtextxy(45,230,Press ESC key to stop the operation function.); outtextxy(45,245,Press right button to end the drawing works.); outtextxy(45,260,Press any key to continue );getch(); fill(40,40,625,270,0);/* 保存函数 */void save()int i,j;FILE *fp; char fileName20;fill(0,447,630,477,2);gotoxy(1,25);p

19、rintf(nnnn Input the file name.dat:); scanf(%s,fileName);fill(0,447,630,477,2);/* 以读写的方式打开文件 */ if(fp=fopen(fileName,w+)=NULL) outtextxy(260,455,Failed to open file!); exit(0); outtextxy(280,455,saving.);/* 保存像素到文件 */ for(i=5;i630;i+) for(j=30;j=445;j+) fputc(getpixel(i,j),fp);fclose(fp);fill(0,447,

20、630,477,2);outtextxy(260,455,save over!);/* 打开函数 */void load()int i,j;char fileName20;FILE *fp;fill(0,447,630,477,2);gotoxy(1,25);printf(nnnn Input the file name.dat:); scanf(%s,fileName);/* 打开指定的文件 */ if(fp=fopen(fileName,r+)!=NULL) fill(0,447,630,477,2); outtextxy(280,455,loading.);/* 从文件中读出像素 */

21、for(i=5;i630;i+) for(j=30;j=10 & lineStarty=40 & lineEndx =620 & lineEndy =445)/* 清除原有的直线 */setwritemode(XOR_PUT); line(lineStartx,lineStarty,lineEndx,lineEndy);/*计算旋转 30 度后的起点坐标 */lineStartx=(temStartx-Centx)*cos(pi/6)-(temStarty-Centy)*sin(pi/6)+Centx;lineEndx=(temEndx-Centx)*cos(pi/6)-(temEndy-Ce

22、nty)*sin(pi/6)+Centx;/*计算旋转 30 度后的终点坐标 */lineStarty=(temStartx-Centx)*sin(pi/6)+(temStarty-Centy)*cos(pi/6)+Centy;lineEndy=(temEndx-Centx)*sin(pi/6)+(temEndy-Centy)*cos(pi/6)+Centy;temStartx=lineStartx;temStarty=lineStarty;temEndx=lineEndx;temEndy=lineEndy;/* 绘制旋转后的直线 */line(lineStartx,lineStarty,lineEndx,lineEndy);/* 左移直线 */if(key=LEFT)if(lineSt

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1