//************** Paint Brush *************//
//Vs var used when mnuViewBitmapClick is running its status is toggled //
//that function called two times in else if statement first to showing Bitmap
//second to
//cs==1 when called in mnuFileNew,0 in exit,2 when save
#include<iostream.h>
#include<stdio.h>
#include<fstream.h>
#include<conio.h>
#include<graphics.h>
#include<math.h>
#include<ctype.h>
#include<dos.h>
#include<time.h>
#include<stdlib.h>
int forecolor=0,backcolor=15;
int fillcolor(int,int,int,int);
void show_Cursor(void);
void hide_Cursor(void);
void gimage(int,int,int,int);
void pimage(int,int,int,int);
void tool_gimage(int,int,int,int);
void tool_pimage();
void clipboard(int,int,int,int);
void rollg(int,int,int,int);
void elli_rollg(int,int,int,int);
void rollp();
void mnuColorEditColor_click(int,int);
void paste();
void mnuViewToolbar_click();
void mnuViewColorBox_click();
void mnuViewStatusBar_click();
void mnuViewBitmap_click();
void mnuFileNew_click();
void mnuFileOpen_click();
void mnuFileSave_click(int);
//void mnuFileSaveas_click();
void mnuFileExit_click(int);
void mnuEditSelectAll_click();
void DB_gimage(int,int,int,int);
void DB_pimage();
void EDB_gimage(int,int,int,int);
void mnuImageFlipv_click();
void mnuImageFliph_click();
void mnuImageClearImage_click();
void EDB_pimage();
void dlgDB(int);
void save(char *);
void open(char *);
union REGS in,out;
int toolselect=0;
int status=0,status1=0;
int xx,yy,xx1,yy1,sx,sy,sx1,sy1,mx,mx1,my,my1,fx;
int menu=0,selected=0,stop=0,SA=0;
int Ts=0,St=0,Ct=0,inc=0,Vs=0,incx=0,incy=0;
void main()
{
int gd=0,gm,getx,gety,x,y=6,i;
int a[18];
char file[][10]={ "New",
"Open",
"Save",
"Save As",
"Exit"
};
char edit[][12]={"Cut",
"Copy",
"Paste",
"Select All",
};
char view[][15]={"Tool Box",
"Color Box",
"Status Bar",
"Text Toolbar",
"Zoom",
"View Bitmap"
};
char image[][25]={"Flip Horiz...",
"Flip Vertical",
"Stretch...",
"Clear Image",
};
char color[][20]={"Edit Colors..."};
char help[][15]={"Help Topics",
"About Paint"
};
gd=DETECT;
initgraph(&gd,&gm,"");
remove ("roll");
remove("image");
remove("Screen");
remove("coc");
remove("Bitmap");
remove("toc");
remove("exitDB");
remove("dbim");
remove("save");
getx=getmaxx();
gety=getmaxy();
setfillstyle(1,15);
bar(2,2,getx-2,gety-2);
setfillstyle(1,1);
bar(5,4,getx-5,20);
setcolor(9);
line(5,22,getx-2,22);
setcolor(15);
outtextxy(15,9,"untitled-Paint");
for(x=590;x<628;x+=15)
{
setfillstyle(1,7);
bar(x,y,x+12,y+12);
setcolor(15);
line(x,y,x,y+12);
line(x,y,x+12,y);
setcolor(0);
line(x+12,y,x+12,y+12);
line(x,y+12,x+12,y+12);
}
rectangle(609,9,614,12);
rectangle(608,11,613,15);
setlinestyle(0,0,3);
line(593,12,598,12);
line(608+15,10,614+15,14);
line(614+15,10,608+15,14);
/////menu bar
setfillstyle(1,7);
bar(2,22,getx-2,40);
settextstyle(2,0,5);
outtextxy(10,24,"File");
outtextxy(48,24,"Edit");
outtextxy(84,24,"View");
outtextxy(126,24,"Image");
outtextxy(176,24,"Color");
outtextxy(223,24,"Help");
/////toolbar
bar(2,41,65,399);
///status bar
bar(3,456,getx-4,gety-4);
setcolor(8);
setlinestyle(0,0,1);
line(4,458,400,458);
line(404,458,520,458);
line(524,458,getx-5,458);
line(524,458,524,gety-5);
line(404,gety-4,404,458);
setcolor(15);
line(400,gety-4,400,458);
line(520,458,520,gety-4);
/////
bar(3,400,getx-4,455); //colorbar
/////////////////////
setlinestyle(0,0,1);
setcolor(15);
line(5,41,getx-2,41);
rectangle(3,3,getx-3,gety-3);
///Darkgray lines
setcolor(8);
rectangle(2,2,getx,gety);
line(2,2,2,getx-2);
line(5,23,getx-2,23);
line(5,40,getx-2,40);
line(3,454,getx-4,454);
line(3,400,getx-4,400);
////White lines
setcolor(15);
line(3,45,3,55);
line(3,455,getx-4,455);
line(3,401,getx-4,401);
setcolor(15);
rectangle(5,410,37,444);
line(38,427,216,427);
line(37,444,216,444);
//black lines
setcolor(0);
line(5,410,36,410);
line(5,410,5,442);
////tool buttons
for( x=9;x<=39;x+=27)
{
for( y=44;y<=220;y+=25)
{
setcolor(0);
line(x,y+23,x+23,y+23);
line(x+23,y,x+23,y+23);
setcolor(15);
line(x,y,x+23,y);
line(x,y,x,y+22);
}
}
setcolor(0);
setlinestyle(1,0,1);
rectangle(40,50,38+16,60);
setfillstyle(1,14);
setlinestyle(0,0,1);
bar3d(15,80,21,86,5,0);
rectangle(13,176+24,28,186+24);
ellipse(20,230,0,360,7,5);
//rectangle(40,176,38+16,186);
setlinestyle(0,0,1);
line(15,150+24,26,161+24);
///// desgin rectangle tool
setcolor(0);
line(40,179+48,40,183+48);
line(54,179+48,54,183+48);
line(43,186+48,51,186+48);
line(43,176+48,51,176+48);
putpixel(41,177+48,0);
putpixel(41,185+48,0);
putpixel(53,177+48,0);
putpixel(53,185+48,0);
/////pointlinetool
line(43,176+24,42,186+24);
line(43,186+24,51,186+24);
line(51,186+24,52,183+24);
line(52,183+24,47,183+24);
line(49,176+24,47,183+24);
line(49,176+24,43,176+24);
//// Below toolbuttons (tooloption rectangle)
line(13,245,13,320);
line(13,245,54,245);
setcolor(15);
line(54,245,54,320);
line(13,320,54,320);
///texttool
setcolor(0);
settextstyle(1,0,1);
outtextxy(41,144,"A");
////spray tool
line(21,127+24,27,130+24);
line(27,130+24,24,137+24);
line(24,137+24,17,134+24);
line(17,134+24,15,130+24);
line(21,127+24,17,128+24);
line(21,127+24,17,134+24);
//setlinestyle(0,1,3);
line(17,128+24,16,129+24);
i=1;
while(i<50)
{ x=random(5)+12;
y=random(10)+136+20;
putpixel(x,y,4);
i++;
}
///pencil tool
line(23,100+24,17,107+24);
line(27,103+24,21,111+24);
line(23,100+24,27,103+24);
line(21,111+24,17,107+24);
line(17,112+24,17,107+24);
line(17,112+24,21,111+24);
line(21,111+24,17,107+24);
setfillstyle(1,14);
floodfill(23,103+24,0);
///Droper tool
setlinestyle(0,0,1);
line(23,102,19,109);
line(26,103,22,111);
arc(25,102,20,90,3);
line(23,102,22,100);
////zoom
circle(45,103,5);
line(48,108,52,112);
line(50,106,54,110);
line(52,112,54,110);
setcolor(15);
arc(45,103,100,180,4);
arc(45,103,300,330,4);
//paint brush
setcolor(0);
setfillstyle(1,15);
bar(44,130,51,136);
line(43,136,51,136);
line(46,134,46,136);
line(48,134,48,136);
line(44,130,51,130);
line(44,130,44,136);
line(51,130,51,136);
line(44,130,44,128);
line(51,130,51,128);
line(51,128,49,126);
line(44,128,46,126);
line(46,126,46,122);
line(49,126,49,122);
line(46,122,49,122);
////filltool
a[0]=47;
a[1]=76;
a[2]=50;
a[3]=77;
a[4]=51;
a[5]=76;
a[6]=55;
a[7]=78;
a[8]=52;
a[9]=84;
a[10]=47;
a[11]=82;
a[12]=46;
a[13]=80;
a[14]=46;
a[15]=80;
a[16]=a[0];
a[17]=a[1];
setfillstyle(1,1);
drawpoly(9,a);
i=1;
while(i<50)
{ x=random(5)+40;
y=random(10)+80;
putpixel(x,y,1);
i++;
}
/* colorboxes */
int m=412,c;
setlinestyle(0,0,1);
for( i=0,c=0,x=38;x<=200;x+=20,i++,c++)
{
setcolor(15);
line(x+19,411,x+19,444);
//rectangle(x,428,x+18,444);
setcolor(0);
line(x+2,411,x+2,426);
line(x+2,428,x+2,443);
line(x+2,411,x+17,411);
line(x+2,429,x+17,429);
setcolor(8);
line(x+1,410,x+1,426);
line(x+1,428,x+1,443);
line(x+1,410,x+18,410);
line(x+1,428,x+18,428);
if(c==6)c++;
setfillstyle(1,c);
if(i==7)m=429,x=38;
if(i<18)
bar(x+3,m,x+17,m+14);
}
show_Cursor();
int d=8,q=25,d1=38,q1=38;
int tx=9,ty=44;
int mm,nn;
char px[4],py[4];
mnuViewToolbar_click();
mnuViewColorBox_click();
mnuViewStatusBar_click();
//toolselect=2;
while(1)
{
char *a[5];
in.x.ax=3;
int86(0x33,&in,&out);
x=out.x.cx;
y=out.x.dx;
if(out.h.bl==1)
{
///File Menu
if(Vs!=1)
{
if((x>=10&&x<=40)&&(y>=24&&y<=35))
{
hide_Cursor();
if(menu!=0)
{
pimage(d,q,d1,q1);
}
else
{
gimage(mx,my,mx1,my1);
pimage(d,q,d1,q1);
}
menu=1;
setcolor(8);
line(8,25,38,25);
line(8,25,8,38);
setcolor(15);
line(8,38,38,38);
line(38,25,38,38);
d=8,q=25,d1=38,q1=38;
mx=-10,my=40,mx1=mx+120,my1=my+200;
gimage(mx,my,mx1,my1);
settextstyle(2,0,5);
setfillstyle(1,7);
for(int i=0,x1=3,y1=41;i<5;i++,y1+=20)
{
bar(x1,y1,x1+100,y1+20);
setcolor(8);
if(i<4)
{
line(x1,y1+19,x1+100,y1+19);
line(x1,y1+21,x1+100,y1+21);
}
else
{
setcolor(15);
line(x1,42,x1,y1+20);
line(x1,42,x1+100,42);
setcolor(8);
line(x1,y1+20,x1+100,y1+20);
line(x1+100,42,x1+100,y1+20);
show_Cursor();
}
setcolor(BLUE);
outtextxy(x1+3,y1,file[i]);
}
}
else if(menu==1&&(x>=2&&x<=102)&&(y>=42&&y<=60)&&out.h.bl==1)
{
menu=0;
in.x.ax=2;
int86(0x33,&in,&out);
pimage(d,q,d1,q1);
mnuFileNew_click();
setfillstyle(1,15);
int rx=67;
bar(rx+incx,42,636,399+incy);
show_Cursor();
}
/////mnuFileOpen
else if(menu==1&&(x>=2&&x<=102)&&(y>=61&&y<=80)&&out.h.bl==1)
{
menu=0;
in.x.ax=2;
int86(0x33,&in,&out);
pimage(d,q,d1,q1);
mnuFileOpen_click();
show_Cursor();
}
/////mnuFileSave
else if(menu==1&&(x>=2&&x<=102)&&(y>=81&&y<=100)&&out.h.bl==1)
{
menu=0;
in.x.ax=2;
int86(0x33,&in,&out);
pimage(d,q,d1,q1);
mnuFileSave_click(3);
DB_pimage();
show_Cursor();
}
else if(menu==1&&(x>=2&&x<=102)&&(y>=101&&y<=120)&&out.h.bl==1)
{
menu=0;
in.x.ax=2;
int86(0x33,&in,&out);
pimage(d,q,d1,q1);
mnuFileSave_click(4);
show_Cursor();
}
/*//////mnuFileSaveas
else if(menu==1&&(x>=2&&x<=102)&&(y>=101&&y<=120)&&out.h.bl==1)
{
menu=0;
in.x.ax=2;
int86(0x33,&in,&out);
pimage(d,q,d1,q1);
mnuFileNew_click();
in.x.ax=1;
int86(0x33,&in,&out);
} */
//////mnuFileExit
else if(menu==1&&(x>=2&&x<=102)&&(y>=121&&y<=140)&&out.h.bl==1)
{
menu=0;
in.x.ax=2;
int86(0x33,&in,&out);
pimage(d,q,d1,q1);
mnuFileExit_click(0);
show_Cursor();
}
//edit menu
else if((x>=46&&x<=78)&&(y>=24&&y<=35))
{
in.x.ax=2;
int86(0x33,&in,&out);
if(menu!=0)
{
pimage(d,q,d1,q1);
}
else
{
gimage(mx,my,mx1,my1);
pimage(d,q,d1,q1);
}
menu=2;
setcolor(8);
line(46,25,78,25);
line(46,25,46,38);
setcolor(15);
line(46,38,78,38);
line(78,25,78,38);
d=46,d1=78;
mx=40,my=40,mx1=mx+135,my1=my+300;
gimage(mx,my,mx1,my1);
settextstyle(2,0,5);
setfillstyle(1,7);
for(int i=0,x1=42,y1=41;i<4;i++,y1+=20)
{
bar(x1,y1,x1+120,y1+20);
setcolor(8);
if(i<3)
{
line(x1,y1+19,x1+120,y1+19);
line(x1,y1+21,x1+120,y1+21);
}
else
{
setcolor(15);
line(x1,42,x1,y1+20);
line(x1,42,x1+120,42);
setcolor(8);
line(x1,y1+20,x1+120,y1+20);
line(x1+120,42,x1+120,y1+20);
show_Cursor();
}
setcolor(BLUE);
outtextxy(x1+3,y1,edit[i]);
}
}
///mnuEditCut
else if(menu==2&&(x>=42&&x<=162)&&(y>=42&&y<=60)&&(status==1||SA==1)&&out.h.bl==1)
{
menu=0;
if(selected==1||SA==1||status==1)
{
cout<<"kkjkjk";
in.x.ax=2;
int86(0x33,&in,&out);
pimage(d,q,d1,q1);
rollp();
clipboard(sx,sy,sx1,sy1);
//setcolor(BLUE);
setfillstyle(1,backcolor);
bar(sx,sy,sx1,sy1);
in.x.ax=1;
int86(0x33,&in,&out);
stop=0;
}
else
{
in.x.ax=2;
int86(0x33,&in,&out);
pimage(d,q,d1,q1);
in.x.ax=1;
int86(0x33,&in,&out);
}
}
//mnuEditcopy
else if(menu==2&&(x>=42&&x<42+120)&&(y>61&&y<80)&&(status==1||SA==1)&&out.h.bl==1)
{
menu=0;
in.x.ax=2;
int86(0x33,&in,&out);
pimage(d,q,d1,q1);
//rollp();
clipboard(sx,sy,sx1,sy1);
in.x.ax=1;
int86(0x33,&in,&out);
stop=0;
}
///mnuEditpaste
else if(menu==2&&(x>42&&x<42+120)&&(y>81&&y<100)&&out.h.bl==1)
{
menu=0;
in.x.ax=2;
int86(0x33,&in,&out);
pimage(d,q,d1,q1);
paste();
in.x.ax=1;
int86(0x33,&in,&out);
stop=1;
SA=1;
}
else if(menu==2&&(x>42&&x<42+120)&&(y>101&&y<120)&&out.h.bl==1)
{
menu=0;
in.x.ax=2;
int86(0x33,&in,&out);
pimage(d,q,d1,q1);
mnuEditSelectAll_click();
SA=1;
in.x.ax=1;
int86(0x33,&in,&out);
stop=1;
}
/////////////////////////////////////////////
///view
else if((x>=82&&x<=112)&&(y>=24&&y<=35))
{
in.x.ax=2;
int86(0x33,&in,&out);
if(menu!=0)
{
pimage(d,q,d1,q1);
}
else
{
gimage(mx,my,mx1,my1);
pimage(d,q,d1,q1);
}
menu=3;
setcolor(8);
line(82,25,112,25);
line(82,25,82,38);
setcolor(15);
line(82,38,112,38);
line(112,25,112,38);
d=82,d1=112;
mx=75,my=40,mx1=mx+135,my1=my+300;
gimage(mx,my,mx1,my1);
settextstyle(2,0,5);
setfillstyle(1,7);
for(int i=0,x1=82,y1=41;i<6;i++,y1+=20)
{
bar(x1,y1,x1+120,y1+20);
setcolor(8);
if(i<5)
{
line(x1,y1+19,x1+120,y1+19);
line(x1,y1+21,x1+120,y1+21);
}
else
{
setcolor(15);
line(x1,42,x1,y1+20);
line(x1,42,x1+120,42);
setcolor(8);
line(x1,y1+20,x1+120,y1+20);
line(x1+120,42,x1+120,y1+20);
in.x.ax=1;
int86(0x33,&in,&out);
}
setcolor(BLUE);
outtextxy(x1+3,y1,view[i]);
}
}
//View Menu options
else if (menu==3&&(x>=42&&x<=202)&&(y>=42&&y<=58)&&(Ts==0||Ts==1||Ts==2))
{
menu=0;
in.x.ax=2;
int86(0x33,&in,&out);
pimage(d,q,d1,q1);
mnuViewToolbar_click();
in.x.ax=1;
int86(0x33,&in,&out);
}
else if (menu==3&&(x>=42&&x<=202)&&(y>=60&&y<=80)&&(Ct==0||Ct==1||Ct==2))
{
menu=0;
in.x.ax=2;
int86(0x33,&in,&out);
pimage(d,q,d1,q1);
mnuViewColorBox_click();
in.x.ax=1;
int86(0x33,&in,&out);
}
else if (menu==3&&(x>=42&&x<=202)&&(y>=80&&y<=100)&&(St==0||St==1||St==2))
{
menu=0;
in.x.ax=2;
int86(0x33,&in,&out);
pimage(d,q,d1,q1);
mnuViewStatusBar_click();
in.x.ax=1;
int86(0x33,&in,&out);
}
else if(menu==3&&(x>=42&&x<=202)&&(y>=140&&y<=180)&&(Vs==0||Vs==1))
{
menu=0;
in.x.ax=2;
int86(0x33,&in,&out);
pimage(d,q,d1,q1);
mnuViewBitmap_click();
in.x.ax=1;
int86(0x33,&in,&out);
}
///image
else if((x>=124&&x<=158)&&(y>=24&&y<=35))
{
in.x.ax=2;
int86(0x33,&in,&out);
if(menu!=0)
{
pimage(d,q,d1,q1);
}
else
{
gimage(mx,my,mx1,my1);
pimage(d,q,d1,q1);
}
menu=4;
setcolor(8);
line(124,25,162,25);
line(124,25,124,38);
setcolor(15);
line(124,38,162,38);
line(162,25,162,38);
d=124,d1=162;
mx=117,my=40,mx1=mx+135,my1=my+250;
gimage(mx,my,mx1,my1);
settextstyle(2,0,5);
setfillstyle(1,7);
for(int i=0,x1=124,y1=41;i<4;i++,y1+=20)
{
bar(x1,y1,x1+120,y1+20);
setcolor(8);
if(i<3)
{
line(x1,y1+19,x1+120,y1+19);
line(x1,y1+21,x1+120,y1+21);
}
else
{
setcolor(15);
line(x1,42,x1,y1+20);
line(x1,42,x1+120,42);
setcolor(8);
line(x1,y1+20,x1+120,y1+20);
line(x1+120,42,x1+120,y1+20);
in.x.ax=1;
int86(0x33,&in,&out);
}
setcolor(BLUE);
outtextxy(x1+3,y1,image[i]);
}
}
//mnuImageFlipVertical
else if(menu==4&&(x>=124&&x<=124+120)&&(y>=60&&y<=80)&&(Vs==0||Vs==1))
{
menu=0;
in.x.ax=2;
int86(0x33,&in,&out);
pimage(d,q,d1,q1);
mnuImageFliph_click();
in.x.ax=1;
int86(0x33,&in,&out);
}
//mnuImageFlipHorizontal
else if(menu==4&&(x>=124&&x<=124+120)&&(y>=42&&y<=60)&&(Vs==0||Vs==1))
{
menu=0;
in.x.ax=2;
int86(0x33,&in,&out);
pimage(d,q,d1,q1);
mnuImageFlipv_click();
in.x.ax=1;
int86(0x33,&in,&out);
}
///mnuImageClearImage
else if(menu==4&&(x>=124&&x<=124+120)&&(y>=101&&y<=120)&&(Vs==0||Vs==1))
{
menu=0;
in.x.ax=2;
int86(0x33,&in,&out);
pimage(d,q,d1,q1);
mnuImageClearImage_click();
in.x.ax=1;
int86(0x33,&in,&out);
}
//colors
else if((x>=174&&x<=214)&&(y>=24&&y<=35))
{
in.x.ax=2;
int86(0x33,&in,&out);
if(menu!=0)
{
pimage(d,q,d1,q1);
}
else
{
gimage(mx,my,mx1,my1);
pimage(d,q,d1,q1);
}
menu=5;
setcolor(8);
line(174,25,214,25);
line(174,25,174,38);
setcolor(15);
line(174,38,214,38);
line(214,25,214,38);
d=174,d1=214;
mx=170,my=40,mx1=mx+125,my1=my+50;
gimage(mx,my,mx1,my1);
settextstyle(2,0,5);
setfillstyle(1,7);
for(int i=0,x1=174,y1=41;i<1;i++,y1+=20)
{
bar(x1,y1,x1+120,y1+20);
setcolor(8);
if(i<1)
{
line(x1,y1+19,x1+120,y1+19);
line(x1,y1+20,x1+120,y1+20);
setcolor(15);
line(x1,42,x1,y1+20);
line(x1,42,x1+120,42);
setcolor(8);
line(x1,y1+20,x1+120,y1+20);
line(x1+120,42,x1+120,y1+20);
}
setcolor(BLUE);
outtextxy(x1+3,y1,color[i]);
in.x.ax=1;
int86(0x33,&in,&out);
}
}
else if(menu==5&&(x>=174&&x<=x+120)&&(y>=42&&y<=62))
{
menu=0;
in.x.ax=2;
int86(0x33,&in,&out);
pimage(d,q,d1,q1);
DB_gimage(180,100,400,260);
mnuColorEditColor_click(x,y);
in.x.ax=1;
int86(0x33,&in,&out);
}
//Help
else if((x>=221&&x<=251)&&(y>=24&&y<=35))
{
in.x.ax=2;
int86(0x33,&in,&out);
if(menu!=0)
{
pimage(d,q,d1,q1);
}
else
{
gimage(mx,my,mx1,my1);
pimage(d,q,d1,q1);
}
menu=6;
setcolor(8);
line(221,25,253,25);
line(221,25,221,38);
setcolor(15);
line(221,38,253,38);
line(253,25,253,38);
d=221,d1=253;
mx=217,my=40,mx1=mx+125,my1=my+100;
gimage(mx,my,mx1,my1);
settextstyle(2,0,5);
setfillstyle(1,7);
for(int i=0,x1=221,y1=41;i<2;i++,y1+=20)
{
bar(x1,y1,x1+120,y1+20);
setcolor(8);
if(i<1)
{
line(x1,y1+19,x1+120,y1+19);
line(x1,y1+21,x1+120,y1+21);
}
else
{
setcolor(15);
line(x1,42,x1,y1+20);
line(x1,42,x1+120,42);
setcolor(8);
line(x1,y1+20,x1+120,y1+20);
line(x1+120,42,x1+120,y1+20);
}
setcolor(BLUE);
outtextxy(x1+3,y1,help[i]);
}
in.x.ax=1;
int86(0x33,&in,&out);
}
//Close Button
else if((x>=620&&x<=632)&&(y>=6&&y<=18))
{
/*in.x.ax=2;
int86(0x33,&in,&out);
if(menu!=0)
{
pimage(d,q,d1,q1);
}
menu=0;
mnuFileExit_click();
in.x.ax=1;
int86(0x33,&in,&out);*/
exit(0);
}
else if((x>=9&&x<=52)&&(y>=44&&y<=241)&&Ts==1)
{
if((x>=9&&x<=32)&&(y>=44&&y<=67))
{
if(status1==1||SA==1)
{
rollp();
SA=0;
}
toolselect=1;
status1=1;
status=1;
setfillstyle(1,7);
bar(14,246,53,319);
in.x.ax=2;
int86(0x33,&in,&out);
if(menu!=0)
{
pimage(d,q,d1,q1);
}
else
{
gimage(mx,my,mx1,my1);
pimage(d,q,d1,q1);
}
menu=0;
setcolor(0);
line(tx,ty+23,tx+23,ty+23);
line(tx+23,ty,tx+23,ty+23);
setcolor(15);
line(tx,ty,tx+23,ty);
line(tx,ty,tx,ty+22);
tx=9,ty=44;
setcolor(15);
line(tx,ty+23,tx+23,ty+23);
line(tx+23,ty,tx+23,ty+23);
setcolor(0);
line(tx,ty,tx+23,ty);
line(tx,ty,tx,ty+22);
in.x.ax=1;
int86(0x33,&in,&out);
}
//Eraser
else if((x>=9&&x<=32)&&(y>=69&&y<=92))
{
toolselect=2;
if(status1==1||SA==1)
{
rollp();
SA=1;
}
status1=1;
status=1;
setfillstyle(1,7);
bar(14,246,44,319);
in.x.ax=2;
int86(0x33,&in,&out);
if(menu!=0)
{
pimage(d,q,d1,q1);
}
menu=0;
setcolor(0);
line(tx,ty+23,tx+23,ty+23);
line(tx+23,ty,tx+23,ty+23);
setcolor(15);
line(tx,ty,tx+23,ty);
line(tx,ty,tx,ty+22);
tx=9,ty=69;
setcolor(15);
line(tx,ty+23,tx+23,ty+23);
line(tx+23,ty,tx+23,ty+23);
setcolor(0);
line(tx,ty,tx+23,ty);
line(tx,ty,tx,ty+22);
setfillstyle(1,7);
bar(14,246,53,319);
//Erase attributes
int Er_y=250;
setfillstyle(1,0);
for(float i=1;i<=4;i+=.5,Er_y+=10)
{
fillellipse(31,Er_y,i,i);
}
tool_gimage(13,245,54,320);
setcolor(0);
bar(30,249,32,251);
in.x.ax=1;
int86(0x33,&in,&out);
}
else if((x>=9&&x<=32)&&(y>=94&&y<=117))
{
toolselect=3;
if(status1==1||SA==1)
{
rollp();
SA=0;
}
status1=1;
status=1;
setfillstyle(1,7);
bar(14,246,53,319);
in.x.ax=2;
int86(0x33,&in,&out);
if(menu!=0)
{
pimage(d,q,d1,q1);
}
menu=0;
setcolor(0);
line(tx,ty+23,tx+23,ty+23);
line(tx+23,ty,tx+23,ty+23);
setcolor(15);
line(tx,ty,tx+23,ty);
line(tx,ty,tx,ty+22);
tx=9,ty=94;
setcolor(15);
line(tx,ty+23,tx+23,ty+23);
line(tx+23,ty,tx+23,ty+23);
setcolor(0);
line(tx,ty,tx+23,ty);
line(tx,ty,tx,ty+22);
in.x.ax=1;
int86(0x33,&in,&out);
}
else if((x>=9&&x<=32)&&(y>=119&&y<=142))
{
toolselect=4;
if(status1==1||SA==1)
{
rollp();
SA=0;
}
status1=1;
status=1;
setfillstyle(1,7);
bar(14,246,53,319);
in.x.ax=2;
int86(0x33,&in,&out);
if(menu!=0)
{
pimage(d,q,d1,q1);
}
menu=0;
setcolor(0);
line(tx,ty+23,tx+23,ty+23);
line(tx+23,ty,tx+23,ty+23);
setcolor(15);
line(tx,ty,tx+23,ty);
line(tx,ty,tx,ty+22);
tx=9,ty=119;
setcolor(15);
line(tx,ty+23,tx+23,ty+23);
line(tx+23,ty,tx+23,ty+23);
setcolor(0);
line(tx,ty,tx+23,ty);
line(tx,ty,tx,ty+22);
in.x.ax=1;
int86(0x33,&in,&out);
}
//Spray
else if((x>=9&&x<=32)&&(y>=144&&y<=167))
{
toolselect=5;
if(status1==1||SA==1)
{
rollp();
SA=0;
}
status1=1;
status=1;
setfillstyle(1,7);
bar(14,246,53,319);
in.x.ax=2;
int86(0x33,&in,&out);
if(menu!=0)
{
pimage(d,q,d1,q1);
}
menu=0;
setcolor(0);
line(tx,ty+23,tx+23,ty+23);
line(tx+23,ty,tx+23,ty+23);
setcolor(15);
line(tx,ty,tx+23,ty);
line(tx,ty,tx,ty+22);
tx=9,ty=144;
setcolor(15);
line(tx,ty+23,tx+23,ty+23);
line(tx+23,ty,tx+23,ty+23);
setcolor(0);
line(tx,ty,tx+23,ty);
line(tx,ty,tx,ty+22);
in.x.ax=1;
int86(0x33,&in,&out);
}
//Lineselect
else if((x>=9&&x<=32)&&(y>=169&&y<=192))
{
toolselect=6;
if(status1==1||SA==1)
{
rollp();
SA=0;
}
status1=1;
status=1;
in.x.ax=2;
int86(0x33,&in,&out);
if(menu!=0)
{
pimage(d,q,d1,q1);
}
menu=0;
setcolor(0);
line(tx,ty+23,tx+23,ty+23);
line(tx+23,ty,tx+23,ty+23);
setcolor(15);
line(tx,ty,tx+23,ty);
line(tx,ty,tx,ty+22);
tx=9,ty=169;
setcolor(15);
line(tx,ty+23,tx+23,ty+23);
line(tx+23,ty,tx+23,ty+23);
setcolor(0);
line(tx,ty,tx+23,ty);
line(tx,ty,tx,ty+22);
setfillstyle(1,7);
bar(14,246,53,319);
int ld=255;
setcolor(1);
for(i=0;i<=3;i++,ld+=15)
{
if(i==0)
{
setlinestyle(0,1,1);
line(20,ld,48,ld);
}
if(i==1)
{
setlinestyle(0,1,3);
line(20,ld,48,ld);
}
if(i==2||i==3)
setlinestyle(i-1,1,1);
line(20,ld,48,ld);
}
setlinestyle(0,1,1);
tool_gimage(13,245,54,320);
setcolor(15);
setfillstyle(1,1);
bar(18,251,50,259);
line(20,255,48,255);
in.x.ax=1;
int86(0x33,&in,&out);
}
//Rectselect
else if((x>=9&&x<=32)&&(y>=194&&y<=217))
{
toolselect=7;
if(status1==1||SA==1)
{
rollp();
SA=0;
}
status1=1;
status=1;
setfillstyle(1,7);
bar(14,246,53,319);
in.x.ax=2;
int86(0x33,&in,&out);
if(menu!=0)
{
pimage(d,q,d1,q1);
}
menu=0;
setcolor(0);
line(tx,ty+23,tx+23,ty+23);
line(tx+23,ty,tx+23,ty+23);
setcolor(15);
line(tx,ty,tx+23,ty);
line(tx,ty,tx,ty+22);
tx=9,ty=194;
setcolor(15);
line(tx,ty+23,tx+23,ty+23);
line(tx+23,ty,tx+23,ty+23);
setcolor(0);
line(tx,ty,tx+23,ty);
line(tx,ty,tx,ty+22);
setfillstyle(1,7);
bar(14,246,53,319);
int ld=252;
for(i=1;i<=3;i++,ld+=20)
{
setcolor(1);
if(i==1)rectangle(22,ld,46,ld+8);
if(i==2)
{
setcolor(1);
setfillstyle(1,8);
bar(22,ld,46,ld+8);
rectangle(22,ld,46,ld+8);
}
if(i==3)
{
setcolor(8);
setfillstyle(1,8);
bar(22,ld,46,ld+8);
}
}
tool_gimage(13,245,54,320);
setfillstyle(1,1);
bar(18,249,50,263);
setcolor(15);
rectangle(22,252,46,260);
in.x.ax=1;
int86(0x33,&in,&out);
}
//Ellipse select
else if((x>=9&&x<=32)&&(y>=219&&y<=242))
{
toolselect=8;
if(status1==1||SA==1)
{
rollp();
SA=0;
}
status1=1;
status=1;
setfillstyle(1,7);
bar(14,246,53,319);
in.x.ax=2;
int86(0x33,&in,&out);
if(menu!=0)
{
pimage(d,q,d1,q1);
}
menu=0;
setcolor(0);
line(tx,ty+23,tx+23,ty+23);
line(tx+23,ty,tx+23,ty+23);
setcolor(15);
line(tx,ty,tx+23,ty);
line(tx,ty,tx,ty+22);
tx=9,ty=219;
setcolor(15);
line(tx,ty+23,tx+23,ty+23);
line(tx+23,ty,tx+23,ty+23);
setcolor(0);
line(tx,ty,tx+23,ty);
line(tx,ty,tx,ty+22);
setfillstyle(1,7);
bar(14,246,53,319);
setcolor(1);
ellipse(33,257,0,360,15,4);
setcolor(1);
setfillstyle(1,8);
fillellipse(33,278,15,5);
setcolor(8);
fillellipse(33,296,15,5);
tool_gimage(13,245,54,320);
setfillstyle(1,1);
bar(16,250,50,265);
setcolor(15);
ellipse(33,257,0,360,15,4);
in.x.ax=1;
int86(0x33,&in,&out);
}
//Selection tool
else if((x>=36&&x<=59)&&(y>=44&&y<=67))
{
toolselect=9;
if(status1==1||SA==1)
{
rollp();
SA=0;
}
status1=1;
status=1;
setfillstyle(1,7);
bar(14,246,53,319);
in.x.ax=2;
int86(0x33,&in,&out);
if(menu!=0)
{
pimage(d,q,d1,q1);
}
menu=0;
setcolor(0);
line(tx,ty+23,tx+23,ty+23);
line(tx+23,ty,tx+23,ty+23);
setcolor(15);
line(tx,ty,tx+23,ty);
line(tx,ty,tx,ty+22);
tx=36,ty=44;
setcolor(15);
line(tx,ty+23,tx+23,ty+23);
line(tx+23,ty,tx+23,ty+23);
setcolor(0);
line(tx,ty,tx+23,ty);
line(tx,ty,tx,ty+22);
in.x.ax=1;
int86(0x33,&in,&out);
}
//FillTool
else if((x>=36&&x<=59)&&(y>=69&&y<=92))
{
toolselect=10;
if(status1==1||SA==1)
{
rollp();
SA=0;
}
status1=1;
status=1;
setfillstyle(1,7);
bar(14,246,53,319);
in.x.ax=2;
int86(0x33,&in,&out);
if(menu!=0)
{
pimage(d,q,d1,q1);
}
menu=0;
setcolor(0);
line(tx,ty+23,tx+23,ty+23);
line(tx+23,ty,tx+23,ty+23);
setcolor(15);
line(tx,ty,tx+23,ty);
line(tx,ty,tx,ty+22);
tx=36,ty=69;
setcolor(15);
line(tx,ty+23,tx+23,ty+23);
line(tx+23,ty,tx+23,ty+23);
setcolor(0);
line(tx,ty,tx+23,ty);
line(tx,ty,tx,ty+22);
in.x.ax=1;
int86(0x33,&in,&out);
}
else if((x>=36&&x<=59)&&(y>=94&&y<=117))
{
toolselect=11;
if(status1==1||SA==1)
{
rollp();
SA=0;
}
status1=1;
status=1;
setfillstyle(1,7);
bar(14,246,53,319);
in.x.ax=2;
int86(0x33,&in,&out);
if(menu!=0)
{
pimage(d,q,d1,q1);
menu=0;
}
setcolor(0);
line(tx,ty+23,tx+23,ty+23);
line(tx+23,ty,tx+23,ty+23);
setcolor(15);
line(tx,ty,tx+23,ty);
line(tx,ty,tx,ty+22);
tx=36,ty=94;
setcolor(15);
line(tx,ty+23,tx+23,ty+23);
line(tx+23,ty,tx+23,ty+23);
setcolor(0);
line(tx,ty,tx+23,ty);
line(tx,ty,tx,ty+22);
in.x.ax=1;
int86(0x33,&in,&out);
}
///brush click
else if((x>=36&&x<=59)&&(y>=119&&y<=142))
{
toolselect=12;
if(status1==1||SA==1)
{
rollp();
SA=0;
}
setfillstyle(1,7);
bar(14,246,53,319);
in.x.ax=2;
int86(0x33,&in,&out);
if(menu!=0)
{
pimage(d,q,d1,q1);
menu=0;
}
setcolor(0);
line(tx,ty+23,tx+23,ty+23);
line(tx+23,ty,tx+23,ty+23);
setcolor(15);
line(tx,ty,tx+23,ty);
line(tx,ty,tx,ty+22);
tx=36,ty=119;
setcolor(15);
line(tx,ty+23,tx+23,ty+23);
line(tx+23,ty,tx+23,ty+23);
setcolor(0);
line(tx,ty,tx+23,ty);
line(tx,ty,tx,ty+22);
//Brush attributes
int br_y=250;
setfillstyle(1,0);
for(float i=1;i<=4;i+=.5,br_y+=10)
{
fillellipse(31,br_y,i,i);
}
tool_gimage(13,245,54,320);
setcolor(0);
bar(30,249,32,251);
in.x.ax=1;
int86(0x33,&in,&out);
}
else if((x>=36&&x<=59)&&(y>=144&&y<=167))
{
toolselect=13;
if(status1==1||SA==1)
{
rollp();
SA=0;
}
status1=1;
status=1;
setfillstyle(1,7);
bar(14,246,53,319);
in.x.ax=2;
int86(0x33,&in,&out);
if(menu!=0)
{
pimage(d,q,d1,q1);
menu=0;
}
setcolor(0);
line(tx,ty+23,tx+23,ty+23);
line(tx+23,ty,tx+23,ty+23);
setcolor(15);
line(tx,ty,tx+23,ty);
line(tx,ty,tx,ty+22);
tx=36,ty=144;
setcolor(15);
line(tx,ty+23,tx+23,ty+23);
line(tx+23,ty,tx+23,ty+23);
setcolor(0);
line(tx,ty,tx+23,ty);
line(tx,ty,tx,ty+22);
in.x.ax=1;
int86(0x33,&in,&out);
}
else if((x>=36&&x<=59)&&(y>=169&&y<=192))
{
toolselect=14;
if(status1==1||SA==1)
{
rollp();
SA=0;
}
status1=1;
status=1;
setfillstyle(1,7);
bar(14,246,53,319);
in.x.ax=2;
int86(0x33,&in,&out);
if(menu!=0)
{
pimage(d,q,d1,q1);
menu=0;
}
setcolor(0);
line(tx,ty+23,tx+23,ty+23);
line(tx+23,ty,tx+23,ty+23);
setcolor(15);
line(tx,ty,tx+23,ty);
line(tx,ty,tx,ty+22);
tx=36,ty=169;
setcolor(15);
line(tx,ty+23,tx+23,ty+23);
line(tx+23,ty,tx+23,ty+23);
setcolor(0);
line(tx,ty,tx+23,ty);
line(tx,ty,tx,ty+22);
in.x.ax=1;
int86(0x33,&in,&out);
}
else if((x>=36&&x<=59)&&(y>=194&&y<=217))
{
toolselect=15;
if(status1==1||SA==1)
{
rollp();
SA=0;
}
status1=1;
status=1;
setfillstyle(1,7);
bar(14,246,53,319);
in.x.ax=2;
int86(0x33,&in,&out);
if(menu!=0)
{
pimage(d,q,d1,q1);
menu=0;
}
setcolor(0);
line(tx,ty+23,tx+23,ty+23);
line(tx+23,ty,tx+23,ty+23);
setcolor(15);
line(tx,ty,tx+23,ty);
line(tx,ty,tx,ty+22);
tx=36,ty=194;
setcolor(15);
line(tx,ty+23,tx+23,ty+23);
line(tx+23,ty,tx+23,ty+23);
setcolor(0);
line(tx,ty,tx+23,ty);
line(tx,ty,tx,ty+22);
setfillstyle(1,7);
bar(14,246,53,319);
int ld=255;
setcolor(1);
for(i=0;i<=3;i++,ld+=15)
{
if(i==0)
{
setlinestyle(0,1,1);
line(20,ld,48,ld);
}
if(i==1)
{
setlinestyle(0,1,3);
line(20,ld,48,ld);
}
if(i==2||i==3)
setlinestyle(i-1,1,1);
line(20,ld,48,ld);
}
setlinestyle(0,1,1);
tool_gimage(13,245,54,320);
setcolor(15);
setfillstyle(1,1);
bar(18,251,50,259);
line(20,255,48,255);
in.x.ax=1;
int86(0x33,&in,&out);
}
else if((x>=36&&x<=59)&&(y>=219&&y<=242))
{
toolselect=16;
if(status1==1||SA==1)
{
rollp();
SA=0;
}
status1=1;
status=1;
setfillstyle(1,7);
bar(14,246,53,319);
in.x.ax=2;
int86(0x33,&in,&out);
if(menu!=0)
{
pimage(d,q,d1,q1);
menu=0;
}
setcolor(0);
line(tx,ty+23,tx+23,ty+23);
line(tx+23,ty,tx+23,ty+23);
setcolor(15);
line(tx,ty,tx+23,ty);
line(tx,ty,tx,ty+22);
tx=36,ty=219;
setcolor(15);
line(tx,ty+23,tx+23,ty+23);
line(tx+23,ty,tx+23,ty+23);
setcolor(0);
line(tx,ty,tx+23,ty);
line(tx,ty,tx,ty+22);
in.x.ax=1;
int86(0x33,&in,&out);
}
}
//for getting color from color boxes
else if(Ct==1&&((x>=38&&x<=216)&&(y>=410+inc&&y<=445+inc)))
{
in.x.ax=2;
int86(0x33,&in,&out);
if(menu!=0)
{
pimage(d,q,d1,q1);
menu=0;
}
forecolor=getpixel(x,y);
if(forecolor!=7&&forecolor!=15&&forecolor!=0&&forecolor!=8)
{
setfillstyle(1,forecolor);
bar(10,420+inc,20,430+inc);
setcolor(0);
rectangle(9,419+inc,21,431+inc);
}
if((x>=38&&x<=55)&&(y>=410+inc&&y<=426+inc)||(x>=198&&x<=215)&&(y>=428+inc&&y<=442+inc))
{
forecolor=0;
setfillstyle(1,forecolor);
bar(10,420+inc,20,430+inc);
setcolor(0);
rectangle(9,419+inc,21,431+inc);
}
if((x>=180&&x<=195)&&(y>=428+inc&&y<=442+inc))
{
forecolor=15;
setfillstyle(1,forecolor);
bar(10,420+inc,20,430+inc);
setcolor(0);
rectangle(9,419+inc,21,431+inc);
}
if((x>=180&&x<=196)&&(y>=412+inc&&y<=425+inc)||(x>=201&&x<=215)&&(y>=412+inc&&y<=425+inc))
{
forecolor=7;
setfillstyle(1,forecolor);
bar(10,420+inc,20,430+inc);
setcolor(0);
rectangle(9,419+inc,21,431+inc);
}
if((x>=38&&x<=56)&&(y>=428+inc&&y<=442+inc))
{
forecolor=8;
setfillstyle(1,forecolor);
bar(10,420+inc,20,430+inc);
setcolor(0);
rectangle(9,419+inc,21,431+inc);
}
in.x.ax=1;
int86(0x33,&in,&out);
}
///end
////Rectangle options
else if((x>=18&&x<=50)&&(y>=249&&y<=263)&&toolselect==7&&Ts==1)
{
status1=1;
status=1;
in.x.ax=2;
int86(0x33,&in,&out);
if(menu!=0)
{
pimage(d,q,d1,q1);
menu=0;
}
tool_pimage();
setfillstyle(1,1);
bar(18,249,50,263);
setcolor(15);
rectangle(22,252,46,260);
in.x.ax=1;
int86(0x33,&in,&out);
}
else if((x>=18&&x<=50)&&(y>=270&&y<=282)&&toolselect==7&&Ts==1)
{
status1=2;
status=1;
in.x.ax=2;
int86(0x33,&in,&out);
if(menu!=0)
{
pimage(d,q,d1,q1);
menu=0;
}
tool_pimage();
setfillstyle(1,1);
bar(18,270,50,282);
setcolor(15);
setfillstyle(1,8);
bar(22,272,46,280);
in.x.ax=1;
int86(0x33,&in,&out);
}
else if((x>=18&&x<=50)&&(y>=290&&y<=312)&&toolselect==7&&Ts==1)
{
status1=3;
status=1;
in.x.ax=2;
int86(0x33,&in,&out);
if(menu!=0)
{
pimage(d,q,d1,q1);
menu=0;
}
tool_pimage();
setfillstyle(1,1);
bar(18,290,50,302);
setcolor(8);
setfillstyle(1,8);
bar(22,292,46,300);
in.x.ax=1;
int86(0x33,&in,&out);
}
/////End
/////Ellipse options
else if((x>=16&&x<=50)&&(y>=250&&y<=265)&&toolselect==8&&Ts==1)
{
status1=1;
status=1;
in.x.ax=2;
int86(0x33,&in,&out);
if(menu!=0)
{
pimage(d,q,d1,q1);
menu=0;
}
tool_pimage();
setfillstyle(1,1);
bar(16,250,50,265);
setcolor(15);
ellipse(33,257,0,360,15,4);
in.x.ax=1;
int86(0x33,&in,&out);
}
else if((x>=16&&x<=50)&&(y>=271&&y<=286)&&toolselect==8&&Ts==1)
{
status1=2;
status=1;
in.x.ax=2;
int86(0x33,&in,&out);
if(menu!=0)
{
pimage(d,q,d1,q1);
menu=0;
}
tool_pimage();
setfillstyle(1,1);
bar(16,270,50,286);
setcolor(15);
setfillstyle(1,8);
fillellipse(33,278,15,5);
in.x.ax=1;
int86(0x33,&in,&out);
}
else if((x>=16&&x<=50)&&(y>=292&&y<=307)&&toolselect==8&&Ts==1)
{
status1=3;
status=1;
in.x.ax=2;
int86(0x33,&in,&out);
if(menu!=0)
{
pimage(d,q,d1,q1);
menu=0;
}
tool_pimage();
setfillstyle(1,1);
bar(16,288,50,304);
setfillstyle(1,8);
setcolor(8);
fillellipse(33,296,15,5);
in.x.ax=1;
int86(0x33,&in,&out);
}
////end
////Line types
else if((x>=20&&x<=48)&&(y>=251&&y<=259)&&(toolselect==6||toolselect==15)&&Ts==1)
{
status1=1;
status=1;
in.x.ax=2;
int86(0x33,&in,&out);
if(menu!=0)
{
pimage(d,q,d1,q1);
menu=0;
}
tool_pimage();
setcolor(15);
setfillstyle(1,1);
bar(18,251,50,259);
line(20,255,48,255);
in.x.ax=1;
int86(0x33,&in,&out);
}
else if((x>=20&&x<=48)&&(y>=266&&y<=274)&&(toolselect==6||toolselect==15)&&Ts==1)
{
status1=2;
status=1;
in.x.ax=2;
int86(0x33,&in,&out);
if(menu!=0)
{
pimage(d,q,d1,q1);
menu=0;
}
tool_pimage();
setcolor(15);
setfillstyle(1,1);
bar(18,266,50,274);
setlinestyle(0,1,3);
line(20,270,48,270);
setlinestyle(0,1,1);
in.x.ax=1;
int86(0x33,&in,&out);
}
else if((x>=20&&x<=48)&&(y>=281&&y<=289)&&(toolselect==6||toolselect==15)&&Ts==1)
{
status1=3;
status=1;
in.x.ax=2;
int86(0x33,&in,&out);
if(menu!=0)
{
pimage(d,q,d1,q1);
menu=0;
}
tool_pimage();
setcolor(15);
setfillstyle(1,1);
bar(18,281,50,289);
setlinestyle(1,1,1);
line(20,285,48,285);
setlinestyle(0,1,1);
in.x.ax=1;
int86(0x33,&in,&out);
}
else if((x>=20&&x<=48)&&(y>=294&&y<=304)&&(toolselect==6||toolselect==15)&&Ts==1)
{
status1=4;
status=1;
in.x.ax=2;
int86(0x33,&in,&out);
if(menu!=0)
{
pimage(d,q,d1,q1);
menu=0;
}
tool_pimage();
setcolor(15);
setfillstyle(1,1);
bar(18,296,50,304);
setlinestyle(2,1,1);
line(20,300,48,300);
setlinestyle(0,1,1);
in.x.ax=1;
int86(0x33,&in,&out);
}
//Brush options sizes
else if((x>=30&&x<=32)&&(y>=249&&y<=251)&&toolselect==12&&Ts==1)
{
status1=1;
status=1;
in.x.ax=2;
int86(0x33,&in,&out);
if(menu!=0)
{
pimage(d,q,d1,q1);
menu=0;
}
tool_pimage();
setfillstyle(1,0);
bar(30,249,32,251);
in.x.ax=1;
int86(0x33,&in,&out);
}
else if((x>=29&&x<=33)&&(y>=258&&y<=262)&&toolselect==12&&Ts==1)
{
status1=2;
status=1;
in.x.ax=2;
int86(0x33,&in,&out);
if(menu!=0)
{
pimage(d,q,d1,q1);
menu=0;
}
tool_pimage();
setfillstyle(1,0);
bar(29,258,33,262);
in.x.ax=1;
int86(0x33,&in,&out);
}
else if((x>=28&&x<=33)&&(y>=267&&y<=271)&&toolselect==12&&Ts==1)
{
status1=3;
status=1;
in.x.ax=2;
int86(0x33,&in,&out);
if(menu!=0)
{
pimage(d,q,d1,q1);
menu=0;
}
tool_pimage();
setfillstyle(1,0);
bar(29,268,33,272);
in.x.ax=1;
int86(0x33,&in,&out);
}
else if((x>=28&&x<=33)&&(y>=277&&y<=281)&&toolselect==12&&Ts==1)
{
status1=4;
status=1;
in.x.ax=2;
int86(0x33,&in,&out);
if(menu!=0)
{
pimage(d,q,d1,q1);
menu=0;
}
tool_pimage();
setfillstyle(1,0);
bar(28,277,34,283);
in.x.ax=1;
int86(0x33,&in,&out);
}
else if((x>=28&&x<=33)&&(y>=287&&y<=291)&&toolselect==12&&Ts==1)
{
status1=5;
status=1;
in.x.ax=2;
int86(0x33,&in,&out);
if(menu!=0)
{
pimage(d,q,d1,q1);
menu=0;
}
tool_pimage();
setfillstyle(1,0);
bar(28,287,34,293);
in.x.ax=1;
int86(0x33,&in,&out);
}
else if((x>=28&&x<=33)&&(y>=297&&y<=301)&&toolselect==12&&Ts==1)
{
status1=6;
status=1;
in.x.ax=2;
int86(0x33,&in,&out);
if(menu!=0)
{
pimage(d,q,d1,q1);
menu=0;
}
tool_pimage();
setfillstyle(1,0);
bar(28,297,34,303);
in.x.ax=1;
int86(0x33,&in,&out);
}
else if((x>=28&&x<=33)&&(y>=307&&y<=311)&&toolselect==12&&Ts==1)
{
status1=7;
status=1;
in.x.ax=2;
int86(0x33,&in,&out);
if(menu!=0)
{
pimage(d,q,d1,q1);
menu=0;
}
tool_pimage();
setfillstyle(1,0);
bar(27,306,35,314);
in.x.ax=1;
int86(0x33,&in,&out);
}
/////Brush option end
else if((x>=30&&x<=32)&&(y>=249&&y<=251)&&toolselect==2&&Ts==1)
{
status1=1;
status=1;
in.x.ax=2;
int86(0x33,&in,&out);
if(menu!=0)
{
pimage(d,q,d1,q1);
menu=0;
}
tool_pimage();
setfillstyle(1,0);
bar(30,249,32,251);
in.x.ax=1;
int86(0x33,&in,&out);
}
else if((x>=29&&x<=33)&&(y>=258&&y<=262)&&toolselect==2&&Ts==1)
{
status1=2;
status=1;
in.x.ax=2;
int86(0x33,&in,&out);
if(menu!=0)
{
pimage(d,q,d1,q1);
menu=0;
}
tool_pimage();
setfillstyle(1,0);
bar(29,258,33,262);
in.x.ax=1;
int86(0x33,&in,&out);
}
else if((x>=28&&x<=33)&&(y>=267&&y<=271)&&toolselect==2&&Ts==1)
{
status1=3;
status=1;
in.x.ax=2;
int86(0x33,&in,&out);
if(menu!=0)
{
pimage(d,q,d1,q1);
menu=0;
}
tool_pimage();
setfillstyle(1,0);
bar(29,268,33,272);
in.x.ax=1;
int86(0x33,&in,&out);
}
else if((x>=28&&x<=33)&&(y>=277&&y<=281)&&toolselect==2&&Ts==1)
{
status1=4;
status=1;
in.x.ax=2;
int86(0x33,&in,&out);
if(menu!=0)
{
pimage(d,q,d1,q1);
menu=0;
}
tool_pimage();
setfillstyle(1,0);
bar(28,277,34,283);
in.x.ax=1;
int86(0x33,&in,&out);
}
else if((x>=28&&x<=33)&&(y>=287&&y<=291)&&toolselect==2&&Ts==1)
{
status1=5;
status=1;
in.x.ax=2;
int86(0x33,&in,&out);
if(menu!=0)
{
pimage(d,q,d1,q1);
menu=0;
}
tool_pimage();
setfillstyle(1,0);
bar(28,287,34,293);
in.x.ax=1;
int86(0x33,&in,&out);
}
else if((x>=28&&x<=33)&&(y>=297&&y<=301)&&toolselect==2&&Ts==1)
{
status1=6;
status=1;
in.x.ax=2;
int86(0x33,&in,&out);
if(menu!=0)
{
pimage(d,q,d1,q1);
}
menu=0;
tool_pimage();
setfillstyle(1,0);
bar(28,297,34,303);
in.x.ax=1;
int86(0x33,&in,&out);
}
else if((x>=28&&x<=33)&&(y>=307&&y<=311)&&toolselect==2&&Ts==1)
{
status1=7;
status=1;
in.x.ax=2;
int86(0x33,&in,&out);
if(menu!=0)
{
pimage(d,q,d1,q1);
}
menu=0;
tool_pimage();
setfillstyle(1,0);
bar(27,306,35,314);
in.x.ax=1;
int86(0x33,&in,&out);
}
/////erase option end
else
if(menu!=0)
{
pimage(d,q,d1,q1);
menu=0;
}
}
}
else if (out.h.bl==2)
{
if(Ct==1&&Vs!=1)
{
if((x>=38&&x<=216)&&(y>=410+inc&&y<=445)+inc)
{
in.x.ax=2;
int86(0x33,&in,&out);
if(menu!=0)
{
pimage(d,q,d1,q1);
}
menu=0;
backcolor=getpixel(x,y);
if(backcolor!=7&&backcolor!=15&&backcolor!=0&&backcolor!=8)
{
setfillstyle(1,backcolor);
bar(16,425+inc,26,435+inc);
setcolor(0);
rectangle(15,424+inc,27,436+inc);
setfillstyle(1,forecolor);
bar(10,420+inc,20,430+inc);
setcolor(0);
rectangle(9,419+inc,21,431+inc);
}
if((x>=38&&x<=55)&&(y>=410+inc&&y<=426+inc)||(x>=198&&x<=215)&&(y>=428+inc&&y<=442+inc))
{
backcolor=15;
setfillstyle(1,backcolor);
bar(16,425+inc,26,435+inc);
setcolor(0);
rectangle(15,424+inc,27,436+inc);
setfillstyle(1,forecolor);
bar(10,420+inc,20,430+inc);
setcolor(0);
rectangle(9,419+inc,21,431+inc);
}
if((x>=180&&x<=195)&&(y>=428+inc&&y<=442+inc))
{
backcolor=15;
setfillstyle(1,backcolor);
bar(16,425+inc,26,435+inc);
setcolor(0);
rectangle(15,424+inc,27,436+inc);
setfillstyle(1,forecolor);
bar(10,420+inc,20,430+inc);
setcolor(0);
rectangle(9,419+inc,21,431+inc);
}
if((x>=180&&x<=196)&&(y>=412+inc&&y<=425+inc)||(x>=201&&x<=215)&&(y>=412+inc&&y<=425+inc))
{
backcolor=7;
setfillstyle(1,backcolor);
bar(16,425+inc,26,435+inc);
setcolor(0);
rectangle(15,424+inc,27,436+inc);
setfillstyle(1,forecolor);
bar(10,420+inc,20,430+inc);
setcolor(0);
rectangle(9,419+inc,21,431+inc);
}
if((x>=38&&x<=56)&&(y>=428+inc&&y<=442+inc))
{
backcolor=8;
setfillstyle(1,backcolor);
bar(16,425+inc,26,435+inc);
setcolor(0);
rectangle(15,424+inc,27,436+inc);
setfillstyle(1,forecolor);
bar(10,420+inc,20,430+inc);
setcolor(0);
rectangle(9,419+inc,21,431+inc);
}
if((x>=38&&x<=56)&&(y>=428+inc&&y<=442+inc)&&out.h.bl==2)
{
int c;
in.x.ax=2;
int86(0x33,&in,&out);
c=getpixel(x,y);
fillcolor(x,y,c,backcolor);
}
in.x.ax=1;
int86(0x33,&in,&out);
}
}
else if(Vs==1)
{
mnuViewBitmap_click();
}
}
/*if((x>65&&x<636)&&(y>42&&y<400))
{
mm=x-67;
nn=y-42; */
if(St==1&&Vs!=1)
{
//time_t t;
//t=time(NULL);
itoa(x,px,10);
itoa(y,py,10);
settextstyle(2,0,4);
setcolor(0);
outtextxy(407,459,"x=");
outtextxy(462,459,"y=");
settextstyle(2,0,4);
outtextxy(420,459,px);
outtextxy(475,459,py);
//outtextxy(500,459,ctime(&t));
delay(10);
setcolor(7);
outtextxy(420,459,px);
outtextxy(475,459,py);
}
//}
if(Vs!=1)
{
if((x>65+incx&&x<636)&&(y>42&&y<400+incy)&&toolselect==4&&out.h.bl==1)
{
//in.x.ax=5;
//int86(0x33,&in,&out);
/*in.x.ax=3;
int86(0x33,&in,&out);
line(lx,ly,out.x.cx,out.x.dx);*/
//lx=x,ly=y;
in.h.bl=1;
in.x.ax=3;
int86(0x33,&in,&in);
moveto(x,y);
while(in.h.bl==1)
{
in.x.ax=3;
int86(0x33,&in,&in);
x=in.x.cx;
y=in.x.dx;
in.x.ax=2;
int86(0x33,&in,&in);
lineto(x,y);
setfillstyle(1,BLACK);
in.x.ax=1;
int86(0x33,&in,&in);
}
/*in.x.ax=3;
int86(0x33,&in,&out);
lx=out.x.cx;
lx=out.x.dx;*/
}
//rectdraw
else if((x>65+incx&&x<636)&&(y>42&&y<400+incy)&&out.h.bl==1&&toolselect==7&&(status==1||status==2))
{
in.h.bl=1;
in.x.ax=5;
int86(0x33,&in,&in);
in.x.ax=3;
int86(0x33,&in,&in);
xx=in.x.cx;
yy=in.x.dx;
while(in.h.bl==1)
{
in.x.ax=3;
int86(0x33,&in,&in);
xx1=in.x.cx;
yy1=in.x.dx;
rollg(xx,yy,xx1,yy1);
setcolor(forecolor);
rectangle(xx,yy,xx1,yy1);
delay(10);
rollp();
}
in.x.ax=2;
int86(0x33,&in,&in);
setcolor(forecolor);
if(status1==1)
{
rectangle(xx,yy,xx1,yy1);
}
if(status1==2)
{
setfillstyle(1,backcolor);
bar(xx,yy,xx1,yy1);
rectangle(xx,yy,xx1,yy1);
}
if(status1==3)
{
setfillstyle(1,forecolor);
bar(xx,yy,xx1,yy1);
}
in.x.ax=1;
int86(0x33,&in,&in);
/*if(status==1)
{
status=2;
in.x.ax=3;
int86(0x33,&in,&out);
xx=out.x.cx;
yy=out.x.dx;
in.x.cx=xx;
in.x.dx=yy;
in.h.bl=0;
in.x.ax=4;
int86(0x33,&in,&in);
delay(400);
}
else if(status==2)
{
in.x.ax=3;
//in.x.bx=0;
int86(0x33,&in,&out);
xx1=out.x.cx;
yy1=out.x.dx;
if((xx>65+incx&&xx<636)&&(yy>42&&yy<400+incy))
if((xx1>65+incx&&xx1<636)&&(yy1>42&&yy1<400+incy))
{
in.x.ax=2;
int86(0x33,&in,&out);
if(status1==1)
{
setcolor(forecolor);
rectangle(xx,yy,xx1,yy1);
}
if(status1==2)
{
setcolor(forecolor);
setfillstyle(1,backcolor);
bar(xx,yy,xx1,yy1);
rectangle(xx,yy,xx1,yy1);
}
if(status1==3)
{
setcolor(forecolor);
setfillstyle(1,forecolor);
bar(xx,yy,xx1,yy1);
}
in.x.ax=1;
int86(0x33,&in,&out);
}
status=1;
delay(400);
} */
}
//end
//Brush draw
else if((x>65+incx&&x<636)&&(y>42&&y<400+incy)&&status1==1&&toolselect==12&&out.h.bl==1)
{
in.x.ax=2;
int86(0x33,&in,&out);
putpixel(x,y,forecolor);
in.x.ax=1;
int86(0x33,&in,&out);
}
else if((x>65+incx&&x<636)&&(y>42&&y<400+incy)&&status1==2&&toolselect==12&&out.h.bl==1)
{
in.x.ax=2;
int86(0x33,&in,&out);
setfillstyle(1,forecolor);
setcolor(forecolor);
fillellipse(x,y,1,1);
in.x.ax=1;
int86(0x33,&in,&out);
}
else if((x>65+incx&&x<636)&&(y>42&&y<400+incy)&&status1==3&&toolselect==12&&out.h.bl==1)
{
in.x.ax=2;
int86(0x33,&in,&out);
setfillstyle(1,forecolor);
setcolor(forecolor);
fillellipse(x,y,1.5,1.5);
in.x.ax=1;
int86(0x33,&in,&out);
}
else if((x>65+incx&&x<636)&&(y>42&&y<400+incy)&&status1==4&&toolselect==12&&out.h.bl==1)
{
in.x.ax=2;
int86(0x33,&in,&out);
setfillstyle(1,forecolor);
setcolor(forecolor);
fillellipse(x,y,2,2);
in.x.ax=1;
int86(0x33,&in,&out);
}
else if((x>65+incx&&x<636)&&(y>42&&y<400+incy)&&status1==5&&toolselect==12&&out.h.bl==1)
{
in.x.ax=2;
int86(0x33,&in,&out);
setfillstyle(1,forecolor);
setcolor(forecolor);
fillellipse(x,y,2.5,2.5);
in.x.ax=1;
int86(0x33,&in,&out);
}
else if((x>65+incx&&x<636)&&(y>42&&y<400+incy)&&status1==6&&toolselect==12&&out.h.bl==1)
{
in.x.ax=2;
int86(0x33,&in,&out);
setfillstyle(1,forecolor);
setcolor(forecolor);
fillellipse(x,y,3,3);
in.x.ax=1;
int86(0x33,&in,&out);
}
else if((x>65+incx&&x<636)&&(y>42&&y<400+incy)&&status1==7&&toolselect==12&&out.h.bl==1)
{
in.x.ax=2;
int86(0x33,&in,&out);
setfillstyle(1,forecolor);
setcolor(forecolor);
fillellipse(x,y,3.5,3.5);
in.x.ax=1;
int86(0x33,&in,&out);
}
///brush draw end
//Erase
else if((x>69+incx&&x<636)&&(y>44&&y<398+incy)&&status1==1&&toolselect==2&&out.h.bl==1)
{
setfillstyle(1,backcolor);
setcolor(backcolor);
bar(x-4,y-2,x,y+2);
}
else if((x>73+incx&&x<636)&&(y>46&&y<396+incy)&&status1==2&&toolselect==2&&out.h.bl==1)
{
setfillstyle(1,backcolor);
setcolor(backcolor);
bar(x-8,y-4,x,y+4);
}
else if((x>77+incx&&x<636)&&(y>48&&y<394+incy)&&status1==3&&toolselect==2&&out.h.bl==1)
{
setfillstyle(1,backcolor);
setcolor(backcolor);
bar(x-12,y-6,x,y+6);
}
else if((x>83+incx&&x<636)&&(y>51&&y<391+incy)&&status1==4&&toolselect==2&&out.h.bl==1)
{
setfillstyle(1,backcolor);
setcolor(backcolor);
bar(x-18,y-9,x,y+9);
}
else if((x>(65+20)+incx&&x<636)&&(y>52&&y<390+incy)&&status1==5&&toolselect==2&&out.h.bl==1)
{
setfillstyle(1,backcolor);
setcolor(backcolor);
bar(x-20,y-10,x,y+10);
}
else if((x>90+incx&&x<636)&&(y>54.5&&y<400-12.5+incy)&&status1==6&&toolselect==2&&out.h.bl==1)
{
setfillstyle(1,backcolor);
setcolor(backcolor);
bar(x-25,y-12.5,x,y+12.5);
}
else if((x>95+incx&&x<636)&&(y>57&&y<385+incy)&&status1==7&&toolselect==2&&out.h.bl==1)
{
setfillstyle(1,backcolor);
setcolor(backcolor);
bar(x-30,y-15,x,y+15);
}
///erase draw end
///line drawing
else if((x>65+incx&&x<636)&&(y>42&&y<400+incy)&&out.h.bl==1&&toolselect==6&&(status==1||status==2))
{
if(status==1)
{
//int86(0x33,&in,&out);
status=2;
in.x.ax=3;
//in.x.bx=2;
int86(0x33,&in,&out);
//if(out.h.bl==0)
xx=out.x.cx;
yy=out.x.dx;
in.x.cx=xx;
in.x.dx=yy;
in.h.bl=0;
in.x.ax=4;
int86(0x33,&in,&out);
in.x.ax=1;
int86(0x33,&in,&out);
delay(400);
}
else if(status==2)
{
in.x.ax=3;
//in.x.ax=2;
int86(0x33,&in,&out);
xx1=out.x.cx;
yy1=out.x.dx;
if((xx>65+incx&&xx<636)&&(yy>42&&yy<400+incy))
if((xx1>65+incx&&xx1<636)&&(yy1>42&&yy1<400+incy))
{
if(status1==1)
setlinestyle(0,1,1);
else if(status1==2)
setlinestyle(0,1,3);
else if(status1==3)
setlinestyle(1,1,1);
else if(status1==4)
setlinestyle(2,1,1);
setcolor(forecolor);
line(xx,yy,xx1,yy1);
setlinestyle(0,1,1);
}
status=1;
delay(400);
}
}
//end
/////Text Tool Working
else if((x>65+incx&&x<636)&&(y>42&&y<400+incy)&&out.h.bl==1&&(status==1||status==2)&&toolselect==13)
{
if(status==1)
{
if(selected==1||SA==1)
{
selected=0;
SA=0;
rollp();
}
status=2;
in.x.ax=3;
int86(0x33,&in,&out);
sx=out.x.cx;
sy=out.x.dx;
selected=0;
in.x.cx=sx;
in.x.dx=sy;
in.h.bl=0;
in.x.ax=4;
int86(0x33,&in,&in);
delay(400);
}
else if(status==2)
{
in.x.ax=3;
int86(0x33,&in,&out);
sx1=out.x.cx;
sy1=out.x.dx;
if((sx>65&&sx<636)&&(sy>42&&sy<400))
if((sx1>65&&sx1<636)&&(sy1>42&&sy1<400))
{
setlinestyle(DOTTED_LINE,1,1);
setcolor(0);
in.x.ax=2;
int86(0x33,&in,&out);
rollg(sx,sy,sx1,sy1);
//setfillstyle(1,RED);
//bar(sx+1,sy+1,sx1-1,sy1-1);
rectangle(sx,sy,sx1,sy1);
setlinestyle(0,1,1);
int temp;
if(sx>sx1)
{
temp=sx1;
sx1=sx;
sx=temp;
}
if(sy>sy1)
{
temp=sy1;
sy1=sy;
sy=temp;
}
char b[2];
b[0]=NULL;
b[1]=NULL;
fx=sx+textwidth(b);
//int x=100,y=100;
while(b[0]!=27&&sy<sy1)
{
if(sy<(sy1-(textheight(b)+5)))
{
if(kbhit())
{
fflush(stdin);
b[0]=getch();
fflush(stdin);
if(b[0]==13||fx>sx1-textwidth(b))
{
sy=sy+textheight(b)+5;
fx=sx+textwidth(b);
}
outtextxy(fx,sy,b);
fx=fx+textwidth(b)+5;
}
}
else
{
status=1;
stop=1;
selected=1;
delay(400);
b[0]=NULL;
//outtextxy(fx,sy,b);
setcolor(forecolor);
fflush(stdin);
in.x.ax=1;
int86(0x33,&in,&out);
//goto enddd;
break;
}
//if(isalpha(b[0])||b[0]==' ')
//b[0]=NULL;
}
//enddd:
status =1;
stop=1;
selected=1;
delay(400);
b[0]=NULL;
setcolor(forecolor);
in.x.ax=1;
int86(0x33,&in,&out);
//break;
}
}
}
///Polygon drawing
else if((x>65+incx&&x<636)&&(y>42&&y<400+incy)&&out.h.bl==1&&toolselect==15&&(status==1||status==2))
{
if(status==1)
{
status=2;
in.x.ax=3;
int86(0x33,&in,&out);
xx=out.x.cx;
yy=out.x.dx;
in.x.cx=xx;
in.x.dx=yy;
in.h.bl=0;
in.x.ax=4;
int86(0x33,&in,&out);
delay(400);
}
else
{
in.x.ax=3;
in.x.bx=0;
int86(0x33,&in,&out);
xx1=out.x.cx;
yy1=out.x.dx;
if((xx>65+incx&&xx<636)&&(yy>42&&yy<400+incy))
if((xx1>65+incx&&xx1<636)&&(yy1>42&&yy1<400+incy))
{
if(status1==1)
setlinestyle(0,1,1);
else if(status1==2)
setlinestyle(0,1,3);
else if(status1==3)
setlinestyle(1,1,1);
else if(status1==4)
setlinestyle(2,1,1);
setcolor(forecolor);
line(xx,yy,xx1,yy1);
setlinestyle(0,1,1);
}
status=1;
//delay(400);
}
}
//spraying
else if((x>75+incx&&x<630)&&(y>42&&y<400+incy)&&status==1&&toolselect==5&&out.h.bl==1)
{
i=1;
while(i<30)
{
xx=random(5)+(x-7);
yy=random(5)+y;
putpixel(xx,yy,forecolor);
i++;
}
}
//filling
else if((x>75+incx&&x<630)&&(y>42&&y<400+incy)&&status==1&&toolselect==10&&out.h.bl==1)
{
int c;
in.x.ax=2;
int86(0x33,&in,&out);
c=getpixel(x,y);
fillcolor(x,y,c,forecolor);
in.x.ax=1;
int86(0x33,&in,&out);
}
else if((x>65+incx&&x<636)&&(y>42&&y<400+incy)&&out.h.bl==1&&(status==1||status==2)&&toolselect==8)
{
if(status==1)
{
//int86(0x33,&in,&out);
status=2;
in.x.ax=3;
//in.x.bx=0;
int86(0x33,&in,&out);
//if(out.h.bl==0)
xx=out.x.cx;
yy=out.x.dx;
in.x.cx=xx;
in.x.dx=yy;
in.h.bl=0;
in.x.ax=4;
int86(0x33,&in,&in);
delay(400);
}
else if(status==2)
{
in.x.ax=3;
//in.x.bx=0;
int86(0x33,&in,&out);
xx1=out.x.cx;
yy1=out.x.dx;
mm=abs(xx1+xx)/2;
nn=abs(yy1+yy)/2;
int rx,ry;
rx=abs(xx1-xx)/2;
ry=abs(yy1-yy)/2;
if((xx>65+incx&&xx<636)&&(yy>42&&yy<400+incy))
if((xx1>65+incx&&xx1<636)&&(yy1>42&&yy1<400+incy))
{
if(status1==1)
{
setcolor(forecolor);
ellipse(mm,nn,0,360,rx,ry);
}
if(status1==2)
{
setcolor(forecolor);
setfillstyle(1,backcolor);
fillellipse(mm,nn,rx,ry);
}
if(status1==3)
{
setcolor(forecolor);
setfillstyle(1,forecolor);
fillellipse(mm,nn,rx,ry);
}
}
status=1;
delay(400);
}
}
else if((x>65+incx&&x<636)&&(y>42&&y<400+incy)&&out.h.bl==1&&(status==1||status==2)&&toolselect==9)
{
/*if(selected==1)
{
selected=0;
cout<<"kapil";
rollbackp();
} */
//rollbackg(xx-1,yy-1,xx1+1,yy1+1);
if(status==1)
{
if(selected==1||SA==1)
{
rollp();
SA=0;
/*setcolor(WHITE);
rectangle(sx,sy,sx1,sy1);*/
}
status=2;
in.x.ax=3;
int86(0x33,&in,&out);
sx=out.x.cx;
sy=out.x.dx;
selected=0;
in.x.cx=sx;
in.x.dx=sy;
in.h.bl=0;
in.x.ax=4;
int86(0x33,&in,&in);
delay(400);
}
else if(status==2)
{
in.x.ax=3;
int86(0x33,&in,&out);
sx1=out.x.cx;
sy1=out.x.dx;
if((sx>65&&sx<636)&&(sy>42&&sy<400))
if((sx1>65&&sx1<636)&&(sy1>42&&sy1<400))
{
setlinestyle(DOTTED_LINE,1,1);
setcolor(0);
in.x.ax=2;
int86(0x33,&in,&out);
rollg(sx,sy,sx1,sy1);
rectangle(sx,sy,sx1,sy1);
setlinestyle(0,1,1);
setcolor(forecolor);
in.x.ax=1;
int86(0x33,&in,&out);
}
status=1;
stop=1;
selected=1;
/*if(selected==0)
selected=1;*/
delay(400);
}
}
else if(St==2&&Ct==1)
{
inc=20;
}
else if(St!=2&&Ct==1)
{
inc=0;
}
}
}
//getch();
}
void gimage(int x,int y,int x1,int y1)
{
int i;
in.x.ax=2;
int86(0x33,&in,&out);
ofstream f("image");
for(;x<=x1;x++)
for(i=y;i<=y1;i++)
f<<endl<<x<<"\t"<<i<<"\t"<<getpixel(x,i);
f.close();
in.x.ax=1;
int86(0x33,&in,&out);
}
void pimage(int x,int y,int x2,int y2)
{
setcolor(7);
line(x,y,x2,y);
line(x,y,x,y2);
line(x,y2,x2,y2);
line(x2,y,x2,y2);
ifstream f("image");
int x1,y1,color;
if(!f.fail())
while(!f.eof())
{
f>>x1>>y1>>color;
putpixel(x1,y1,color);
}
f.close();
}
void tool_gimage(int x,int y,int x1,int y1)
{
int i;
in.x.ax=2;
int86(0x33,&in,&out);
ofstream f("toolimage");
for(;x<=x1;x++)
for(i=y;i<=y1;i++)
f<<endl<<x<<"\t"<<i<<"\t"<<getpixel(x,i);
f.close();
in.x.ax=1;
int86(0x33,&in,&out);
}
void tool_pimage()
{
ifstream f("toolimage");
int x1,y1,color;
if(!f.fail())
while(!f.eof())
{
f>>x1>>y1>>color;
putpixel(x1,y1,color);
}
f.close();
}
int fillcolor(int x,int y,int color,int ncolor)
{
if(getpixel(x,y)==color)
{
putpixel(x,y,ncolor);
delay(1);
fillcolor(x+1,y,color,ncolor);
fillcolor(x-1,y,color,ncolor);
fillcolor(x,y+1,color,ncolor);
fillcolor(x,y-1,color,ncolor);
fillcolor(x+1,y+1,color,ncolor);
fillcolor(x+1,y-1,color,ncolor);
fillcolor(x-1,y+1,color,ncolor);
fillcolor(x-1,y-1,color,ncolor);
}
return 1;
}
void clipboard(int x,int y,int x1,int y1)
{
int i;
in.x.ax=2;
int86(0x33,&in,&out);
ofstream f("clip");
for(;x<=x1;x++)
for(i=y;i<=y1;i++)
f<<endl<<x<<"\t"<<i<<"\t"<<getpixel(x,i);
f.close();
in.x.ax=1;
int86(0x33,&in,&out);
}
void paste()
{
ifstream f("clip");
int x1,y1,color;
int x2,y2;
if(!f.fail())
{
f>>x2>>y2>>color;
while(!f.eof())
{
f>>x1>>y1>>color;
x1=x1-x2+67;
y1=y1-y2+42;
putpixel(x1,y1,color);
}
}
f.close();
}
void rollg(int x,int y,int x1,int y1)
{
int temp;
in.x.ax=2;
int86(0x33,&in,&out);
ofstream f("roll");
if(x>x1)
{
temp=x1;
x1=x;
x=temp;
}
if(y>y1)
{
temp=y1;
y1=y;
y=temp;
}
int i,j;
for(i=x,j=y;i<=x1;i++)
f<<endl<<i<<"\t"<<j<<"\t"<<getpixel(i,j);
for(i=x,j=y;j<=y1;j++)
f<<endl<<i<<"\t"<<j<<"\t"<<getpixel(i,j);
for(i=x1,j=y1;j>=y;j--)
f<<endl<<i<<"\t"<<j<<"\t"<<getpixel(i,j);
for(i=x1,j=y1;i>=x;i--)
f<<endl<<i<<"\t"<<j<<"\t"<<getpixel(i,j);
f.close();
in.x.ax=1;
int86(0x33,&in,&out);
}
void rollp()
{
ifstream f("roll");
int x1,y1,color;
if(!f.fail())
while(!f.eof())
{
f>>x1>>y1>>color;
putpixel(x1,y1,color);
}
f.close();
}
void mnuViewToolbar_click()
{
int x,y;
if(Ts==0)
{
ofstream f("toc");
for(x=2;x<=65;x++)
for(y=42;y<=399;y++)
f<<endl<<x<<"\t"<<y<<"\t"<<getpixel(x,y);
f.close();
Ts=1;
}
else if(Ts==1)
{
sound(5000);
delay(2);
nosound();
if(Ct==1&&St==1)
{
setfillstyle(1,15);
bar(2,42,65,399);
Ts=2;
incx=-63;
}
else if(Ct==2&&St==1)
{
setfillstyle(1,15);
bar(2,42,65,454);
incx=-63;
Ts=2;
}
else if(Ct==2&&St==2)
{
setfillstyle(1,15);
bar(2,42,65,476);
incx=-63;
Ts=2;
}
}
else if(Ts==2)
{
sound(5000);
delay(2);
nosound();
ifstream s("toc");
int x1,y1,color;
if(!s.fail())
while(!s.eof())
{
s>>x1>>y1>>color;
putpixel(x1,y1,color);
}
s.close();
incx=0;
if(Ct==2&&St==1)
{
setfillstyle(1,7);
bar(2,399,65,454);
incx=0;
}
if(Ct==2&&St==2)
{
setfillstyle(1,7);
bar(2,399,65,476);
incx=0;
}
Ts=1;
}
}
void mnuViewColorBox_click()
{
int x,y;
if(Ct==0)
{
ofstream f("coc");
for(x=2;x<=636;x++)
for(y=400;y<=455;y++)
f<<endl<<x<<"\t"<<y<<"\t"<<getpixel(x,y);
f.close();
Ct=1;
}
else if(Ct==1)
{
sound(5000);
delay(2);
nosound();
if(St==1)
{
setfillstyle(1,15);
bar(2,399,636,454);
if(Ts==1)
{
setfillstyle(1,7);
bar(2,399,65,454);
}
incy=54;
Ct=2;
}
else if(St==2)
{
setfillstyle(1,15);
bar(2,399+20,636,454+20);
setfillstyle(1,7);
bar(2,399+20,65,454+20);
Ct=2;
incy=74;
}
}
else if(Ct==2)
{
sound(5000);
delay(2);
nosound();
if(St==1)
{
ifstream f("coc");
int x1,y1,color;
if(!f.fail())
while(!f.eof())
{
f>>x1>>y1>>color;
putpixel(x1,y1,color);
}
f.close();
incy=0;
Ct=1;
}
else if(St==2)
{
ifstream f("coc");
int x1,y1,color;
if(!f.fail())
while(!f.eof())
{
f>>x1>>y1>>color;
putpixel(x1,y1+20,color);
}
f.close();
incy=20;
Ct=1;
}
}
}
void mnuViewStatusBar_click()
{
int x,y;
if(St==0)
{
ofstream f("soc");
for(x=3;x<=636;x++)
for(y=455;y<=476;y++)
f<<endl<<x<<"\t"<<y<<"\t"<<getpixel(x,y);
f.close();
St=1;
}
else if(St==1)
{
sound(5000);
delay(2);
nosound();
if(Ct==1)
{
setfillstyle(1,15);
bar(2,399,636,454);
ifstream f("coc");
int x1,y1,color;
if(!f.fail())
while(!f.eof())
{
f>>x1>>y1>>color;
putpixel(x1,y1+20,color);
}
f.close();
setfillstyle(1,7);
bar(2,399,65,419);
incy=20;
St=2;
}
else
{
setfillstyle(1,15);
bar(3,456,636,476);
incy=76;
if(Ts==1)
{
setfillstyle(1,7);
bar(2,454,65,476);
}
St=2;
}
}
else if(St==2)
{
sound(5000);
delay(2);
nosound();
if(Ct==1)
{
ifstream f("coc");
int x1,y1,color;
if(!f.fail())
while(!f.eof())
{
f>>x1>>y1>>color;
putpixel(x1,y1,color);
}
f.close();
ifstream s("soc");
if(!s.fail())
while(!s.eof())
{
s>>x1>>y1>>color;
putpixel(x1,y1,color);
}
s.close();
incy=0;
St=1;
}
else if(Ct==2)
{
ifstream f("soc");
int x1,y1,color;
if(!f.fail())
while(!f.eof())
{
f>>x1>>y1>>color;
putpixel(x1,y1,color);
}
f.close();
incy=54;
St=1;
}
}
}
void mnuViewBitmap_click()
{
int x,y,x1,y1,color;
char a= ' ';
if(Vs==0)
{
ofstream s("Screen");
for(x=0;x<=640;x++)
for(y=0;y<=480;y++)
s<<endl<<x<<"\t"<<y<<"\t"<<getpixel(x,y);
s.close();
ofstream f("Bitmap");
for(x=64+incx;x<=636;x++)
for(y=42;y<=399+incy;y++)
f<<endl<<x<<"\t"<<y<<"\t"<<getpixel(x,y);
f.close();
clearviewport();
rectangle(0,0,640,480);
rectangle(2,2,638,478);
setcolor(4);
outtextxy(250,240,"Processing Bitmap....");
ifstream fr("Bitmap");
if(!fr.fail())
while(!fr.eof())
{
fr>>x1>>y1>>color;
putpixel(x1,y1,color);
}
fr.close();
Vs=1;
}
else if(Vs==1)
{
while(1)
{
if(kbhit())
{
a=getch();
}
while(a!=27)
{
ifstream fr("Screen");
if(!fr.fail())
while(!fr.eof())
{
fr>>x1>>y1>>color;
putpixel(x1,y1,color);
}
fr.close();
Vs=0;
break;
}
}
}
}
////
void mnuFileNew_click()
{
mnuFileExit_click(1);
}
void mnuFileOpen_click()
{
mnuFileExit_click(2);
char file[10],a[2];
dlgDB(2);
////
int x,m=127,y,n=160,i=0;
a[0]='\0';
a[1]='\0';
while(1)
{
if(i<=8)
{
if(kbhit())
{
a[0]=getch();
file[i]=a[0];
file[i+1]='\0';
setcolor(0);
outtextxy(m,n,a);
m=m+textwidth(a);
i++;
}
}
in.x.ax=1;
int86(0x33,&in,&out);
in.x.ax=3;
int86(0x33,&in,&out);
x=out.x.cx;
y=out.x.dx;
if((x>=170&&x<=215)&&(y>=200&&y<=215)&&out.h.bl==1||(x>=285&&x<=295)&&(y>=103&&y<=111)&&out.h.bl==1)
{
in.x.ax=2;
int86(0x33,&in,&out);
DB_pimage();
break;
}
else if((x>=115&&x<=160)&&(y>=200&&y<=215)&&out.h.bl==1)
{
in.x.ax=2;
int86(0x33,&in,&out);
DB_pimage();
open(file);
setfillstyle(1,15);
bar(65+incx,42,636,399+incy);
outtextxy(15,9,file);
break;
}
}
}
void mnuFileSave_click(int cs)
{
char file[10],a[2];
DB_gimage(100,100,300,220);
dlgDB(cs);
////
int x,m=127,y,n=160,i=0;
a[0]='\0';
a[1]='\0';
while(1)
{
if(i<=9)
{
if(kbhit())
{
a[0]=getch();
file[i]=a[0];
file[i+1]='\0';
setcolor(0);
outtextxy(m,n,a);
m=m+textwidth(a);
i++;
}
}
in.x.ax=1;
int86(0x33,&in,&out);
in.x.ax=3;
int86(0x33,&in,&out);
x=out.x.cx;
y=out.x.dx;
if((x>=170&&x<=215)&&(y>=200&&y<=215)&&out.h.bl==1||(x>=285&&x<=295)&&(y>=103&&y<=111)&&out.h.bl==1)
{
in.x.ax=2;
int86(0x33,&in,&out);
DB_pimage();
break;
}
else if((x>=115&&x<=160)&&(y>=200&&y<=215)&&out.h.bl==1)
{
//cout<<"ssssss";
if(cs==1)
{
in.x.ax=2;
int86(0x33,&in,&out);
DB_pimage();
save(file);
setfillstyle(1,15);
bar(65+incx,42,636,399+incy);
settextstyle(1,0,1);
outtextxy(15,9,"untitled-Paint");
DB_gimage(100,100,300,220);
break;
}
else if(cs==2)
{
in.x.ax=2;
int86(0x33,&in,&out);
save(file);
DB_pimage();
break;
}
else if (cs==0)
{
in.x.ax=2;
int86(0x33,&in,&out);
DB_pimage();
save(file);
break;
}
else if(cs==3||cs==4)
{
in.x.ax=2;
int86(0x33,&in,&out);
DB_pimage();
save(file);
DB_pimage();
outtextxy(15,9,file);
break;
}
}
}
}
void mnuFileExit_click(int cx)
{
sound(5000);
delay(5);
nosound();
EDB_gimage(100,100,300,180);
setfillstyle(1,7);
bar(100,100,300,180);
setfillstyle(1,1);
bar(102,102,298,113);
setfillstyle(1,7);
bar(285,103,295,111);
settextstyle(2,0,4);
outtextxy(104,102,"Paint");
setcolor(0);
outtextxy(140,130,"Save Changes to untitled?");
////
setcolor(15);
line(285,103,295,103);
line(285,103,285,111);
setcolor(0);
line(295,103,295,111);
line(286,111,295,111);
outtextxy(288,100,"x");
////
setcolor(15);
line(115,160,160,160);
line(115,160,115,175);
setcolor(0);
line(160,160,160,175);
line(115,175,160,175);
outtextxy(130,162,"Yes");
////
setcolor(15);
line(170,160,215,160);
line(170,160,170,175);
setcolor(0);
line(215,160,215,175);
line(170,175,215,175);
outtextxy(185,162,"No");
////
setcolor(15);
line(225,160,270,160);
line(225,160,225,175);
setcolor(0);
line(270,160,270,175);
line(225,175,270,175);
outtextxy(231,162,"Cancel");
////
int x,y;
in.x.ax=1;
int86(0x33,&in,&out);
while(1)
{
in.x.ax=3;
int86(0x33,&in,&out);
x=out.x.cx;
y=out.x.dx;
if((x>=225&&x<=270)&&(y>=160&&y<=175)&&out.h.bl==1||(x>=285&&x<=295)&&(y>=103&&y<=111)&&out.h.bl==1)
{
in.x.ax=2;
int86(0x33,&in,&out);
EDB_pimage();
if(cx==0)
exit(0);
else
break;
}
else if((x>=115&&x<=160)&&(y>=160&&y<=175)&&out.h.bl==1)
{
if(cx==0)
{
EDB_pimage();
in.x.ax=2;
int86(0x33,&in,&out);
mnuFileSave_click(0);
exit(0);
}
else if(cx==1)
{
in.x.ax=2;
int86(0x33,&in,&out);
EDB_pimage();
DB_gimage(100,100,300,220);
mnuFileSave_click(1);
DB_pimage();
setfillstyle(1,backcolor);
bar(65+incx,42,636,399+incy);
break;
}
if(cx==2)
{
in.x.ax=2;
int86(0x33,&in,&out);
EDB_pimage();
mnuFileSave_click(0);
DB_pimage();
//DB_pimage();
break;
}
in.x.ax=2;
int86(0x33,&in,&out);
//goto save function PASS an int value to differenciate that it called by menu or close fuction
}
else if((x>=170&&x<=215)&&(y>=160&&y<=175)&&out.h.bl==1)
{
in.x.ax=2;
int86(0x33,&in,&out);
if(cx==0)exit(0);
else if(cx==1)
{
setfillstyle(1,15);
bar(65+incx,42,636,399+incy);
}
EDB_pimage();
in.x.ax=1;
int86(0x33,&in,&out);
break;
}
}
}
////mnuEditSelectAll
void mnuEditSelectAll_click()
{
sx=67+incx,sy=42,sx1=636,sy1=399+incy;
setlinestyle(DOTTED_LINE,1,1);
setcolor(0);
in.x.ax=2;
int86(0x33,&in,&out);
rollg(sx,sy,sx1,sy1);
rectangle(sx,sy,sx1,sy1);
setlinestyle(0,1,1);
setcolor(forecolor);
in.x.ax=1;
int86(0x33,&in,&out);
}
////////////// ////////////////
void mnuColorEditColor_click(int x,int y)
{
//Dialog
int color,m=0;
setcolor(15);
setfillstyle(1,7);
bar(180,100,400,260);
setfillstyle(1,1);
bar(180,100,398,115);
setlinestyle(0,0,1);
line(180,100,180,260);
line(181,101,181,259);
line(180,100,400,100);
line(181,101,399,101);
setcolor(0);
line(181,260,400,260);
line(400,100,400,259);
setcolor(15);
line(191,238,191,254);
line(191,238,234,238);
line(240,237,285,237);
line(240,237,240,255);
setcolor(0);
line(190,237,190,255);
line(190,237,235,237);
line(235,238,235,255);
line(190,255,235,255);
line(240,255,285,255);
line(285,237,285,255);
setcolor(15);
outtextxy(185,103,"Edit colors");
setcolor(0);
settextstyle(2,0,4);
outtextxy(247,240,"Cancel");
outtextxy(208,240,"Ok");
outtextxy(185,120,"Set RGB...");
//outtextxy(185,135,"Color(0 to 15):");
outtextxy(300,135,"Output Color:-");
outtextxy(185,157,"Red :-");
outtextxy(185,177,"Green:-");
outtextxy(185,197,"Blue :-");
/*//
setcolor(0);
line(268,135,287,135);
line(268,135,268,149);
setcolor(15);
line(288,136,288,149);
line(268,150,288,150);
////*/
setcolor(0);
line(255,156,287,156);
line(255,156,255,170);
setcolor(15);
line(288,157,288,171);
line(256,171,288,171);
////
setcolor(0);
line(255,176,287,176);
line(255,176,255,190);
setcolor(15);
line(288,177,288,191);
line(256,191,288,191);
////
setcolor(0);
line(255,196,287,196);
line(255,196,255,211);
setcolor(15);
line(288,197,288,211);
line(256,211,288,211);
////
//rectangle(320,160,360,200);
////
setcolor(0);
line(320,160,359,160);
line(320,160,320,200);
setcolor(15);
line(360,161,360,200);
line(321,200,360,200);
////
setfillstyle(1,color);
bar(321,161,359,199);
setfillstyle(1,15);
//bar(269,136,287,149);
bar(256,157,287,170);
bar(256,177,287,190);
bar(256,197,287,210);
/*setrgbpalette(p.colors[1],155,0,112);
setrgbpalette(p.colors[2],255,0,0);
setrgbpalette(p.colors[3],115,0,255);*/
in.x.ax=1;
int86(0x33,&in,&out);
int r=0,g=0,b=0;
char key=65,red[5],green[5],blue[5];
while(1)
{
if(kbhit())
{
key=getch();
if(key=='r'||key=='R')
{
setcolor(15);
outtextxy(260,158,red);
if(r<255)r++;
itoa(r,red,10);
setcolor(0);
outtextxy(260,158,red);
}
if(key==18)
{
setcolor(15);
outtextxy(260,158,red);
if(r>0)r--;
itoa(r,red,10);
setcolor(0);
outtextxy(260,158,red);
}
if(key=='g'||key=='G')
{
setcolor(15);
outtextxy(260,178,green);
if(g<255)g++;
itoa(g,green,10);
setcolor(0);
outtextxy(260,178,green);
}
if(key==7)
{
setcolor(15);
outtextxy(260,178,green);
if(g>0)g--;
itoa(g,green,10);
setcolor(0);
outtextxy(260,178,green);
}
if(key=='b'||key=='B')
{
setcolor(15);
outtextxy(260,198,blue);
if(b<255)b++;
itoa(b,blue,10);
setcolor(0);
outtextxy(260,198,blue);
}
if(key==2)
{
setcolor(15);
outtextxy(260,198,blue);
if(b>0)b--;
itoa(b,blue,10);
setcolor(0);
outtextxy(260,198,blue);
}
}
///set the color in the box
struct palettetype p;
getpalette(&p);
setrgbpalette(p.colors[6],r,g,b);
setcolor(6);
setfillstyle(1,6);
bar(321,161,359,199);
////
in.x.ax=3;
int86(0x33,&in,&out);
x=out.x.cx;
y=out.x.dx;
if((x>=321&&x<=359)&&(y>=161&&y<=199)&&out.h.bl==1)
{
in.x.ax=2;
int86(0x33,&in,&out);
color=getpixel(x,y);
m=1;
setfillstyle(1,color);
bar(321,161,359,199);
in.x.ax=1;
int86(0x33,&in,&out);
}
else if((x>=190&&x<=234)&&(y>=237&&y<=255)&&out.h.bl==1)
{
in.x.ax=2;
int86(0x33,&in,&out);
if(m==1)forecolor=color;
DB_pimage();
in.x.ax=1;
int86(0x33,&in,&out);
break;
}
else if((x>=240&&x<=285)&&(y>=237&&y<=255)&out.h.bl==1)
{
in.x.ax=2;
int86(0x33,&in,&out);
DB_pimage();
in.x.ax=1;
int86(0x33,&in,&out);
break;
}
}
}
void DB_gimage(int x,int y,int x1,int y1)
{
int i;
in.x.ax=2;
int86(0x33,&in,&out);
ofstream f("dbim");
for(;x<=x1;x++)
for(i=y;i<=y1;i++)
f<<endl<<x<<"\t"<<i<<"\t"<<getpixel(x,i);
f.close();
in.x.ax=1;
int86(0x33,&in,&out);
}
void DB_pimage()
{
ifstream f("dbim");
int x1,y1,color;
if(!f.fail())
while(!f.eof())
{
f>>x1>>y1>>color;
putpixel(x1,y1,color);
}
f.close();
}
////////////////// ////////////////////
void dlgDB(int cs)
{
setfillstyle(1,7);
bar(100,100,300,220);
setfillstyle(1,1);
bar(102,102,298,113);
setfillstyle(1,7);
bar(285,103,295,111);
setcolor(15);
settextstyle(2,0,4);
if(cs==2)
{
outtextxy(104,102,"Open");
setcolor(4);
outtextxy(115,130,"Enter File Name to open:");
}
else if(cs==3||cs==0||cs==1)
{
outtextxy(104,102,"Save");
setcolor(4);
outtextxy(115,130,"Enter File Name to save:");
}
else if(cs==4)
{
outtextxy(104,102,"Save as");
setcolor(4);
outtextxy(115,130,"Enter File Name to save:");
}
////
setcolor(15);
line(285,103,295,103);
line(285,103,285,111);
setcolor(0);
line(295,103,295,111);
line(286,111,295,111);
outtextxy(288,100,"x");
////
////
setcolor(15);
line(115,160+35,160,160+35);
line(115,160+35,115,175+35);
setcolor(0);
line(160,160+35,160,175+35);
line(115,175+35,160,175+35);
outtextxy(130,162+35,"Yes");
////
setcolor(15);
line(170,160+35,215,160+35);
line(170,160+35,170,175+35);
setcolor(0);
line(215,160+35,215,175+35);
line(170,175+35,215,175+35);
outtextxy(180,162+35,"Canel");
////
setfillstyle(1,15);
bar(126,161,239,174);
setcolor(0);
line(125,160,240,160);
line(125,160,125,175);
setcolor(15);
line(240,160,240,175);
line(125,175,240,175);
}
void EDB_gimage(int x,int y,int x1,int y1)
{
ofstream f("exitDB");
int y2;
for (;x<=x1;x++)
{
for (y2=y;y2<=y1;y2++)
{
f<<endl<<x<<"\t"<<y2<<"\t"<<getpixel(x,y2);
}
}
}
void save(char *a)
{
int i,x=65+incx,x1=636,y=42,y1=399+incy;
in.x.ax=2;
int86(0x33,&in,&out);
ofstream f(a);
for(;x<=x1;x++)
for(i=y;i<=y1;i++)
f<<endl<<x<<"\t"<<i<<"\t"<<getpixel(x,i);
f.close();
in.x.ax=1;
int86(0x33,&in,&out);
}
void open(char *a)
{
ifstream f(a);
int x1,y1,color;
int x2,y2;
if(!f.fail())
{
f>>x2>>y2>>color;
while(!f.eof())
{
f>>x1>>y1>>color;
x1=x1-x2+65-incx;
y1=y1-y2+42;
if(y1<=399)
{
putpixel(x1,y1,color);
}
}
}
f.close();
}
void EDB_pimage()
{
ifstream f("exitDB");
int x1,y1,color;
//if(!f.fail())
while(!f.eof())
{
f>>x1>>y1>>color;
putpixel(x1,y1,color);
}
f.close();
}
void mnuImageFlipv_click()
{
void ppimage(int,int);
int x1=65,y1=42,x2=636,y2=399;
gimage(x1,y1,x2,y2);
ppimage(x2,y2);
}
void ppimage(int x2,int y2)
{
ifstream f("image");
int x1,y1,color,x3;
f>>x1>>y1>>color;
x3=x1;
if(!f.fail())
while(!f.eof())
{
f>>x1>>y1>>color;
if(x1!=x3)
x2--;
x3=x1;
putpixel(x2,y1,color);
}
f.close();
}
void mnuImageFliph_click()
{
void ppimage1(int,int);
void gimage1(int x,int y,int x1,int y1);
int x1=65,y1=42,x2=636,y2=399;
gimage1(x1,y1,x2,y2);
ppimage1(x2,y2);
}
void gimage1(int x,int y,int x1,int y1)
{
int i;
in.x.ax=2;
int86(0x33,&in,&out);
ofstream f("image1");
for(;y<=y1;y++)
for(i=x;i<=x1;i++)
f<<endl<<i<<"\t"<<y<<"\t"<<getpixel(i,y);
f.close();
in.x.ax=1;
int86(0x33,&in,&out);
}
void ppimage1(int x2,int y2)
{
ifstream f("image1");
int x1,y1,color,y3;
f>>x1>>y1>>color;
y3=y1;
if(!f.fail())
while(!f.eof())
{
f>>x1>>y1>>color;
if(y1!=y3)
y2--;
y3=y1;
putpixel(x1,y2,color);
}
f.close();
}
void mnuImageClearImage_click()
{
setfillstyle(1,backcolor);
bar(65+incx,42,636,399+incy);
}
/////////// ////////////////////
void show_Cursor(void)
{
in.x.ax=1;
int86(0x33,&in,&out);
}
void hide_Cursor(void)
{
in.x.ax=2;
int86(0x33,&in,&out);
}
No comments :
Post a Comment