with Allegro.Bitmaps; use Allegro.Bitmaps;
package Image_Filters is
-- Blurs horizontally only, with a kernel size of one. To increase the
-- effect, increase the number of passes. Works only on memory bitmaps in
-- Truecolor 16/32bpp modes. If the bitmap is not a memory bitmap then the
-- blur will be skipped.
--
-- Originally by Sik
-- Adapted by Oog
-- Adapted and optimized by Kevin Wellwood
--
-- Retrieved from http://mb.srb2.org/showthread.php?t=17041 on 11/17/2010
procedure Fast_Blur( bmp : not null A_Bitmap;
x1, y1 : Natural;
x2, y2 : Natural;
passes : Positive := 1 );
pragma Precondition( Get_Width( bmp ) >= 2 );
pragma Precondition( Get_Height( bmp ) >= 2 );
pragma Precondition( x2 >= x1 + 1 and then x2 < Get_Width( bmp ) );
pragma Precondition( y2 >= y1 + 1 and then y2 < Get_Height( bmp ) );
-- Super Fast Blur v1.1
-- by Mario Klingemann <http://incubator.quasimondo.com>
--
-- Tip: Increasing the passes of this filter with a small radius will
-- approximate a gaussian blur quite well.
procedure Klingemann_Fast_Blur( bmp : not null A_Bitmap;
radius : Positive;
passes : Positive );
-- Stack Blur v1.0
--
-- Author: Mario Klingemann <mario@quasimondo.com>
-- http://incubator.quasimondo.com
-- created Feburary 29, 2004
--
-- This is a compromise between Gaussian Blur and Box blur
-- It creates much better looking blurs than Box Blur, but is
-- 7x faster than my Gaussian Blur implementation.
--
-- I called it Stack Blur because this describes best how this
-- filter works internally: it creates a kind of moving stack
-- of colors whilst scanning through the image. Thereby it
-- just has to add one new block of color to the right side
-- of the stack and remove the leftmost color. The remaining
-- colors on the topmost layer of the stack are either added on
-- or reduced by one, depending on if they are on the right or
-- on the left side of the stack.
procedure Klingemann_Stack_Blur( bmp : not null A_Bitmap;
radius : Positive;
passes : Positive );
-- Fast Gaussian Blur v1.3
-- by Mario Klingemann <http://incubator.quasimondo.com>
--
-- What you see is an attempt to implement a Gaussian Blur algorithm
-- which is exact but fast. I think that this one should be
-- relatively fast because it uses a special trick by first
-- making a horizontal blur on the original image and afterwards
-- making a vertical blur on the pre-processed image. This
-- is a mathematical correct thing to do and reduces the
-- calculation a lot.
end Image_Filters;