function ImageNegativeKetupat(MInput:Matriks):Matriks;
var
i,j,l,s,r:integer ;
MOutput : Matriks ;
begin
SetLength(MOutput,Length(MInput), Length(MInput[0]));
if Length(MInput)<Length(MInput[0]) then
l:= Length(MInput)div 2
else
l:= Length(MInput[0])div 2 ;
s:=(Length(MInput[0])div 2)-l;
r:=(Length(MInput)div 2) - l;
for i := 0 to Length(MOutput)-1 do
begin
for j:= 0 to Length(MOutput[0])-1 do
begin
MOutput[i,j] := MInput[i,j] ;
if ((i-r)+(j-s) >= l) and ((j-s)<=l+(i-r)) and ((i-r)<= l+(j-s) ) and ((i-r)+(j-s) <= length(MOutput)+l) and ((i-r)+(j-s) <= length(MOutput[0])+l) and (i>=r) and (j>=s) then
MOutput [i,j] := 255 - MInput[i,j]
end;
end;
ImageNegativeKetupat := MOutput ;
end;
No comments:
Post a Comment