Язык:
Русский
English
{ Пример программы для процедуры SetPalette }
uses Crt, Graph;
var
GraphDriver, GraphMode : Integer;
Color : Word;
Palette : PaletteType;
begin
GraphDriver := Detect;
InitGraph(GraphDriver, GraphMode, 'X:\BP');
if GraphResult <> grOk then
Halt(1);
GetPalette(Palette);
if Palette.Size <> 1 then
begin
for Color := 0 to Pred(Palette.Size) do
begin
SetColor(Color);
Line(0, Color * 5, 100, Color * 5);
end;
Randomize;
repeat
SetPalette(Random(Palette.Size), Random(Palette.Size));
until KeyPressed;
end
else
Line(0, 0, 100, 0);
ReadLn;
CloseGraph;
end.
var
GraphDriver, GraphMode : Integer;
Color : Word;
Palette : PaletteType;
begin
GraphDriver := Detect;
InitGraph(GraphDriver, GraphMode, 'X:\BP');
if GraphResult <> grOk then
Halt(1);
GetPalette(Palette);
if Palette.Size <> 1 then
begin
for Color := 0 to Pred(Palette.Size) do
begin
SetColor(Color);
Line(0, Color * 5, 100, Color * 5);
end;
Randomize;
repeat
SetPalette(Random(Palette.Size), Random(Palette.Size));
until KeyPressed;
end
else
Line(0, 0, 100, 0);
ReadLn;
CloseGraph;
end.