Language:
Русский
English
{Setwrtmd.PAS}
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
{Sample code for the SetWriteMode procedure.}
uses Crt, Graph;
var
Driver, Mode, I: Integer;
X1, Y1, Dx, Dy: Integer;
FillInfo: FillSettingsType;
begin
DirectVideo := False; { Turn off screen write }
Randomize;
Driver := Detect; { Put in graphics mode }
InitGraph(Driver, Mode, '');
if GraphResult < 0 then
Halt(1);
{ Fill screen with background pattern }
GetFillSettings(FillInfo); { Get current settings }
SetFillStyle(WideDotFill, FillInfo.Color);
Bar(0, 0, GetMaxX, GetMaxY);
Dx := GetMaxX div 4; { Determine rectangle's dimensions }
Dy := GetMaxY div 4;
SetLineStyle(SolidLn, 0, ThickWidth);
SetWriteMode(XORPut); { XOR mode for rectangle }
repeat { Draw until a key is pressed }
X1 := Random(GetMaxX - Dx);
Y1 := Random(GetMaxY - Dy);
Rectangle(X1, Y1, X1 + Dx, Y1 + Dy); { Draw it }
Delay(10); { Pause briefly }
Rectangle(X1, Y1, X1 + Dx, Y1 + Dy); { Erase it }
until KeyPressed;
Readln;
CloseGraph;
end.