with Allegro.Bitmaps; use Allegro.Bitmaps;
-- Note: The Scaling package is not thread-safe.
package Scaling is
type Filter_Type is
(
Filter_Nearest, -- effectively no filter
Filter_Quality, -- choose best looking filter
Filter_HQX,
Filter_2xSaI,
Filter_Eagle,
Filter_ScaleX
);
INIT_EXCEPTION : exception;
----------------------------------------------------------------------------
-- Initializes the scaling filters. This must be called before Scale.
-- Raises INIT_EXCEPTION with a message, if not successful.
procedure Initialize( color_depth : Integer );
-- Finalizes the scaling filters before application exit. Calling this will
-- have no effect if Initialize hasn't been called.
procedure Finalize;
-- Scales the upper left corner of the source bitmap onto the upper left
-- corner of the destination bitmap. The filter type is used to do the
-- scale if it is available for the given magnification. If the requested
-- filter can't scale to the requested magnification, the default filter
-- is used. Scale will have no effect if Initialize hasn't been called.
procedure Scale( src,
dst : not null A_Bitmap;
src_width,
src_height : Positive;
magnification : Float;
filter : Filter_Type := Filter_Nearest );
-- Filter names are Filter_Type members without the Filter_ prefix. If the
-- name doesn't match a filter, 'default' will be returned.
function To_Filter( name : String;
default : Filter_Type := Filter_Type'First
) return Filter_Type;
end Scaling;