home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SMPD PC.1517: A86 Macro Assembler 3.22
/
smpd_pc1517_a86_macro_asm.img
/
PIX.ZIP
/
PIXED.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1994-03-08
|
29KB
|
977 lines
Program PixEd; {* PIXel EDitor v1.5 copyright (c) 1994 Matias Nyrell *}
Uses
Crt, Dos, Graph;
Var
EditSize : Record
X, Y : ShortInt;
End;
ChangeWith, HighLight,
NumAnswer, PositionX,
PositionY, OldPositionX,
OldPositionY, VideoMode : ShortInt;
Ch, Ch2 : Char;
Color, PixelColor,
I, J, ErrorCode : Integer;
HighlightChange,
PositionChange, Draw,
DrawChange, RightChoose : Boolean;
SaveFileName : String[8];
StrColor : String[3];
Cursor : Pointer;
SaveFile : Text;
Procedure VariableInit;
Begin {VariableInit}
HighlightChange := true;
PositionChange := true;
DrawChange := true;
Draw := false;
RightChoose := false;
EditSize.X := 30;
EditSize.Y := 30;
Color := 0;
ChangeWith := 1;
HighLight := 1;
VideoMode := 0;
SaveFileName := ' ';
End; {VariableInit}
Procedure GraphInit;
Var
GraphDriver, GraphMode : Integer;
{$F+}
Function MyDetectVGA256 : Integer;
Begin
MyDetectVGA256 := 2;
End;
{$F-}
Begin {GraphInit}
If ParamStr(1)= '' then
Begin
ClrScr;
TextColor(7);
GotoXY(2,10);
Writeln('Please choose a graphic mode:');
GotoXY(5,11);
Writeln(' A - EGA mode(640*350*16)');
GotoXY(5,12);
Writeln(' B - VGA mode(640*400*256)');
GotoXY(5,13);
Writeln(' C - VGA mode(640*480*256)');
Ch:= ReadKey;
If (Ch= 'a') or (Ch= 'A') then
Begin
GraphDriver:= EGA;
GraphMode := EGAHi;
VideoMode := 0;
RightChoose:= true;
End;
If (Ch= 'b') or (Ch= 'B') then
Begin
GraphDriver:= InstallUserDriver('SVGA256', @MyDetectVGA256);
GraphMode := 1;
VideoMode := 1;
RightChoose:= true;
End;
If (Ch= 'c') or (Ch= 'C') then
Begin
GraphDriver:= InstallUserDriver('SVGA256', @MyDetectVGA256);
GraphMode := 2;
VideoMode := 1;
RightChoose:= true;
End;
If RightChoose= false then
Begin
TextColor(15);
Writeln;
Writeln('Error - please restart!');
TextColor(7);
Delay(500);
Halt(1);
End;
End;
If (ParamStr(1)= 'e') or (ParamStr(1)= 'E') or (ParamStr(1)= 'ega') or (ParamStr(1)= 'EGA') then
Begin
GraphDriver:= EGA;
GraphMode := EGAHi;
VideoMode := 0;
End;
If (ParamStr(1)= 'v1') or (ParamStr(1)= 'V1') or (ParamStr(1)= 'vga1') or (ParamStr(1)= 'VGA1') then
Begin
GraphDriver:= InstallUserDriver('SVGA256', @MyDetectVGA256);
GraphMode := 1;
VideoMode := 1;
End;
If (ParamStr(1)= 'v2') or (ParamStr(1)= 'V2') or (ParamStr(1)= 'vga2') or (ParamStr(1)= 'VGA2') then
Begin
GraphDriver:= InstallUserDriver('SVGA256', @MyDetectVGA256);
GraphMode := 2;
VideoMode := 1;
End;
InitGraph(GraphDriver,GraphMode,'');
End; {GraphInit}
Procedure ImageInit;
Begin {ImageInit}
SetColor(15);
Rectangle(0, 0, 6, 6);
GetMem(Cursor, ImageSize(0, 0, 6, 6));
GetImage(0, 0, 6, 6, Cursor^);
SetColor(0);
Rectangle(0, 0, 6, 6);
End; {ImageInit}
Procedure ScreenInit;
Begin {ScreenInit}
ClearDevice;
PositionX := 0;
PositionY := 0;
OldPositionX := 0;
OldPositionY := 0;
SetFillStyle(1,0);
Bar(0, 0, 640, 350);
SetFillStyle(1,8); { Gröna delen till höger }
Bar(380, 0, 617, 191);
SetColor(10);
Rectangle(374, -1, 623, 196);
SetColor(2);
Rectangle(373, -1, 624, 197);
Rectangle(375, -1, 622, 195);
SetColor(0);
SetTextStyle(1, 0, 2);
OutTextXY(401, 11, 'Load picture');
SetColor(15);
OutTextXY(400, 9, 'Load picture');
SetColor(0);
SetTextStyle(1, 0, 2);
OutTextXY(401, 36, 'Save picture');
SetColor(15);
OutTextXY(400, 34, 'Save picture');
SetColor(0);
SetTextStyle(1, 0, 2);
OutTextXY(401, 61, 'Clear picture');
SetColor(15);
OutTextXY(400, 59, 'Clear picture');
SetColor(0);
SetTextStyle(1, 0, 2);
OutTextXY(401, 96, 'Edit picture');
SetColor(15);
OutTextXY(400, 94, 'Edit picture');
SetColor(0);
SetTextStyle(1, 0, 2);
OutTextXY(401, 131, 'Change picture size');
SetColor(15);
OutTextXY(400, 129, 'Change picture size');
SetColor(0);
SetTextStyle(1, 0, 2);
OutTextXY(401, 156, 'Exit');
SetColor(15);
OutTextXY(400, 154, 'Exit');
If HighLight=1 then
Begin
SetColor(14);
OutTextXY(400, 9, 'Load picture');
End;
If HighLight=2 then
Begin
SetColor(14);
OutTextXY(400, 34, 'Save picture');
End;
If HighLight=3 then
Begin
SetColor(14);
OutTextXY(400, 59, 'Clear picture');
End;
If HighLight=4 then
Begin
SetColor(14);
OutTextXY(400, 94, 'Edit picture');
End;
If HighLight=5 then
Begin
SetColor(14);
OutTextXY(400, 129, 'Change picture size');
End;
If HighLight=6 then
Begin
SetColor(14);
OutTextXY(400, 154, 'Exit');
End;
SetColor(15); { Röda delen till vänster }
For I:= 0 to EditSize.X do
Line(I*10, 0, I*10, EditSize.Y*10);
For I:= 0 to EditSize.Y do
Line( 0, I*10, EditSize.X*10, I*10);
SetColor(4);
Rectangle(-1, -1, 305, 304);
Rectangle(-1, -1, 307, 306);
SetColor(12);
Rectangle(-1, -1, 306, 305);
SetColor(9); { Blå delen i mitten }
Line(306, 36, 374, 38);
Line(306, 27, 306, 45);
Line(374, 29, 374, 54);
SetColor(1);
Line(307, 37, 373, 39);
Line(307, 35, 373, 37);
Line(307, 23, 307, 35);
Line(307, 37, 307, 50);
Line(373, 20, 373, 36);
Line(373, 37, 373, 60);
SetColor(9);
Line(306, 207, 374, 196);
Line(306, 185, 306, 225);
Line(374, 180, 374, 196);
Line(374, 196, 385, 196);
SetColor(1);
Line(307, 206, 373, 195);
Line(307, 208, 373, 197);
Line(307, 170, 307, 206);
Line(307, 208, 307, 250);
Line(373, 170, 373, 195);
Line(373, 197, 400, 197);
SetColor(7);
SetTextStyle(0, 0, 1);
OutTextXY(317, 45, 'Active');
OutTextXY(321, 55, 'Color');
SetFillStyle(1, Color);
Bar(315, 65, 365, 100);
SetColor(0);
Str(Color, StrColor);
OutTextXY(331, 78, StrColor);
SetColor(7);
OutTextXY(317, 105, 'Change');
OutTextXY(325, 115, 'With');
OutTextXY(312, 125, '+ and -');
OutTextXY(310, 140, 'F1:+- ');
OutTextXY(310, 150, 'F2:+- ');
OutTextXY(310, 160, 'F3:+- ');
OutTextXY(363, 140, '1');
OutTextXY(363, 150, '5');
OutTextXY(355, 160, '10');
SetTextStyle(1, 0, 2);
SetColor(15);
End; {ScreenInit}
Procedure EditMode;
Begin {EditMode}
Repeat
If HighLightChange= true then
Begin
SetTextStyle(1, 0, 2);
If HighLight= 1 then
Begin
SetColor(15);
OutTextXY(400, 154, 'Exit');
SetColor(14);
OutTextXY(400, 9, 'Load picture');
SetColor(15);
OutTextXY(400, 34, 'Save picture');
End;
If HighLight= 2 then
Begin
SetColor(15);
OutTextXY(400, 9, 'Load picture');
SetColor(14);
OutTextXY(400, 34, 'Save picture');
SetColor(15);
OutTextXY(400, 59, 'Clear picture');
End;
If HighLight= 3 then
Begin
SetColor(15);
OutTextXY(400, 34, 'Save picture');
SetColor(14);
OutTextXY(400, 59, 'Clear picture');
SetColor(15);
OutTextXY(400, 94, 'Edit picture');
End;
If HighLight= 4 then
Begin
SetColor(15);
OutTextXY(400, 59, 'Clear picture');
SetColor(14);
OutTextXY(400, 94, 'Edit picture');
SetColor(15);
OutTextXY(400, 129, 'Change picture size');
End;
If HighLight= 5 then
Begin
SetColor(15);
OutTextXY(400, 94, 'Edit picture');
SetColor(14);
OutTextXY(400, 129, 'Change picture size');
SetColor(15);
OutTextXY(400, 154, 'Exit');
End;
If HighLight= 6 then
Begin
SetColor(15);
OutTextXY(400, 129, 'Change picture size');
SetColor(14);
OutTextXY(400, 154, 'Exit');
SetColor(15);
OutTextXY(400, 9, 'Load picture');
End;
HighlightChange:= false;
End;
Ch:= ReadKey;
If Ch= Chr(72) then
Begin
HighLight:= HighLight-1;
If HighLight<1 then
HighLight:= 6;
HighlightChange:= true;
End;
If Ch= Chr(80) then
Begin
HighLight:= HighLight+1;
If HighLight>6 then
HighLight:= 1;
HighlightChange:= true;
End;
If Ch= Chr(59) then
ChangeWith:= 1;
If Ch= Chr(60) then
ChangeWith:= 5;
If Ch= Chr(61) then
ChangeWith:= 10;
If Ch= Chr(45) then
Begin
If VideoMode= 0 then
Begin
Color:= Color-ChangeWith;
If Color<0 then
Color:= 15;
SetFillStyle(1, Color);
Bar(315, 65, 365, 100);
End;
If VideoMode= 1 then
Begin
Color:= Color-ChangeWith;
If Color<0 then
Color:= 255;
SetFillStyle(1, Color);
Bar(315, 65, 365, 100);
End;
SetTextStyle(0, 0, 1);
SetColor(0);
Str(Color, StrColor);
OutTextXY(331, 78, StrColor);
End;
If Ch= Chr(43) then
Begin
If VideoMode= 0 then
Begin
Color:= Color+ChangeWith;
If Color>15 then
Color:= 0;
SetFillStyle(1, Color);
Bar(315, 65, 365, 100);
End;
If VideoMode= 1 then
Begin
Color:= Color+ChangeWith;
If Color>255 then
Color:= 0;
SetFillStyle(1, Color);
Bar(315, 65, 365, 100);
End;
SetTextStyle(0, 0, 1);
SetColor(0);
Str(Color, StrColor);
OutTextXY(331, 78, StrColor);
End;
If Ch= Chr(13) then
Begin
If HighLight= 1 then
Begin
SaveFileName := ' ';
For I:= 550 downto 250 do
Begin
SetColor(15);
Line(460, I, 460, I);
Line(461, I, 461, I);
Line(462, I, 462, I);
Line(463, I, 463, I);
Line(464, I, 464, I);
Line(465, I, 465, I);
Line(466, I, 466, I);
Line(467, I, 467, I);
Line(468, I, 468, I);
Line(469, I, 469, I);
SetColor(11);
Line(455, I, 455, I);
Line(456, I, 456, I);
Line(457, I, 457, I);
Line(458, I, 458, I);
Line(459, I, 459, I);
Line(470, I, 470, I);
Line(471, I, 471, I);
Line(472, I, 472, I);
Line(473, I, 473, I);
Line(474, I, 474, I);
SetColor(9);
Line(453, I, 453, I);
Line(454, I, 454, I);
Line(455, I, 455, I);
Line(475, I, 475, I);
Line(476, I, 476, I);
Line(477, I, 477, I);
SetColor(1);
Line(451, I, 451, I);
Line(452, I, 452, I);
Line(478, I, 478, I);
Line(479, I, 479, I);
SetColor(6);
Rectangle(370, I-41, 567, I-4);
Rectangle(368, I-43, 569, I-2);
SetColor(14);
Rectangle(369, I-42, 568, I-3);
SetColor(0);
Line(371, I-40, 566, I-40);
Line(368, I-1, 569, I-1);
Delay(2);
End;
SetColor(13);
SetTextStyle(2,0,4);
OutTextXY(380, 212, 'Which file do you want to load?');
OutTextXY(443, 237, '--------');
I:= 443;
ErrorCode:=1;
Repeat
Ch:= ReadKey;
SetColor(13);
OutTextXY(I, 232, Ch);
If (Ch<> Chr(27)) or (Ch<> Chr(8)) or (Ch<> Chr(13)) then
SaveFileName[ErrorCode]:= Ch;
I:= I+6;
ErrorCode:= ErrorCode+1;
If Ch= Chr(8) then
Begin
ErrorCode:= ErrorCode-1;
I:= I-12;
Ch:= '█';
SetColor(0);
OutTextXY(I, 228, Ch);
OutTextXY(I, 233, Ch);
End;
Until (I= 491) or (Ch=Chr(13)) or (Ch=Chr(27));
If Ch<> Chr(27) then
Begin
For I:= 1 to 8 do
Begin
If SaveFileName[I]= Chr(13) then
SaveFileName[I]:= ' ';
End;
Assign(SaveFile, SaveFileName+'.PIX');
Reset(SaveFile);
Readln(SaveFile, EditSize.X);
Readln(SaveFile, EditSize.Y);
Screeninit;
I:= 0;
J:= 0;
SetFillStyle(1, Color);
While not EOF(SaveFile) do
Begin
Readln(SaveFile, PixelColor);
SetFillStyle(1, PixelColor);
Bar((I*10)+1, (J*10)+1, (I*10)+9, (J*10)+9);
PutPixel(I+325, J, PixelColor);
I:= I+1;
If I= EditSize.X then
Begin
I:= 0;
J:= J+1;
End;
End;
End;
For I:= 250 to 550 do
Begin
SetColor(6);
Rectangle(368, I-43, 569, I-2);
Rectangle(370, I-41, 567, I-4);
SetColor(14);
Rectangle(369, I-42, 568, I-3);
SetColor(0);
Line(368, I-44, 569, I-44);
Line(371, I-5, 566, I-5);
Delay(6);
End;
If Ch<> Chr(27) then
Close(SaveFile);
End;
If Highlight= 2 then
Begin
SaveFileName := ' ';
For I:= 550 downto 250 do
Begin
SetColor(15);
Line(460, I, 460, I);
Line(461, I, 461, I);
Line(462, I, 462, I);
Line(463, I, 463, I);
Line(464, I, 464, I);
Line(465, I, 465, I);
Line(466, I, 466, I);
Line(467, I, 467, I);
Line(468, I, 468, I);
Line(469, I, 469, I);
SetColor(11);
Line(455, I, 455, I);
Line(456, I, 456, I);
Line(457, I, 457, I);
Line(458, I, 458, I);
Line(459, I, 459, I);
Line(470, I, 470, I);
Line(471, I, 471, I);
Line(472, I, 472, I);
Line(473, I, 473, I);
Line(474, I, 474, I);
SetColor(9);
Line(453, I, 453, I);
Line(454, I, 454, I);
Line(455, I, 455, I);
Line(475, I, 475, I);
Line(476, I, 476, I);
Line(477, I, 477, I);
SetColor(1);
Line(451, I, 451, I);
Line(452, I, 452, I);
Line(478, I, 478, I);
Line(479, I, 479, I);
Delay(2);
SetColor(6);
Rectangle(350, I-41, 597, I-4);
Rectangle(348, I-43, 599, I-2);
SetColor(14);
Rectangle(349, I-42, 598, I-3);
SetColor(0);
Line(351, I-40, 596, I-40);
Line(348, I-1, 599, I-1);
End;
SetColor(13);
SetTextStyle(2,0,4);
OutTextXY(360, 212, 'What do you want to call the saved File?');
OutTextXY(443, 237, '--------');
I:= 443;
ErrorCode:=1;
Repeat
Ch:= ReadKey;
SetColor(13);
OutTextXY(I, 232, Ch);
If (Ch<> Chr(27)) or (Ch<> Chr(8)) or (Ch<> Chr(13)) then
SaveFileName[ErrorCode]:= Ch;
I:= I+6;
ErrorCode:= ErrorCode+1;
If Ch= Chr(8) then
Begin
ErrorCode:= ErrorCode-1;
I:= I-12;
Ch:= '█';
SetColor(0);
OutTextXY(I, 228, Ch);
OutTextXY(I, 233, Ch);
End;
Until (I= 491) or (Ch=Chr(13)) or (Ch=Chr(27));
If Ch<> Chr(27) then
Begin
For I:= 1 to 8 do
Begin
If SaveFileName[I]= Chr(13) then
SaveFileName[I]:= ' ';
End;
Assign(SaveFile, SaveFileName+'.PIX');
Rewrite(SaveFile);
Writeln(SaveFile, EditSize.X);
Writeln(SaveFile, EditSize.Y);
For I:= 0 to EditSize.Y-1 do
Begin
For J:= 0 to EditSize.X-1 do
Begin
PixelColor:= GetPixel((J*10)+2, (I*10)+2);
Writeln(SaveFile, PixelColor);
End;
End;
End;
For I:= 250 to 550 do
Begin
SetColor(6);
Rectangle(350, I-41, 597, I-4);
Rectangle(348, I-43, 599, I-2);
SetColor(14);
Rectangle(349, I-42, 598, I-3);
SetColor(0);
Line(348, I-44, 599, I-44);
Line(351, I-5, 596, I-5);
Delay(6);
End;
If Ch<> Chr(27) then
Close(SaveFile);
End;
If Highlight= 3 then
ScreenInit;
If Highlight= 4 then
Begin
Repeat
If PositionChange= true then
PutImage((PositionX*10)+2, (PositionY*10)+2, Cursor^, XorPut);
Ch:= ReadKey;
PositionChange:= false;
If Ch= Chr(59) then
ChangeWith:= 1;
If Ch= Chr(60) then
ChangeWith:= 5;
If Ch= Chr(61) then
ChangeWith:= 10;
If Ch= Chr(62) then
Begin
If (Draw= false) and (DrawChange= true) then
Begin
Draw:= true;
DrawChange:= false;
End;
If (Draw= true) and (DrawChange= true) then
Begin
Draw:= false;
DrawChange:= false;
End;
DrawChange:= true;
End;
If Ch= Chr(72) then
Begin
PositionY:= PositionY-1;
If PositionY<0 then
PositionY:= EditSize.Y-1;
PositionChange:= true;
PutImage((OldPositionX*10)+2, (OldPositionY*10)+2, Cursor^, XorPut);
End;
If Ch= Chr(80) then
Begin
PositionY:= PositionY+1;
If PositionY>EditSize.Y-1 then
PositionY:= 0;
PositionChange:= true;
PutImage((OldPositionX*10)+2, (OldPositionY*10)+2, Cursor^, XorPut);
End;
If Ch= Chr(75) then
Begin
PositionX:= PositionX-1;
If PositionX<0 then
PositionX:= EditSize.X-1;
PositionChange:= true;
PutImage((OldPositionX*10)+2, (OldPositionY*10)+2, Cursor^, XorPut);
End;
If Ch= Chr(77) then
Begin
PositionX:= PositionX+1;
If PositionX>EditSize.X-1 then
PositionX:= 0;
PositionChange:= true;
PutImage((OldPositionX*10)+2, (OldPositionY*10)+2, Cursor^, XorPut);
End;
If Ch= Chr(71) then
Begin
PositionY:= PositionY-1;
PositionX:= PositionX-1;
If PositionY<0 then
PositionY:= EditSize.Y-1;
If PositionX<0 then
PositionX:= EditSize.X-1;
PositionChange:= true;
PutImage((OldPositionX*10)+2, (OldPositionY*10)+2, Cursor^, XorPut);
End;
If Ch= Chr(73) then
Begin
PositionY:= PositionY-1;
PositionX:= PositionX+1;
If PositionY<0 then
PositionY:= EditSize.Y-1;
If PositionX>EditSize.X-1 then
PositionX:= 0;
PositionChange:= true;
PutImage((OldPositionX*10)+2, (OldPositionY*10)+2, Cursor^, XorPut);
End;
If Ch= Chr(79) then
Begin
PositionY:= PositionY+1;
PositionX:= PositionX-1;
If PositionY> EditSize.Y-1 then
PositionY:= 0;
If PositionX< 0 then
PositionX:= EditSize.X-1;
PositionChange:= true;
PutImage((OldPositionX*10)+2, (OldPositionY*10)+2, Cursor^, XorPut);
End;
If Ch= Chr(81) then
Begin
PositionY:= PositionY+1;
PositionX:= PositionX+1;
If PositionY> EditSize.Y-1 then
PositionY:= 0;
If PositionX> EditSize.X-1 then
PositionX:= 0;
PositionChange:= true;
PutImage((OldPositionX*10)+2, (OldPositionY*10)+2, Cursor^, XorPut);
End;
If PositionChange= true then
Begin
OldPositionX:= PositionX;
OldPositionY:= PositionY;
End;
If (Ch= Chr(32)) or (Draw= true) then
Begin
SetFillStyle(1, Color);
Bar((PositionX*10)+1, (PositionY*10)+1,
(PositionX*10)+9, (PositionY*10)+9);
PutImage((PositionX*10)+2, (PositionY*10)+2, Cursor^, XorPut);
PutPixel(PositionX+325, PositionY, Color);
End;
If Ch= Chr(45) then
Begin
If VideoMode= 0 then
Begin
Color:= Color-ChangeWith;
If Color<0 then
Color:= 15;
SetFillStyle(1, Color);
Bar(315, 65, 365, 100);
End;
If VideoMode= 1 then
Begin
Color:= Color-ChangeWith;
If Color<0 then
Color:= 255;
SetFillStyle(1, Color);
Bar(315, 65, 365, 100);
End;
SetTextStyle(0, 0, 1);
SetColor(0);
Str(Color, StrColor);
OutTextXY(331, 78, StrColor);
End;
If Ch= Chr(43) then
Begin
If VideoMode= 0 then
Begin
Color:= Color+ChangeWith;
If Color>15 then
Color:= 0;
SetFillStyle(1, Color);
Bar(315, 65, 365, 100);
End;
If VideoMode= 1 then
Begin
Color:= Color+ChangeWith;
If Color>255 then
Color:= 0;
SetFillStyle(1, Color);
Bar(315, 65, 365, 100);
End;
SetTextStyle(0, 0, 1);
SetColor(0);
Str(Color, StrColor);
OutTextXY(331, 78, StrColor);
End;
Until Ch= Chr(27);
PutImage((PositionX*10)+2, (PositionY*10)+2, Cursor^, XorPut);
PositionChange:= true;
Ch:= '0';
End;
If Highlight= 5 then
Begin
For I:= 550 downto 250 do
Begin
SetColor(15);
Line(370, 480, 370, I);
Line(530, 480, 530, I);
SetColor(11);
Line(369, 480, 369, I);
Line(371, 480, 371, I);
Line(529, 480, 529, I);
Line(531, 480, 531, I);
SetColor(9);
Line(367, 480, 367, I);
Line(368, 480, 368, I);
Line(372, 480, 372, I);
Line(373, 480, 373, I);
Line(527, 480, 527, I);
Line(528, 480, 528, I);
Line(532, 480, 532, I);
Line(533, 480, 533, I);
SetColor(1);
Line(366, 480, 366, I);
Line(374, 480, 374, I);
Line(526, 480, 526, I);
Line(534, 480, 534, I);
SetColor(2);
Rectangle(312, I-43, 590, I-2);
Rectangle(314, I-41, 588, I-4);
SetColor(3);
Rectangle(313, I-42, 589, I-3);
SetColor(0);
Line(315, I-40, 587, I-40);
Line(312, I, 590, I);
End;
Line(312, I-1, 590, I-1);
SetTextStyle(2, 0, 4);
SetColor(13);
OutTextXY(325, 211, 'Choose the length of the horizontal side:');
Repeat
SetColor(14);
Repeat
Ch:= ReadKey;
If (Ch< Chr(58)) and (Ch> Chr(47)) then
OutTextXY(567, 211, Ch);
Until (Ch= Chr(27)) or (Ch< Chr(58)) or (Ch> Chr(47));
If Ch<> Chr(27) then
Begin
Repeat
Ch2:= ReadKey;
If (Ch2< Chr(58)) and (Ch2> Chr(47)) then
OutTextXY(573, 211, Ch2);
Until (Ch2= Chr(27)) or (Ch2< Chr(58)) or (Ch2> Chr(47));
End;
Delay(30);
ErrorCode:= 0;
If (Ch<> Chr(27)) and (Ch2<> Chr(27)) then
Begin
Val((Ch+Ch2), NumAnswer, ErrorCode);
If NumAnswer<1 then
NumAnswer:= 1;
If NumAnswer>30 then
NumAnswer:= 30;
EditSize.X:= NumAnswer;
End;
Until (Ch=Chr(27)) or (Ch2=Chr(27)) or (Ch< Chr(58)) or (Ch> Chr(47)) or (Ch2< Chr(58)) or (Ch2> Chr(47));
If Ch2= Chr(27) then
Ch:= Ch2;
If Ch<> Chr(27) then
Begin
SetColor(13);
OutTextXY(325, 228, 'Choose the length of the vertical side:');
Repeat
SetColor(14);
Ch:= ReadKey;
If (Ch< Chr(58)) and (Ch> Chr(47)) then
OutTextXY(567, 228, Ch);
Until (Ch= Chr(27)) or (Ch< Chr(58)) or (Ch> Chr(47));
If NOT (Ch= Chr(27)) then
Begin
Repeat
Ch2:= ReadKey;
If (Ch< Chr(58)) and (Ch> Chr(47)) then
OutTextXY(573, 228, Ch2);
Until (Ch2= Chr(27)) or (Ch2< Chr(58)) or (Ch2> Chr(47));
End;
Delay(30);
If (Ch<> Chr(27)) and (Ch2<> Chr(27)) then
Begin
Val((Ch+Ch2), NumAnswer, ErrorCode);
If NumAnswer<1 then
NumAnswer:= 1;
If NumAnswer>30 then
NumAnswer:= 30;
EditSize.Y:= NumAnswer;
End;
End;
For I:= 250 to 550 do
Begin
SetColor(2);
Rectangle(312, I-43, 590, I-2);
Rectangle(314, I-41, 588, I-4);
SetColor(3);
Rectangle(313, I-42, 589, I-3);
SetColor(0);
Line(312, I-44, 590, I-44);
Line(315, I-5, 587, I-5);
Delay(3);
End;
ScreenInit;
End;
If Ch=Chr(27) then
Ch:= Chr(0);
End;
Until (Ch= Chr(13)) and (HighLight= 6);
End; {EditMode}
Begin
VariableInit;
GraphInit;
ImageInit;
ScreenInit;
EditMode;
CloseGraph;
End.