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