1. with Allegro.Palettes;                  use Allegro.Palettes; 
  2.  
  3. package Allegro.Truecolor is 
  4.  
  5.     -- Allegro 4.2.2 - Truecolor pixel formats 
  6.     -- This package is complete 
  7.  
  8.     type Color_Type is new Unsigned_32; 
  9.  
  10.     ---------------------------------------------------------------------------- 
  11.  
  12.     function GetR( color : Color_Type ) return Natural; 
  13.     function GetG( color : Color_Type ) return Natural; 
  14.     function GetB( color : Color_Type ) return Natural; 
  15.     function GetA( color : Color_Type ) return Natural; 
  16.  
  17.     function GetR8( color : Color_Type ) return Natural; 
  18.     function GetG8( color : Color_Type ) return Natural; 
  19.     function GetB8( color : Color_Type ) return Natural; 
  20.  
  21.     function GetR15( color : Color_Type ) return Natural; 
  22.     function GetG15( color : Color_Type ) return Natural; 
  23.     function GetB15( color : Color_Type ) return Natural; 
  24.  
  25.     function GetR16( color : Color_Type ) return Natural; 
  26.     function GetG16( color : Color_Type ) return Natural; 
  27.     function GetB16( color : Color_Type ) return Natural; 
  28.  
  29.     function GetR24( color : Color_Type ) return Natural; 
  30.     function GetG24( color : Color_Type ) return Natural; 
  31.     function GetB24( color : Color_Type ) return Natural; 
  32.  
  33.     function GetR32( color : Color_Type ) return Natural; 
  34.     function GetG32( color : Color_Type ) return Natural; 
  35.     function GetB32( color : Color_Type ) return Natural; 
  36.     function GetA32( color : Color_Type ) return Natural; 
  37.  
  38.     function GetR_Depth( color_depth : Natural; color : Color_Type ) return Natural; 
  39.     function GetG_Depth( color_depth : Natural; color : Color_Type ) return Natural; 
  40.     function GetB_Depth( color_depth : Natural; color : Color_Type ) return Natural; 
  41.     function GetA_Depth( color_depth : Natural; color : Color_Type ) return Natural; 
  42.  
  43.     function Makecol( r, g, b : Natural ) return Color_Type; 
  44.     function Makecol8( r, g, b : Natural ) return Color_Type; 
  45.     function Makecol15( r, g, b : Natural ) return Color_Type; 
  46.     function Makecol16( r, g, b : Natural ) return Color_Type; 
  47.     function Makecol24( r, g, b : Natural ) return Color_Type; 
  48.     function Makecol32( r, g, b : Natural ) return Color_Type; 
  49.  
  50.     function Makecol15_Dither( r, g, b, x, y : Integer ) return Color_Type; 
  51.     function Makecol16_Dither( r, g, b, x, y : Integer ) return Color_Type; 
  52.  
  53.     function Makeacol( r, g, b, a : Natural ) return Color_Type; 
  54.     function Makeacol32( r, g, b, a : Natural ) return Color_Type; 
  55.  
  56.     function Makecol_Depth( color_depth, r, g, b : Natural ) return Color_Type; 
  57.     function Makeacol_Depth( color_depth, r, g, b, a : Natural ) return Color_Type; 
  58.  
  59.     -- Returns True if the colors compare within tolerance bounds. If any of the 
  60.     -- components of the colors differ by more than 'tolerance', the comparison 
  61.     -- will fail 
  62.     function Compare( a, b : Color_Type; tolerance : Natural := 0 ) return Boolean; 
  63.  
  64.     -- Returns the foreground color adjusted for contrast against the background. 
  65.     function Contrast( fg, bg : Color_Type; ratio : Float := 1.75 ) return Color_Type; 
  66.  
  67.     -- Returns white or black, depending on the brightness of the background. 
  68.     function Hard_Contrast( bg : Color_Type ) return Color_Type; 
  69.  
  70.     -- Returns a color which is lighter or darker than the input. The color will 
  71.     -- be darker where 0 < factor < 1 and lighter where factor > 1. 
  72.     function Lighten( color : Color_Type; factor : Float ) return Color_Type; 
  73.  
  74.     function Make_Grey( brightness : Natural ) return Color_Type; 
  75.  
  76.     function Palette_Color( index : Palette_Index ) return Color_Type; 
  77.  
  78. private 
  79.  
  80.     pragma Import( C, GetR, "getr" ); 
  81.     pragma Import( C, GetG, "getg" ); 
  82.     pragma Import( C, GetB, "getb" ); 
  83.     pragma Import( C, GetA, "geta" ); 
  84.  
  85.     pragma Import( C, GetR8, "getr8" ); 
  86.     pragma Import( C, GetG8, "getg8" ); 
  87.     pragma Import( C, GetB8, "getb8" ); 
  88.  
  89.     pragma Import( C, GetR15, "getr15" ); 
  90.     pragma Import( C, GetG15, "getg15" ); 
  91.     pragma Import( C, GetB15, "getb15" ); 
  92.  
  93.     pragma Import( C, GetR16, "getr16" ); 
  94.     pragma Import( C, GetG16, "getg16" ); 
  95.     pragma Import( C, GetB16, "getb16" ); 
  96.  
  97.     pragma Import( C, GetR24, "getr24" ); 
  98.     pragma Import( C, GetG24, "getg24" ); 
  99.     pragma Import( C, GetB24, "getb24" ); 
  100.  
  101.     pragma Import( C, GetR32, "getr32" ); 
  102.     pragma Import( C, GetG32, "getg32" ); 
  103.     pragma Import( C, GetB32, "getb32" ); 
  104.     pragma Import( C, GetA32, "geta32" ); 
  105.  
  106.     pragma Import( C, GetR_Depth, "getr_depth" ); 
  107.     pragma Import( C, GetG_Depth, "getg_depth" ); 
  108.     pragma Import( C, GetB_Depth, "getb_depth" ); 
  109.     pragma Import( C, GetA_Depth, "geta_depth" ); 
  110.  
  111.     pragma Import( C, Makecol,   "makecol" ); 
  112.     pragma Import( C, Makecol8,  "makecol8" ); 
  113.     pragma Import( C, Makecol15, "makecol15" ); 
  114.     pragma Import( C, Makecol16, "makecol16" ); 
  115.     pragma Import( C, Makecol24, "makecol24" ); 
  116.     pragma Import( C, Makecol32, "makecol32" ); 
  117.  
  118.     pragma Import( C, Makecol15_Dither, "makecol15_dither" ); 
  119.     pragma Import( C, Makecol16_Dither, "makecol16_dither" ); 
  120.  
  121.     pragma Import( C, Makeacol, "makeacol" ); 
  122.     pragma Import( C, Makeacol32, "makeacol32" ); 
  123.  
  124.     pragma Import( C, Makecol_Depth, "makecol_depth" ); 
  125.     pragma Import( C, Makeacol_Depth, "makeacol_depth" ); 
  126.  
  127.     pragma Import( C, Palette_Color, "get_palette_color" ); 
  128.  
  129. end Allegro.Truecolor;