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