1. with Allegro.Bitmaps;                   use Allegro.Bitmaps; 
  2.  
  3. -- Note: The Scaling package is not thread-safe. 
  4. package Scaling is 
  5.  
  6.     type Filter_Type is 
  7.     ( 
  8.         Filter_Nearest,    -- effectively no filter 
  9.         Filter_Quality,    -- choose best looking filter 
  10.         Filter_HQX, 
  11.         Filter_2xSaI, 
  12.         Filter_Eagle, 
  13.         Filter_ScaleX 
  14.     ); 
  15.  
  16.     INIT_EXCEPTION : exception; 
  17.  
  18.     ---------------------------------------------------------------------------- 
  19.  
  20.     -- Initializes the scaling filters. This must be called before Scale. 
  21.     -- Raises INIT_EXCEPTION with a message, if not successful. 
  22.     procedure Initialize( color_depth : Integer ); 
  23.  
  24.     -- Finalizes the scaling filters before application exit. Calling this will 
  25.     -- have no effect if Initialize hasn't been called. 
  26.     procedure Finalize; 
  27.  
  28.     -- Scales the upper left corner of the source bitmap onto the upper left 
  29.     -- corner of the destination bitmap. The filter type is used to do the 
  30.     -- scale if it is available for the given magnification. If the requested 
  31.     -- filter can't scale to the requested magnification, the default filter 
  32.     -- is used. Scale will have no effect if Initialize hasn't been called. 
  33.     procedure Scale( src, 
  34.                      dst           : not null A_Bitmap; 
  35.                      src_width, 
  36.                      src_height    : Positive; 
  37.                      magnification : Float; 
  38.                      filter        : Filter_Type := Filter_Nearest ); 
  39.  
  40.     -- Filter names are Filter_Type members without the Filter_ prefix. If the 
  41.     -- name doesn't match a filter, 'default' will be returned. 
  42.     function To_Filter( name    : String; 
  43.                         default : Filter_Type := Filter_Type'First 
  44.                       ) return Filter_Type; 
  45.  
  46. end Scaling;