function Kuis1(MInput:Matriks; MInput2:Matriks; Value:integer):Matriks;
var
i,j,k,l,r,a,b : integer;
MOutput : matriks;
begin
SetLength(MOutput,Length(MInput),Length(MInput[0]));
SetLength(MInput2,Length(MInput),Length(MInput[0]));
r:=((Length(Moutput) div 2) div 2);
a:=((Length(Moutput) div 2) div 2)+(Length(Moutput) div 2);
b:=(Length(Moutput[0]) div 2);
for i:= 0 to (Length(MOutput) div 2)-1 do
begin
for j:= 0 to (Length(MOutput[0]))-1 do
begin
MOutput[i,j]:=MInput[i,j] + MInput2[i,j];
if (MOutput[i,j]>255) then MOutput[i,j]:=255
else if (MOutput[i,j]<0) then MOutput[i,j]:=0;
end;
end;
for k:= (Length(MOutput) div 2) to Length(MOutput)-1 do
begin
for l:= 0 to Length(MOutput[0])-1 do
begin
if r>=sqrt(sqr(a-k)+sqr(b-l)) then
begin
MOutput[k,l]:= (round(((100-Value)/100)*MInput[k,l])) + (round((Value/100)*MInput2[k,l]));
if (MOutput[k,l]>255) then
MOutput[k,l]:=255
else
if (MOutput[k,l]<0) then MOutput[k,l]:=0;
end
else
MOutput[k,l]:=MInput[k,l];
end;
end;
Kuis1:=MOutput;
end;
No comments:
Post a Comment