Procedure Blur( var Bitmap :TBitmap);
var
TL,TC,TR,BL,BC,BR,LL,LC,LR:^TRGBTriple;
H,V:Integer;
begin
Bitmap.PixelFormat :=pf24bit;
for V := 1 to Bitmap.Height - 2 do
begin
TL:= Bitmap.ScanLine[V - 1];
TC:=TL; // to samo Scanline Bitmap.ScanLine[V - 1]; tylko oszczędniej
TR:=TL;
BL:= Bitmap.ScanLine[V];
BC:=BL;
BR:=BL;
LL:= Bitmap.ScanLine[V + 1];
LC:=LL;
LR:=LL;
inc(TC); inc(TR,2);
inc(BC); inc(BR,2);
inc(LC); inc(LR,2);
for H := 1 to (Bitmap.Width - 2) do
begin
//Wyciągam srednią z 9 sąsiadujących pixeli
BC.rgbtRed:= (BC.rgbtRed+ BL.rgbtRed+BR.rgbtRed+
TC.rgbtRed+ TL.rgbtRed+TR.rgbtRed+
LL.rgbtRed+ LC.rgbtRed+LR.rgbtRed) div 9 ;
BC.rgbtGreen:=( BC.rgbtGreen+ BL.rgbtGreen+BR.rgbtGreen+
TC.rgbtGreen+ TL.rgbtGreen+TR.rgbtGreen+
LL.rgbtGreen+ LC.rgbtGreen+LR.rgbtGreen) div 9 ;
BC.rgbtBlue:=( BC.rgbtBlue+ BL.rgbtBlue+BR.rgbtBlue+
TC.rgbtBlue+ TL.rgbtBlue+TR.rgbtBlue+
LL.rgbtBlue+ LC.rgbtBlue+LR.rgbtBlue )div 9 ;
//zwiększam wskaźniki biorąc następne 9 pixeli
inc(TL);inc(TC);inc(TR);
inc(BL);inc(BC);inc(BR);
inc(LL);inc(LC);inc(LR);
end;
end;
end;