首页 > 学院 > 开发设计 > 正文

简单的画笔

2019-11-17 05:47:05
字体:
来源:转载
供稿:网友
#include"math.h"
#include"bios.h"
#include"dos.h"setfillstyle(1,7);
#include"graphics.h"
int v1=0,v2=0,v3=0,v4=0,v5=0,v6=0,v7=0,v8=0,v9=0,v0=0,vl=1;
int vl1=0,vl2=0,vl3=0,vl4=0,vl5=0,vl6=0,pl1=1,pl2=0,pl3=0,pl4=0;
int tl1=1,tl2=0,tl3=0,tl4=0,tl5=1,tl6=0,tl7=0,tl8=0;
void *au,*bu,*baru,*tfsu;
union REGS regs;
void drawmat(char *mat,int matsize,int x,int y,int color)
/*依次:字模指针、点阵大小、起始坐标(x,y)、颜色*/
{int i,j,k,n;
 n=(matsize-1)/8+1;
 for(j=0;j<matsize;j++)
  for(i=0;i<n;i++)
   for(k=0;k<8;k++)
    if(mat[j*n+i]&(0x80>>k))  /*测试为1的位则显示*/
     putpixel(x+i*8+k,y+j,color);
}char shan16[]={
/* 以下是 '山' 的 16点阵宋体 字模,32 byte */
0x00,0x00,0x01,0x00,0x01,0x00,0x01,0x00,
0x01,0x00,0x01,0x00,0x01,0x08,0x21,0x08,
0x21,0x08,0x21,0x08,0x21,0xF8,0x2E,0x08,
0x30,0x08,0x00,0x00,0x00,0x00,0x00,0x00, };char dong16[]={
/* 以下是 'dong' 的 16点阵宋体 字模,32 byte */
0x01,0x00,0x01,0x00,0x02,0x00,0x03,0xF0,
0x3C,0x00,0x05,0x00,0x09,0x00,0x11,0xF0,
0x1F,0x00,0x01,0x00,0x09,0x20,0x09,0x10,
0x11,0x08,0x23,0x00,0x01,0x00,0x00,0x00,};char da16[]={
/* 以下是 '点' 的 16点阵宋体 字模,32 byte */
0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x00,
0x02,0x00,0x03,0xF0,0x3E,0x00,0x02,0x00,
0x05,0x00,0x04,0x80,0x08,0x40,0x10,0x20,
0x20,0x18,0x40,0x0E,0x00,0x00,0x00,0x00,};char xue16[]={
/* 以下是 '阵' 的 16点阵宋体 字模,32byte */
0x00,0x20,0x12,0x20,0x09,0x20,0x00,0x40,
0x23,0xFC,0x3C,0x08,0x63,0xC0,0x44,0x80,
0x01,0x00,0x01,0xF8,0x7E,0x80,0x00,0x80,
0x00,0x80,0x02,0x80,0x01,0x00,0x00,0x00,};char wei16[]={
/* 以下是 '宋' 的 16点阵宋体 字模,32 byte */
0x01,0x00,0x01,0x20,0x01,0x10,0x01,0xE0,
0x3F,0x00,0x21,0x00,0x22,0x90,0x2C,0x90,
0x27,0x50,0x3D,0x60,0x2A,0x20,0x44,0x52,
0x4A,0x8A,0x91,0x06,0x00,0x00,0x00,0x00,};char hai16[]={
/* 以下是 '体' 的 16点阵宋体 字模,32 byte */
0x01,0x00,0x01,0x00,0x21,0x70,0x13,0x80,
0x04,0x30,0x43,0xD0,0x22,0x90,0x02,0xFE,
0x1F,0x90,0x22,0x90,0x24,0x10,0x47,0xFC,
0x40,0x20,0x00,0xA0,0x00,0x40,0x00,0x00,};char fen16[]={
/* 以下是 '字' 的 16点阵隶书 字模,32 byte */
0x00,0x00,0x03,0x00,0x00,0x80,0x04,0x40,
0x04,0x20,0x08,0x18,0x10,0x0E,0x21,0xC0,
0xDE,0x40,0x02,0x40,0x04,0x40,0x08,0x40,
0x12,0x80,0x61,0x00,0x00,0x00,0x00,0x00,};char xiao16[]={
/* 以下是 '模' 的 24点阵楷体_GB2312 字模,72 byte */
0x00,0x00,0x10,0xC0,0x10,0x20,0x10,0x78,
0x13,0x80,0x1C,0x30,0x71,0x08,0x12,0x20,
0x39,0x20,0x54,0xA0,0x90,0x40,0x10,0xA0,
0x11,0x18,0x16,0x0E,0x10,0x00,0x00,0x00,};char dian32[]={
/* 以下是 '灌' 的 32点阵黑体 字模,128 byte */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,
0x00,0x03,0x00,0x00,0x00,0x03,0x00,0x00,
0x00,0x03,0x00,0x00,0x00,0x03,0x00,0x00,
0x07,0xFF,0xFF,0x80,0x06,0x03,0x00,0x80,
0x06,0x03,0x00,0x80,0x06,0x03,0x00,0x80,
0x06,0x03,0x00,0x80,0x06,0x03,0x00,0x80,
0x07,0xFF,0xFF,0x80,0x07,0xFF,0xFF,0x80,
0x06,0x03,0x00,0x80,0x06,0x03,0x00,0x80,
0x06,0x03,0x00,0x80,0x06,0x03,0x00,0x80,
0x06,0x03,0x00,0x80,0x07,0xFF,0xFF,0x80,
0x06,0x03,0x00,0x00,0x06,0x03,0x00,0x00,
0x06,0x03,0x00,0x00,0x06,0x03,0x00,0x00,
0x00,0x03,0x00,0x18,0x00,0x01,0x00,0x18,
0x00,0x01,0xFF,0xF0,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};char zi32[]={
/* 以下是 '灌' 的 32点阵方正黄草简体 字模,128 byte */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x03,0xFF,0xFF,0xC0,0x03,0xFF,0xFF,0xC0,
0x00,0x00,0x03,0x80,0x00,0x00,0x06,0x00,
0x00,0x00,0x18,0x00,0x00,0x00,0x70,0x00,
0x00,0x01,0xC0,0x00,0x00,0x01,0x80,0x00,
0x00,0x01,0x80,0x00,0x00,0x01,0x80,0x00,
0x00,0x01,0x80,0x00,0x3F,0xFF,0xFF,0xFC,
0x3F,0xFF,0xFF,0xFC,0x00,0x01,0x80,0x00,
0x00,0x01,0x80,0x00,0x00,0x01,0x80,0x00,
0x00,0x01,0x80,0x00,0x00,0x01,0x80,0x00,
0x00,0x01,0x80,0x00,0x00,0x01,0x80,0x00,
0x00,0x01,0x80,0x00,0x00,0x01,0x80,0x00,
0x00,0x01,0x80,0x00,0x00,0x01,0x80,0x00,
0x00,0x1F,0x80,0x00,0x00,0x0F,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,};char xi32[]={
/* 以下是 'xi' 的 32点阵楷体_GB2312 字模,128 byte */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xC0,
0x00,0x00,0x7F,0xE0,0x07,0xFF,0xC0,0x00,
0x00,0x02,0x00,0x00,0x00,0x03,0x00,0x00,
0x00,0x04,0x00,0x00,0x00,0x08,0x06,0x00,
0x00,0x10,0x0E,0x00,0x00,0x60,0x18,0x00,
0x01,0xFF,0xE0,0x00,0x00,0x81,0x80,0x00,
0x00,0x03,0x00,0x00,0x00,0x04,0x03,0x00,
0x00,0x18,0x00,0x80,0x00,0x60,0x00,0xE0,
0x03,0xFF,0xFF,0xF0,0x03,0xE0,0xC0,0x38,
0x00,0x00,0xC0,0x10,0x00,0x00,0xC0,0x00,
0x00,0x00,0xC0,0x00,0x00,0xC0,0xC3,0x00,
0x01,0x80,0xC1,0xC0,0x03,0x00,0xC0,0x60,
0x06,0x00,0xC0,0x30,0x0C,0x00,0xC0,0x10,
0x00,0x0F,0x80,0x00,0x00,0x07,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,};
char yao32[]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x40,0x42,0x00,
0x00,0x60,0x46,0x00,0x00,0xC0,0x66,0x00,
0x00,0x80,0x64,0x00,0x01,0x06,0x64,0x60,
0x03,0x03,0x64,0xC0,0x33,0x30,0x64,0x00,
0x7F,0xF0,0x64,0x00,0x06,0x20,0x64,0x00,
0x06,0x23,0x45,0x80,0x02,0x46,0x44,0x40,
0x01,0xC0,0x44,0x00,0x01,0xC0,0x46,0x00,
0x03,0x30,0xC6,0x00,0x06,0x01,0x83,0x82,
0x3C,0x07,0x03,0xFC,0x10,0x1E,0x01,0xFC,
0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,};
char peng32[]=;
void initgr(void) /* BGI初始化 */
{
  int gd = DETECT, gm = 0; /* 和gd = VGA,gm = VGAHI是同样效果 */
  registerbgidriver(EGAVGA_driver);/* 注册BGI驱动后可以不需要.BGI文件的支持运行 */
  initgraph(&gd, &gm, "");
}
main()
{
void *zu,*su,*ku,*lu,*pu,*textu,*blu,*disku, *lineu,*barul,*plineu;
int m1=0,m2=0,m3=0,m4=0,m5=0;
int ls,bs,ds,ts,tfs,tlf=1,tls=1;
int s,i,j,z,s1,p,b,pl=1,k=0,a=0,l=0,m=0,x1,x2,y1,y2,n=0,x,y,disksize,ftcolor=15,bkcolor=1,r,butto,get();
int put(),v=0,fbcolor(),radius(),putl(),linestyle(),putbar(),textfontsize(),textout();
 initgr() ;
setfillstyle(1,15);
bar(0,0,70,120);
setcolor(0);
rectangle(5,5,65,115);
settextstyle(0,0,1);
outtextxy(10,10,"New");
outtextxy(10,30,"Open");
outtextxy(10,50,"Save");
outtextxy(10,70,"OSave");
outtextxy(10,90,"Exit");
z=imagesize(0,0,70,120);
ku=malloc(z);
getimage(0,0,70,120,ku);
cleardevice();setcolor(10);
rectangle(2,2,639,479);
setfillstyle(1,1);
bar(3,3,638,478);
setfillstyle(1,2);
bar(4,4,638,15);
bar(4,17,55,478);
bar(4,420,638,478);
setcolor(15);
line(3,16,638,16);
line(56,16,56,478);
line(3,419,638,419);
setcolor(12);
settextstyle(0,0,1);
outtextxy(15,7,"File");
outtextxy(590,7,"Exit");
rectangle(8,40,26,56);
ellipse(43,48,0,360,10,8);
line(8,68,25,75);
settextstyle(4,0,2);
outtextxy(38,70,"A");
settextstyle(0,0,1);
line(16,85,8,101);
line(16,85,26,101);
setlinestyle(0,0,3);
line(43,85,43,98);
setlinestyle(0,0,1);
line(43,102,40,95);
line(43,102,46,95);
bar3d(10,117,19,120,5,9);
setfillstyle(1,1);
bar(36,110,50,123);
bar(14,136,20,142);
fillellipse(43,139,8,6);
setfillstyle(1,15);
bar(8,425,28,445);
setcolor(8);setfillstyle(1,1);
bar(30,450 ,51,473);for(i=0;i<8;i++)

for(i=8;i<16;i++)

setcolor(15);
rectangle(68,423,302,472);
line(68,447,302,447 );
for(i=0;i<7;i++)
{ setlinestyle(0,0,3);
  line(95+i*30,425,95+i*30,470);}
ds=imagesize(8,200,50,370);
plineu=malloc(ds);
getimage(8,200,50,370,plineu);
a=0;
setwritemode(1);
settextstyle(0,0,1);
drawmat(shan16,16,220,125,RED);
 drawmat(dong16,16,250,125,RED);
 drawmat(da16,16,280,125,GREEN);
 drawmat(xue16,16,310,125,GREEN);
 drawmat(wei16,16,340,125,YELLOW);
 drawmat(hai16,16,370,125,YELLOW);
 drawmat(fen16,16,400,125,GREEN);
 drawmat(xiao16,16,430,125,GREEN);
 drawmat(dian32,32,300,140,RED);
 drawmat(zi32,32,340,140,YELLOW);
 drawmat(xi32,32,380,140,GREEN);
 drawmat(yao32,32,310,180,GREEN);
 drawmat(peng32,32,350,180,GREEN);
for(;;)
{
regs.x.ax=3;
int86(0x33,?s,?s);
x=regs.x.cx;
y=regs.x.dx;
butto=regs.x.bx;
get(x,y,vl);get(x,y,vl);
if(x>590&&x<620&&y>5&&y<14)
{ if(a==0)
  if(butto==1)
      { closegraph();exit(0);}  }
  else
  { if(a==1) }if(x>15&&x<45&&y>5&&y<14)
 { if(k==0) }
  else
     { if(k==1) { setcolor(0);outtextxy(15,7,"File");k=0;}   } if(x>15&&x<45&&y>5&&y<14&&m==0&&butto==0)
               {s1=imagesize(16,16,86,136);
            lu=malloc(s1);
            getimage(16,16,86,136,lu);
        putimage(16,16,ku,0);  m=1;}
    if((x<16x>86y<16y>136)&&butto==1&&m==1)
    { putimage(16,16,lu,0);m=0;}
if(m==1)
  { if(x>16&&x<86&&y>26&&y<36)
     { if(m1==0) { setcolor(RED);outtextxy(26,26,"New");m1=1;}
       if(butto==1) {  putimage(16,16,lu,0);m=0;ftcolor=15;setfillstyle(1,ftcolor);
                            bar(8,425,28,445);
                           bkcolor=1;setfillstyle(1,bkcolor);  bar(30,450,51,473);
                             bar(57,17,637,418);} }
       else
     { if(m1==1) }
     if(x>16&&x<86&&y>46&&y<56) { if(m2==0) { setcolor(RED);outtextxy(26,46,"Open");m2=1;}}
         else  { if(m2==1) }
      if(x>16&&x<86&&y>66&&y<76) { if(m3==0) { setcolor(RED);outtextxy(26,66,"Save");m3=1;}}
         else  { if(m3==1) }
      if(x>16&&x<86&&y>86&&y<96) { if(m4==0) { setcolor(RED);outtextxy(26,86,"OSave");m4=1;}}
     else  { if(m4==1) }
     if(x>16&&x<86&&y>106&&y<116) { if(m5==0) { setcolor(RED);outtextxy(26,106,"Exit");m5=1;}
                    if(butto==1)
                     { closegraph();exit(0);}   }
     else  { if(m5==1) { setcolor(BLACK);outtextxy(26,106,"Exit");m5=0;}}
   }
if(x>8&&x<26&&y>40&&y<56&&butto==1&&m==0)
  { if(v1==0) { putimage(7,39,au,1);v1=1;
        put(v,&au);v=1;putimage(8,200,plineu,0);putimage(8,200,lineu,0);
                 vl1=0,vl2=0,vl3=0,vl4=0,vl5=0,vl6=0;
        putimage(11,207,baru,1);vl1=1; vl=1;pl=1;tlf=1;tls=1;}        }
if(x>33&&x<53&&y>40&&y<56&&butto==1&&m==0)
   { if(v2==0) {putimage(33,39,au,1);v2=1;
     put(v,&au);v=2; putimage(8,200,plineu,0);vl=1;pl=1;tlf=1;tls=1;}
   }
if(x>8&&x<26&&y>65&&y<79&&butto==1&&m==0)
    { if(v3==0) {putimage(7,63,au,1);v3=1;
                 put(v,&au);v=3;putimage(8,200,plineu,0);putimage(8,200,lineu,0);
                  vl1=0,vl2=0,vl3=0,vl4=0,vl5=0,vl6=0;
                 putimage(11,207,baru,1);vl1=1;vl=1;pl=1;tlf=1;tls=1;}
    }
if(x>33&&x<53&&y>65&&y<79&&butto==1&&m==0)
    { if(v4==0) {putimage(33,63,au,1);v4=1;
       put(v,&au);v=4;putimage(8,200,plineu,0);vl=1;pl=1;
      tl1=1,tl2=0,tl3=0,tl4=0,tl5=1,tl6=0,tl7=0,tl8=0;tlf=1;tls=1;
      putimage(8,200,textu,0);putimage(22,217,tfsu,1);
      putimage(11,310,baru,1); }                    }
if(x>8&&x<26&&y>85&&y<101&&butto==1&&m==0)
    { if(v5==0) {putimage(7,84,au,1);v5=1;
       put(v,&au);v=5; putimage(8,200,plineu,0);vl=1; pl=1;tlf=1;tls=1;}
    }
if(x>33&&x<53&&y>85&&y<101&&butto==1&&m==0)
    { if(v6==0) {putimage(33,84,au,1);v6=1;
       put(v,&au);v=6;  putimage(8,200,plineu,0);vl=1;pl=1;tlf=1;tls=1;}
    }
if(x>8&&x<26&&y>110&&y<126&&butto==1&&m==0)
    { if(v7==0) {putimage(7,107,au,1);v7=1;
      put(v,&au);v=7;  putimage(8,200,plineu,0); vl=1;pl=1;tlf=1;tls=1;}
    }
if(x>34&&x<52&&y>111&&y<125&&butto==1&&m==0)
    { if(v8==0)  {putimage(33,107,au,1);v8=1;
      put(v,&au); v=8; putimage(8,200,plineu,0);vl=1;pl=1;tlf=1;tls=1;}
    }
if(x>8&&x<26&&y>130&&y<144&&butto==1&&m==0)
    { if(v9==0)  { putimage(7,130,au,1);v9=1;
      put(v,&au);v=9; putimage(8,200,plineu,0);vl=1;putimage(8,200,pu,0);
      pl1=1,pl2=0,pl3=0,pl4=0;pl=1;
      putimage(22,204,bu,1);tlf=1;tls=1;}}
if(x>34&&x<52&&y>130&&y<144&&butto==1&&m==0)
    { if(v0==0)  { putimage(33,130,au,1);v0=1;
      put(v,&au); v=10; putimage(8,200,plineu,0);vl=1;pl=1;tlf=1;tls=1;}
    }
/*set frant color */
setcolor(ftcolor);
if(x>70&&x<300&&y>425&&y<470&&butto==1)
 { ftcolor=fbcolor(x,y,butto); setcolor(ftcolor);
   setfillstyle(1,ftcolor);bar(8,425,28,445);  }
 if(x>70&&x<300&&y>425&&y<470&&butto==2)
 { bkcolor=fbcolor(x,y,butto); setfillstyle(1,bkcolor);
    bar(30,450,51,473);
   bar(57,17,637,418);setcolor(ftcolor);   }
/*set image */
if(v==7&&butto==1&&x>59&&x<635&&y>19&&y<416)
  { setfillstyle(1,bkcolor);bar(x-3,y-3,x+3,y+3);}
if(v==6&&butto==1&&x>56&&x<638&&y>16&&y<419)
 { putpixel(x,y,ftcolor);putpixel(x,y,ftcolor);putpixel(x,y,ftcolor);}
if(v==9&&butto==1&&x>58&&x<636&&y>18&&y<417)
 { setfillstyle(1,ftcolor);
   switch(pl)
     { case 1 :  bar(x-1,y-1,x+1,y+1);break;
       case 3 :  setwritemode(0); setlinestyle(0,0,3);
         line(x-2,y+2,x+2,y-2);setwritemode(1);break;
       case 2 :  setwritemode(0); setlinestyle(0,0,3);
        line(x+2,y+2,x-2,y-2); setwritemode(1);break;
       case 4 : fillellipse(x,y,2,2);break;  }
 }
if(v==5&&butto==1&&x>57&&x<637&&y>17&&y<418)
 { x1=x;y1=y;ftcolor=getpixel(x1,y1);setcolor(ftcolor);
   setfillstyle(1,ftcolor);bar(8,425,28,445);}
if(v==3&&x>56&&x<638&&y>16&&y<419)
 {
  if(butto==1&&n==0)
       { x1=x;y1=y;putpixel(x1,y1,ftcolor);n=1;}
     if(butto==0&&n==1)
      { x2=x;y2=y;setwritemode(0);line(x1,y1,x2,y2);n=0;setwritemode(1);}
  }
if(v==8&&x>57&&x<637&&y>17&&y<418)
 { if((bioskey(2)&0x02)==0x02)
       { if(butto==1&&n==0)
      { x1=x;y1=y;putpixel(x1,y1,ftcolor);n=1;}
          if(butto==0&&n==1)
         { x2=x;y2=y;setfillstyle(1,ftcolor);
        if(x2>x1&&y2<y1) bar(x1,y1,x1+abs(y2-y1),y2);
        if((x1<x2&&y1<y2)(x2<x1&&y2<y1)&&((x1+y2-y1)>56))
           bar(x1,y1,x1+y2-y1,y2);
        if(x2<x1&&y2>y1&&((x1+y1-y2)>56))
           bar(x1,y1,x1+y1-y2,y2);  n=0;}
 }   else
    { if(butto==1&&n==0)
      { x1=x;y1=y;putpixel(x1,y1,ftcolor);n=1;}
          if(butto==0&&n==1)
         { x2=x;y2=y;setfillstyle(1,ftcolor);
           bar(x1,y1,x2,y2);n=0;}    }
 }
 if(v==1&&x>56&&x<638&&y>16&&y<419)
   { if((bioskey(2)&0x02)==0x02)
       { if(butto==1&&n==0)
      { x1=x;y1=y;putpixel(x1,y1,ftcolor);n=1;}
          if(butto==0&&n==1)
         { x2=x;y2=y;  setwritemode(0);
        if(x2>x1&&y2<y1) rectangle(x1,y1,x1+abs(y2-y1),y2);
        if((x1<x2&&y1<y2)(x2<x1&&y2<y1)&&((x1+y2-y1)>56))
           rectangle(x1,y1,x1+y2-y1,y2);
        if(x2<x1&&y2>y1&&((x1+y1-y2)>56))
         rectangle(x1,y1,x1+y1-y2,y2);n=0; setwritemode(1); }
      }
    else
     {  if(butto==1&&n==0)
          { x1=x;y1=y;putpixel(x1,y1,ftcolor);n=1;}
         if(butto==0&&n==1)
        { x2=x;y2=y;setwritemode(0);rectangle(x1,y1,x2,y2);n=0;setwritemode(1);}
      }  }
 if(v==2&&x>56&&x<638&&y>16&&y<419)
   { setlinestyle(0,0,1);
     if((bioskey(2)&0x02)==0x02)
        { if(butto==1&&n==0)
      
           if(butto==0&&n==1)
         { x2=x;y2=y;r=radius((double)x1,(double)y1,(double)x2,(double)y2);
                (int)x1;(int)y1;(int)x2;(int)y2;
        if((x1+r)<637&&(x1-r)>57&&(y1+r)<418&&(y1-r)>17)
           {circle(x1,y1,r); }
                 else
                     putpixel(x1,y1,bkcolor);n=0;} }
      else
       { if(butto==1&&n==0)
           {  x1=x;y1=y;putpixel(x1,y1,ftcolor);n=1;}
          if(butto==0&&n==1)
            {x2=x;y2=y;
         ellipse(x1+(x2-x1)/2,y1+(y2-y1)/2,0,360,abs((x2-x1)/2),abs((y2-y1)/2));
         putpixel(x1,y1,bkcolor);n=0;}    }
    }
 if(v==10&&x>56&&x<638&&y>16&&y<419)
   { if((bioskey(2)&0x02)==0x02)
        { if(butto==1&&n==0)
      
           if(butto==0&&n==1)
         { x2=x;y2=y;r=radius((double)x1,(double)y1,(double)x2,(double)y2);
                 (int)x1;(int)y1;(int)x2;(int)y2;
        if((x1+r)<637&&(x1-r)>57&&(y1+r)<418&&(y1-r)>17)
           {setfillstyle(1,ftcolor);fillellipse(x1,y1,r,r); }
                   else
                     putpixel(x1,y1,bkcolor);n=0;} }
      else
       { if(butto==1&&n==0)
           {  x1=x;y1=y;putpixel(x1,y1,ftcolor);n=1;}
          if(butto==0&&n==1)
            {x2=x;y2=y;
         fillellipse(x1+(x2-x1)/2,y1+(y2-y1)/2,abs((x2-x1)/2),abs((y2-y1)/2));
         putpixel(x1,y1,bkcolor);n=0;}    }
    }
  if(v==4&&x>56&&x<638&&y>40&&y<400&&butto==1)
      { settextjustify(0,1);textout(x,y,tlf,tls);butto=0;settextjustify(0,2);settextstyle(0,0,1); }
  if(v==4&&x>56&&x<638&&y>400&&y<405&&butto==1)
   {   settextjustify(0,0); textout(x,y,tlf,tls);butto=0;settextjustify(0,2);settextstyle(0,0,1);  }
   if(v==4&&x>56&&x<638&&y>30&&y<40&&butto==1)
   {   settextjustify(0,1); textout(x,y,tlf,tls);butto=0;settextjustify(0,2);settextstyle(0,0,1);  }
/* set textout */
if(v==4&&x>8&&x<50&&y>200&&y<370&&butto==1)
  {
    if(y>200&&y<298)
       { if(x>8&&x<50&&y>217&&y<230&&tl1==0)
      {  textfontsize1(tlf,&tfsu);putimage(22,217,tfsu,1);tl1=1;tlf=1;}
     if(x>8&&x<50&&y>233&&y<247&&tl2==0)
      {  textfontsize1(tlf,&tfsu);putimage(22,233,tfsu,1);tl2=1;tlf=2;}
     if(x>8&&x<50&&y>254&&y<268&&tl3==0)
      {  textfontsize1(tlf,&tfsu);putimage(21,254,tfsu,1);tl3=1;tlf=3;}
     if(x>8&&x<50&&y>273&&y<287&&tl4==0)
      {  textfontsize1(tlf,&tfsu);putimage(21,273,tfsu,1);tl4=1;tlf=4;}
    }
      if(y>298&&y<370)
       { if(x>8&&x<50&&y>310&&y<318&&tl5==0)
     { textfontsize2(tls,&baru);putimage(11,310,baru,1);tl5=1;tls=1;}
     if(x>8&&x<50&&y>324&&y<332&&tl6==0)
     { textfontsize2(tls,&baru);putimage(11,325,baru,1);tl6=1;tls=2;}
     if(x>8&&x<50&&y>339&&y<348&&tl7==0)
     { textfontsize2(tls,&baru);putimage(11,340,baru,1);tl7=1;tls=3;}
     if(x>8&&x<50&&y>354&&y<362&&tl8==0)
     { textfontsize2(tls,&baru);putimage(11,355,baru,1);tl8=1;tls=4;}
    }
   }
/* set linestyle */
if(x>8&&x<50&&y>200&&y<301&&butto==1&&(v==1v==3))
 {
   if(x>11&&x<47&&y>206&&y<215&&vl1==0)
     
   if(x>11&&x<47&&y>221&&y<229&&vl2==0)
     
   if(x>11&&x<47&&y>236&&y<244&&vl3==0)
     
   if(x>11&&x<47&&y>251&&y<259&&vl4==0)
     
   if(x>11&&x<47&&y>266&&y<274&&vl5==0)
     
   if(x>11&&x<47&&y>281&&y<289&&vl6==0)
     
 }
/*set bar*/
 if(x>8&&x<48&&y>200&&y<280&&butto==1&&v==9)
 {
    if(x>22&&x<33&&y>205&&y<215&&pl1==0)
      { putbar(pl,bu);putimage(22,204,bu,1);pl1=1;pl=1;}
    if(x>22&&x<33&&y>225&&y<235&&pl2==0)
      { putbar(pl,bu);putimage(22,224,bu,1);pl2=1;pl=2;}
    if(x>22&&x<33&&y>245&&y<255&&pl3==0)
      { putbar(pl,bu);putimage(22,244,bu,1);pl3=1;pl=3;}
    if(x>22&&x<33&&y>265&&y<275&&pl4==0)
      { putbar(pl,bu);putimage(22,264,bu,1);pl4=1;pl=4;}
  }
}
}
putbar(int pl,int *blu)
{
 switch(pl)
  { case 1 : putimage(22,204,bu,1);pl1=0;break;
    case 2 : putimage(22,224,bu,1);pl2=0;break;
    case 3 : putimage(22,244,bu,1);pl3=0;break;
    case 4 : putimage(22,264,bu,1);pl4=0;break;
    default : break;
 }
}
linestyle(vl)
{
 switch(vl)
  { case 1 : setlinestyle(0,0,1);break;
    case 2 : setlinestyle(1,0,1);break;
    case 3 : setlinestyle(2,0,1);break;
    case 4 : setlinestyle(0,0,3);break;
    case 5 : setlinestyle(1,0,3);break;
    case 6 : setlinestyle(2,0,3);break;
    default : break;
  }
}
putl(int vl,int *barul)
{
switch(vl)
  {
    case 1 : putimage(11,207,baru,1);vl1=0;break;
    case 2 : putimage(11,222,baru,1);vl2=0;break;
    case 3 : putimage(11,237,baru,1);vl3=0;break;
    case 4 : putimage(11,252,baru,1);vl4=0;break;
    case 5 : putimage(11,267,baru,1);vl5=0;break;
    case 6 : putimage(11,282,baru,1);vl6=0;break;
    default : break; }
} put(int xv,int *zu)
{
switch(xv)
{
   case 1 :  putimage(7,39,au,1);v1=0;break;
   case 2 :  putimage(33,39,au,1);v2=0;break;
   case 3 :  putimage(7,63,au,1); v3=0;break;
   case 4 :  putimage(33,63,au,1);v4=0;break;
   case 5 :  putimage(7,84,au,1); v5=0;break;
   case 6 :  putimage(33,84,au,1); v6=0;break;
   case 7 :  putimage(7,107,au,1); v7=0;break;
   case 8 :  putimage(33,107,au,1); v8=0;break;
   case 9 :  putimage(7,130,au,1);v9=0;break;
   case 10 : putimage(33,130,au,1);v0=0;break;
   case 0 :  break;
 }
     }
get(x,y,vl)

fbcolor(int x1,int y1,int butto2)
{
 if(y1>425&&y1<445)
  {
    if(x1>70&&x1<90&&(butto2==1butto2==2)) return(0);
    if(x1>100&&x1<120&&(butto2==1butto2==2)) return(1);
    if(x1>130&&x1<150&&(butto2==1butto2==2)) return(2);
    if(x1>160&&x1<180&&(butto2==1butto2==2)) return(3);
    if(x1>190&&x1<210&&(butto2==1butto2==2)) return(4);
    if(x1>220&&x1<240&&(butto2==1butto2==2)) return(5);
    if(x1>250&&x1<270&&(butto2==1butto2==2)) return(6);
    if(x1>280&&x1<300&&(butto2==1butto2==2)) return(7);
    }
  if(y1>450&&y1<470)
   {if(x1>70&&x1<90&&(butto2==1butto2==2)) return(8);
    if(x1>100&&x1<120&&(butto2==1butto2==2)) return(9);
    if(x1>130&&x1<150&&(butto2==1butto2==2)) return(10);
    if(x1>160&&x1<180&&(butto2==1butto2==2)) return(11);
    if(x1>190&&x1<210&&(butto2==1butto2==2)) return(12);
    if(x1>220&&x1<240&&(butto2==1butto2==2)) return(13);
    if(x1>250&&x1<270&&(butto2==1butto2==2)) return(14);
    if(x1>280&&x1<300&&(butto2==1butto2==2)) return(15);
   }}
radius(double rx1,double ry1,double rx2,double ry2)
{
double w1,w2,w3;
int w4;
 w1=pow(rx2-rx1,2);
 w2=pow(ry2-ry1,2);
 w3=sqrt(w1+w2);
 w4=(int)w3;
return(w4);
}textout(int xt,int yt,int font,int size)
{
 char far *c;
 int font0,size0;
 switch(font)
   {  case 1 :   font0=0;break;
      case 2 :  font0=1;break;
      case 3 : font0=3;break;
      case 4 : font0=4;break;
      default : break;
      }
 switch(size)
   {  case 1 : size0=1;break;
      case 2 : size0=3;break;
      case 3 : size0=5;break;
      case 4 : size0=7;break;
      default : break;
      }
  settextstyle(font0,0,size0);
 moveto(xt,yt);
 line(xt-1,yt-10,xt-1,yt+10);
 setwritemode(0);
 for(;;)
  {
    *c=getch();
    if(*c==13)
      break;
      else
       outtext(c);
   }
       setwritemode(1);
       line(xt-1,yt-10,xt-1,yt+10);
   return;
 }
 textfontsize1(int tlf,int *tfsu1)
{
  switch(tlf)
    { case 1 :  putimage(22,217,tfsu,1);tl1=0;break;
      case 2 :  putimage(22,233,tfsu,1);tl2=0;break;
          case 3 :  putimage(21,254,tfsu,1);tl3=0;break;
          case 4 :  putimage(21,273,tfsu,1);tl4=0;break;
          default : break;
        }
}
  textfontsize2(int tls,int *baru1)
{
  switch(tls)
          { case 1 :putimage(11,310,baru,1);tl5=0;break;
        case 2 :putimage(11,325,baru,1);tl6=0;break;
        case 3 :putimage(11,340,baru,1);tl7=0;break;
        case 4 :putimage(11,355,baru,1);tl8=0;break;
            default : break;
          }
}


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表