1. with Allegro.Truecolor;                 use Allegro.Truecolor; 
  2.  
  3. package Allegro.Bitmaps is 
  4.  
  5.     -- Allegro 4.4.1 - Bitmap objects 
  6.     -- This package is complete 
  7.  
  8.     type Gfx_Vtable is private; 
  9.     type A_Gfx_Vtable is access all Gfx_Vtable; 
  10.  
  11.     type Bitmap is private; 
  12.     type A_Bitmap is access all Bitmap; 
  13.     pragma No_Strict_Aliasing( A_Bitmap ); 
  14.  
  15.     ---------------------------------------------------------------------------- 
  16.  
  17.     procedure Acquire_Bitmap( bmp : not null A_Bitmap ); 
  18.  
  19.     procedure Acquire_Screen; 
  20.  
  21.     procedure Add_Clip_Rect( bmp : not null A_Bitmap; x1, y1, x2, y2 : Integer ); 
  22.  
  23.     function Bitmap_Color_Depth( bmp : not null A_Bitmap ) return Integer; 
  24.  
  25.     function Bitmap_Mask_Color( bmp : not null A_Bitmap ) return Color_Type; 
  26.  
  27.     function Create_Bitmap( width, height : Positive ) return A_Bitmap; 
  28.  
  29.     function Create_Bitmap_Ex( color_depth, width, height : Positive ) return A_Bitmap; 
  30.  
  31.     function Create_Sub_Bitmap( parent : not null A_Bitmap; 
  32.                                 x, y   : Integer; 
  33.                                 width, 
  34.                                 height : Positive ) return A_Bitmap; 
  35.  
  36.     function Create_System_Bitmap( width, height : Positive ) return A_Bitmap; 
  37.  
  38.     function Create_Video_Bitmap( width, height : Positive ) return A_Bitmap; 
  39.  
  40.     procedure Destroy_Bitmap( bmp : in out A_Bitmap ); 
  41.  
  42.     procedure Get_Clip_Rect( bmp    : not null A_Bitmap; 
  43.                              x1, y1, 
  44.                              x2, y2 : out Integer ); 
  45.  
  46.     function Get_Clip_State( bmp : not null A_Bitmap ) return Integer; 
  47.  
  48.     function Get_Dat( bmp : A_Bitmap ) return Address; 
  49.  
  50.     function Get_Height( bmp : A_Bitmap ) return Integer; 
  51.  
  52.     function Get_Screen return A_Bitmap; 
  53.  
  54.     function Get_Screen_H return Integer; 
  55.  
  56.     function Get_Screen_W return Integer; 
  57.  
  58.     function Get_Virtual_H return Integer; 
  59.  
  60.     function Get_Virtual_W return Integer; 
  61.  
  62.     function Get_Width( bmp : A_Bitmap ) return Integer; 
  63.  
  64.     function Is_Inside_Bitmap( bmp : not null A_Bitmap; x, y, clip : Integer ) return Integer; 
  65.  
  66.     function Is_Linear_Bitmap( bmp : A_Bitmap ) return Integer; 
  67.  
  68.     function Is_Memory_Bitmap( bmp : A_Bitmap ) return Integer; 
  69.  
  70.     function Is_Planar_Bitmap( bmp : A_Bitmap ) return Integer; 
  71.  
  72.     function Is_Same_Bitmap( bmp1, bmp2 : A_Bitmap ) return Integer; 
  73.  
  74.     function Is_Screen_Bitmap( bmp : A_Bitmap ) return Integer; 
  75.  
  76.     function Is_Sub_Bitmap( bmp : A_Bitmap ) return Integer; 
  77.  
  78.     function Is_System_Bitmap( bmp : A_Bitmap ) return Integer; 
  79.  
  80.     function Is_Video_Bitmap( bmp : A_Bitmap ) return Integer; 
  81.  
  82.     procedure Lock_Bitmap( bmp : not null A_Bitmap ); 
  83.  
  84.     procedure Release_Bitmap( bmp : not null A_Bitmap ); 
  85.  
  86.     procedure Release_Screen; 
  87.  
  88.     procedure Set_Clip_Rect( bmp : not null A_Bitmap; x1, y1, x2, y2 : Integer ); 
  89.  
  90.     procedure Set_Clip_State( bmp : not null A_Bitmap; state : Integer ); 
  91.  
  92. private 
  93.  
  94.     type Gfx_Vtable is     -- functions for drawing onto bitmaps 
  95.         record 
  96.             color_depth                : Integer; 
  97.             mask_color                 : Integer; 
  98.             unwrite_bank               : Address; 
  99.             set_clip                   : Address; 
  100.             acquire                    : Address; 
  101.             release                    : Address; 
  102.             create_sub_bitmap          : Address; 
  103.             created_sub_bitmap         : Address; 
  104.             getpixel                   : Address; 
  105.             putpixel                   : Address; 
  106.             vline                      : Address; 
  107.             hline                      : Address; 
  108.             hfill                      : Address; 
  109.             line                       : Address; 
  110.             fastline                   : Address; 
  111.             rectfill                   : Address; 
  112.             triangle                   : Address; 
  113.             draw_sprite                : Address; 
  114.             draw_256_sprite            : Address; 
  115.             draw_sprite_v_flip         : Address; 
  116.             draw_sprite_h_flip         : Address; 
  117.             draw_sprite_vh_flip        : Address; 
  118.             draw_trans_sprite          : Address; 
  119.             draw_trans_rgba_sprite     : Address; 
  120.             draw_lit_sprite            : Address; 
  121.             draw_rle_sprite            : Address; 
  122.             draw_trans_rle_sprite      : Address; 
  123.             draw_trans_rgba_rle_sprite : Address; 
  124.             draw_lit_rle_sprite        : Address; 
  125.             draw_character             : Address; 
  126.             draw_glyph                 : Address; 
  127.             blit_from_memory           : Address; 
  128.             blit_to_memory             : Address; 
  129.             blit_from_system           : Address; 
  130.             blit_to_system             : Address; 
  131.             blit_to_self               : Address; 
  132.             blit_to_self_forward       : Address; 
  133.             blit_to_self_backward      : Address; 
  134.             blit_between_formats       : Address; 
  135.             masked_blit                : Address; 
  136.             clear_to_color             : Address; 
  137.             pivot_scaled_sprite_flip   : Address; 
  138.             do_stretch_blit            : Address; 
  139.             draw_gouraud_sprite        : Address; 
  140.             draw_sprite_end            : Address; 
  141.             blit_end                   : Address; 
  142.             polygon                    : Address; 
  143.             rect                       : Address; 
  144.             circle                     : Address; 
  145.             circlefill                 : Address; 
  146.             elipse                     : Address; 
  147.             elipsefill                 : Address; 
  148.             arc                        : Address; 
  149.             spline                     : Address; 
  150.             floodfill                  : Address; 
  151.             polygon3d                  : Address; 
  152.             polygon3d_f                : Address; 
  153.             triangle3d                 : Address; 
  154.             triangle3d_f               : Address; 
  155.             quad3d                     : Address; 
  156.             quad3d_f                   : Address; 
  157.             draw_sprite_ex             : Address; 
  158.         end record; 
  159.     pragma Convention( C, Gfx_Vtable ); 
  160.  
  161.     type Bitmap is 
  162.         record 
  163.             w, h       : Integer; 
  164.             clip       : Integer; 
  165.             cl, cr, 
  166.             ct, cb     : Integer; 
  167.             vtable     : A_Gfx_Vtable; 
  168.             write_bank : Address; 
  169.             read_bank  : Address; 
  170.             dat        : Address; 
  171.             id         : Unsigned_64; 
  172.             extra      : Address; 
  173.             x_ofs, 
  174.             y_ofs      : Integer; 
  175.             seg        : Integer; 
  176.             line       : Address; 
  177.             --     line  : AL_ucmatrix(0 .. 479,0 .. 619);   -- 620 x 480 
  178.         end record; 
  179.     pragma Convention( C, Bitmap ); 
  180.  
  181.     ---------------------------------------------------------------------------- 
  182.  
  183.     pragma Import( C, Acquire_Bitmap, "acquire_bitmap" ); 
  184.     pragma Import( C, Acquire_Screen, "acquire_screen" ); 
  185.     pragma Import( C, Add_Clip_Rect, "add_clip_rect" ); 
  186.     pragma Import( C, Bitmap_Color_Depth, "bitmap_color_depth" ); 
  187.     pragma Import( C, Bitmap_Mask_Color, "bitmap_mask_color" ); 
  188.     pragma Import( C, Create_Bitmap, "create_bitmap" ); 
  189.     pragma Import( C, Create_Bitmap_Ex, "create_bitmap_ex" ); 
  190.     pragma Import( C, Create_Sub_Bitmap, "create_sub_bitmap" ); 
  191.     pragma Import( C, Create_System_Bitmap, "create_systsem_bitmap" ); 
  192.     pragma Import( C, Create_Video_Bitmap, "create_video_bitmap" ); 
  193.     pragma Import( C, Get_Clip_Rect, "get_clip_rect" ); 
  194.     pragma Import( C, Get_Clip_State, "get_clip_state" ); 
  195.     pragma Import( C, Get_Screen, "get_screen" ); 
  196.     pragma Import( C, Get_Screen_H, "get_screen_h" ); 
  197.     pragma Import( C, Get_Screen_W, "get_screen_w" ); 
  198.     pragma Import( C, Get_Virtual_H, "get_virtual_h" ); 
  199.     pragma Import( C, Get_Virtual_W, "get_virtual_w" ); 
  200.     pragma Import( C, Is_Inside_Bitmap, "is_inside_bitmap" ); 
  201.     pragma Import( C, Is_Linear_Bitmap, "is_linear_bitmap" ); 
  202.     pragma Import( C, Is_Memory_Bitmap, "is_memory_bitmap" ); 
  203.     pragma Import( C, Is_Planar_Bitmap, "is_planar_bitmap" ); 
  204.     pragma Import( C, Is_Same_Bitmap, "is_same_bitmap" ); 
  205.     pragma Import( C, Is_Screen_Bitmap, "is_screen_bitmap" ); 
  206.     pragma Import( C, Is_Sub_Bitmap, "is_sub_bitmap" ); 
  207.     pragma Import( C, Is_System_Bitmap, "is_system_bitmap" ); 
  208.     pragma Import( C, Is_Video_Bitmap, "is_video_bitmap" ); 
  209.     pragma Import( C, Lock_Bitmap, "lock_bitmap" ); 
  210.     pragma Import( C, Release_Bitmap, "release_bitmap" ); 
  211.     pragma Import( C, Release_Screen, "release_screen" ); 
  212.     pragma Import( C, Set_Clip_Rect, "set_clip_rect" ); 
  213.     pragma Import( C, Set_Clip_State, "set_clip_state" ); 
  214.  
  215. end Allegro.Bitmaps;