![]() |
![]() |
![]() |
procedure BoxBlur(img: TImage32; rect: TRect; radius, repeats: Integer);
With several repetitions and a smaller radius, BoxBlur can achieve a close approximation of GaussianBlur, and is much faster.
Empirically, using a radius about 1/4 that used in GaussianBlur together with 3 repeats, BoxBlur fairly closely approximates GaussianBlur.
uses Image32, Image32_Extra, Image32_PNG; ... var img: TImage32; rec: TRect; pt: TPoint; begin img := TImage32.Create(256, 256); rec := Rect(img.Width - 120, 0, img.Width, 120); pt := MidPoint(rec); DrawPoint(img, PointD(pt), 20, clNavy32); GaussianBlur(img, rec, 48); Windows.OffsetRect(rec, -120, 0); pt := MidPoint(rec); DrawPoint(img, PointD(pt), 20, clNavy32); GaussianBlur(img, rec, 24); rec := Rect(img.Width - 120, img.Height -125, img.Width, img.Height-5); pt := MidPoint(rec); DrawPoint(img, PointD(pt), 20, clNavy32); BoxBlur(img, rec, 12, 3); Windows.OffsetRect(rec, -120, 0); pt := MidPoint(rec); DrawPoint(img, PointD(pt), 20, clNavy32); BoxBlur(img, rec, 6, 3); img.Free;
![]() |
Copyright ©2019 Angus Johnson - Image32 ver. 1.54 - Documentation last updated on 7-November-2020