1. with Allegro.Bitmaps;                   use Allegro.Bitmaps; 
  2. with Allegro.Fixed_Point_Math;          use Allegro.Fixed_Point_Math; 
  3. with Allegro.Truecolor;                 use Allegro.Truecolor; 
  4.  
  5. -- Allegro 4.4.2 - Blitting and Sprites 
  6. package Allegro.Sprites is 
  7.  
  8.     -- Drawing modes for Draw_Sprite_Ex 
  9.     DRAW_SPRITE_NORMAL : constant Integer; 
  10.     DRAW_SPRITE_LIT    : constant Integer; 
  11.     DRAW_SPRITE_TRANS  : constant Integer; 
  12.  
  13.     -- Flipping modes for Draw_Sprite_Ex 
  14.     FLIP_DRAW_SPRITE_NO_FLIP : constant Integer; 
  15.     FLIP_DRAW_SPRITE_H_FLIP  : constant Integer; 
  16.     FLIP_DRAW_SPRITE_V_FLIP  : constant Integer; 
  17.     FLIP_DRAW_SPRITE_VH_FLIP : constant Integer; 
  18.  
  19.     ---------------------------------------------------------------------------- 
  20.  
  21.     procedure Blit( source, 
  22.                     dest     : not null A_Bitmap; 
  23.                     source_x, 
  24.                     source_y, 
  25.                     dest_x, 
  26.                     dest_y   : Integer; 
  27.                     width, 
  28.                     height   : Natural ); 
  29.  
  30.     procedure Draw_Character_Ex( bmp, 
  31.                                  sprite : not null A_Bitmap; 
  32.                                  x, y   : Integer; 
  33.                                  color, 
  34.                                  bg     : Color_Type ); 
  35.  
  36.     procedure Draw_Gouraud_Sprite( bmp, 
  37.                                    sprite         : not null A_Bitmap; 
  38.                                    x, y, 
  39.                                    c1, c2, c3, c4 : Color_Type ); 
  40.  
  41.     procedure Draw_Lit_Sprite( bmp, 
  42.                                sprite : not null A_Bitmap; 
  43.                                x, y   : Integer; 
  44.                                color  : Color_Type ); 
  45.  
  46.     procedure Draw_Sprite( bmp, sprite : not null A_Bitmap; x, y : Integer ); 
  47.  
  48.     procedure Draw_Sprite_Ex( bmp, 
  49.                               sprite : not null A_Bitmap; 
  50.                               x, y   : Integer; 
  51.                               mode   : Integer; 
  52.                               flip   : Integer ); 
  53.  
  54.     procedure Draw_Sprite_H_Flip( bmp, sprite : not null A_Bitmap; x, y : Integer ); 
  55.  
  56.     procedure Draw_Sprite_V_Flip( bmp, sprite : not null A_Bitmap; x, y : Integer ); 
  57.  
  58.     procedure Draw_Sprite_VH_Flip( bmp, sprite : not null A_Bitmap; x, y : Integer ); 
  59.  
  60.     procedure Draw_Trans_Sprite( bmp, sprite : not null A_Bitmap; x, y : Integer ); 
  61.  
  62.     procedure Masked_Blit( source, 
  63.                            dest     : not null A_Bitmap; 
  64.                            source_x, 
  65.                            source_y, 
  66.                            dest_x, 
  67.                            dest_y   : Integer; 
  68.                            width, 
  69.                            height   : Natural ); 
  70.  
  71.     procedure Masked_Stretch_Blit( source, 
  72.                                    dest     : not null A_Bitmap; 
  73.                                    source_x, 
  74.                                    source_y : Integer; 
  75.                                    source_w, 
  76.                                    source_h : Natural; 
  77.                                    dest_x, 
  78.                                    dest_y   : Integer; 
  79.                                    dest_w, 
  80.                                    dest_h   : Natural ); 
  81.  
  82.     procedure Pivot_Scaled_Sprite( bmp, 
  83.                                    sprite : not null A_Bitmap; 
  84.                                    x, y, 
  85.                                    cx, cy : Integer; 
  86.                                    angle, 
  87.                                    scale  : Fixed ); 
  88.  
  89.     procedure Pivot_Scaled_Sprite_Lit( bmp, 
  90.                                        sprite : not null A_Bitmap; 
  91.                                        x, y, 
  92.                                        cx, cy : Integer; 
  93.                                        angle, 
  94.                                        scale  : Fixed; 
  95.                                        color  : Color_Type ); 
  96.  
  97.     procedure Pivot_Scaled_Sprite_Trans( bmp, 
  98.                                          sprite : not null A_Bitmap; 
  99.                                          x, y, 
  100.                                          cx, cy : Integer; 
  101.                                          angle, 
  102.                                          scale  : Fixed ); 
  103.  
  104.     procedure Pivot_Scaled_Sprite_V_Flip( bmp, 
  105.                                           sprite : not null A_Bitmap; 
  106.                                           x, y, 
  107.                                           cx, cy : Integer; 
  108.                                           angle, 
  109.                                           scale  : Fixed ); 
  110.  
  111.     procedure Pivot_Scaled_Sprite_V_Flip_Lit( bmp, 
  112.                                               sprite : not null A_Bitmap; 
  113.                                               x, y, 
  114.                                               cx, cy : Integer; 
  115.                                               angle, 
  116.                                               scale  : Fixed; 
  117.                                               color  : Color_Type ); 
  118.  
  119.     procedure Pivot_Scaled_Sprite_V_Flip_Trans( bmp, 
  120.                                                 sprite : not null A_Bitmap; 
  121.                                                 x, y, 
  122.                                                 cx, cy : Integer; 
  123.                                                 angle, 
  124.                                                 scale  : Fixed ); 
  125.  
  126.     procedure Pivot_Sprite( bmp, 
  127.                             sprite : not null A_Bitmap; 
  128.                             x, y, 
  129.                             cx, cy : Integer; 
  130.                             angle  : Fixed ); 
  131.  
  132.     procedure Pivot_Sprite_Lit( bmp, 
  133.                                 sprite : not null A_Bitmap; 
  134.                                 x, y, 
  135.                                 cx, cy : Integer; 
  136.                                 angle  : Fixed; 
  137.                                 color  : Color_Type ); 
  138.  
  139.     procedure Pivot_Sprite_Trans( bmp, 
  140.                                   sprite : not null A_Bitmap; 
  141.                                   x, y, 
  142.                                   cx, cy : Integer; 
  143.                                   angle  : Fixed ); 
  144.  
  145.     procedure Pivot_Sprite_V_Flip( bmp, 
  146.                                    sprite : not null A_Bitmap; 
  147.                                    x, y, 
  148.                                    cx, cy : Integer; 
  149.                                    angle  : Fixed ); 
  150.  
  151.     procedure Pivot_Sprite_V_Flip_Lit( bmp, 
  152.                                        sprite : not null A_Bitmap; 
  153.                                        x, y, 
  154.                                        cx, cy : Integer; 
  155.                                        angle  : Fixed; 
  156.                                        color  : Color_Type ); 
  157.  
  158.     procedure Pivot_Sprite_V_Flip_Trans( bmp, 
  159.                                          sprite : not null A_Bitmap; 
  160.                                          x, y, 
  161.                                          cx, cy : Integer; 
  162.                                          angle  : Fixed ); 
  163.  
  164.     procedure Rotate_Scaled_Sprite( bmp, 
  165.                                     sprite : not null A_Bitmap; 
  166.                                     x, y   : Integer; 
  167.                                     angle, 
  168.                                     scale  : Fixed ); 
  169.  
  170.     procedure Rotate_Scaled_Sprite_Lit( bmp, 
  171.                                         sprite : not null A_Bitmap; 
  172.                                         x, y   : Integer; 
  173.                                         angle, 
  174.                                         scale  : Fixed; 
  175.                                         color  : Color_Type ); 
  176.  
  177.     procedure Rotate_Scaled_Sprite_Trans( bmp, 
  178.                                           sprite : not null A_Bitmap; 
  179.                                           x, y   : Integer; 
  180.                                           angle, 
  181.                                           scale  : Fixed ); 
  182.  
  183.     procedure Rotate_Scaled_Sprite_V_Flip( bmp, 
  184.                                            sprite : not null A_Bitmap; 
  185.                                            x, y   : Integer; 
  186.                                            angle, 
  187.                                            scale  : Fixed ); 
  188.  
  189.     procedure Rotate_Scaled_Sprite_V_Flip_Lit( bmp, 
  190.                                                sprite : not null A_Bitmap; 
  191.                                                x, y   : Integer; 
  192.                                                angle, 
  193.                                                scale  : Fixed; 
  194.                                                color  : Color_Type ); 
  195.  
  196.     procedure Rotate_Scaled_Sprite_V_Flip_Trans( bmp, 
  197.                                                  sprite : not null A_Bitmap; 
  198.                                                  x, y   : Integer; 
  199.                                                  angle, 
  200.                                                  scale  : Fixed ); 
  201.  
  202.     procedure Rotate_Sprite( bmp, 
  203.                              sprite : not null A_Bitmap; 
  204.                              x, y   : Integer; 
  205.                              angle  : Fixed ); 
  206.  
  207.     procedure Rotate_Sprite_Lit( bmp, 
  208.                                  sprite : not null A_Bitmap; 
  209.                                  x, y   : Integer; 
  210.                                  angle  : Fixed; 
  211.                                  color  : Color_Type ); 
  212.  
  213.     procedure Rotate_Sprite_Trans( bmp, 
  214.                                    sprite : not null A_Bitmap; 
  215.                                    x, y   : Integer; 
  216.                                    angle  : Fixed ); 
  217.  
  218.     procedure Rotate_Sprite_V_Flip( bmp, 
  219.                                     sprite : not null A_Bitmap; 
  220.                                     x, y   : Integer; 
  221.                                     angle  : Fixed ); 
  222.  
  223.     procedure Rotate_Sprite_V_Flip_Lit( bmp, 
  224.                                         sprite : not null A_Bitmap; 
  225.                                         x, y   : Integer; 
  226.                                         angle  : Fixed; 
  227.                                         color  : Color_Type ); 
  228.  
  229.     procedure Rotate_Sprite_V_Flip_Trans( bmp, 
  230.                                           sprite : not null A_Bitmap; 
  231.                                           x, y   : Integer; 
  232.                                           angle  : Fixed ); 
  233.  
  234.     procedure Stretch_Blit( source, 
  235.                             dest          : not null A_Bitmap; 
  236.                             source_x, 
  237.                             source_y      : Integer; 
  238.                             source_width, 
  239.                             source_height : Natural; 
  240.                             dest_x, 
  241.                             dest_y        : Integer; 
  242.                             dest_width, 
  243.                             dest_height   : Natural ); 
  244.  
  245.     procedure Stretch_Sprite( bmp, 
  246.                               sprite : not null A_Bitmap; 
  247.                               x, y   : Integer; 
  248.                               w, h   : Natural ); 
  249.  
  250. private 
  251.  
  252.     DRAW_SPRITE_NORMAL : constant Integer := 0; 
  253.     DRAW_SPRITE_LIT    : constant Integer := 1; 
  254.     DRAW_SPRITE_TRANS  : constant Integer := 2; 
  255.  
  256.     FLIP_DRAW_SPRITE_NO_FLIP : constant Integer := 2#00#; 
  257.     FLIP_DRAW_SPRITE_H_FLIP  : constant Integer := 2#01#; 
  258.     FLIP_DRAW_SPRITE_V_FLIP  : constant Integer := 2#10#; 
  259.     FLIP_DRAW_SPRITE_VH_FLIP : constant Integer := 2#11#; 
  260.  
  261.     ---------------------------------------------------------------------------- 
  262.  
  263.     pragma Import( C, Blit, "blit" ); 
  264.     pragma Import( C, Draw_Character_Ex, "draw_character_ex" ); 
  265.     pragma Import( C, Draw_Gouraud_Sprite, "draw_gouraud_sprite" ); 
  266.     pragma Import( C, Draw_Lit_Sprite, "draw_lit_sprite" ); 
  267.     pragma Import( C, Draw_Sprite, "draw_sprite" ); 
  268.     pragma Import( C, Draw_Sprite_Ex, "draw_sprite_ex" ); 
  269.     pragma Import( C, Draw_Sprite_H_Flip, "draw_sprite_h_flip" ); 
  270.     pragma Import( C, Draw_Sprite_V_Flip, "draw_sprite_v_flip" ); 
  271.     pragma Import( C, Draw_Sprite_VH_Flip, "draw_sprite_vh_flip" ); 
  272.     pragma Import( C, Draw_Trans_Sprite, "draw_trans_sprite" ); 
  273.     pragma Import( C, Masked_Blit, "masked_blit" ); 
  274.     pragma Import( C, Masked_Stretch_Blit, "masked_stretch_blit" ); 
  275.     pragma Import( C, Pivot_Scaled_Sprite, "pivot_scaled_sprite" ); 
  276.     pragma Import( C, Pivot_Scaled_Sprite_Lit, "pivot_scaled_sprite_lit" ); 
  277.     pragma Import( C, Pivot_Scaled_Sprite_Trans, "pivot_scaled_sprite_trans" ); 
  278.     pragma Import( C, Pivot_Scaled_Sprite_V_Flip, "pivot_scaled_sprite_v_flip" ); 
  279.     pragma Import( C, Pivot_Scaled_Sprite_V_Flip_Lit, "pivot_scaled_sprite_v_flip_lit" ); 
  280.     pragma Import( C, Pivot_Scaled_Sprite_V_Flip_Trans, "pivot_scaled_sprite_v_flip_trans" ); 
  281.     pragma Import( C, Pivot_Sprite, "pivot_sprite" ); 
  282.     pragma Import( C, Pivot_Sprite_Lit, "pivot_sprite_lit" ); 
  283.     pragma Import( C, Pivot_Sprite_Trans, "pivot_sprite_trans" ); 
  284.     pragma Import( C, Pivot_Sprite_V_Flip, "pivot_sprite_v_flip" ); 
  285.     pragma Import( C, Pivot_Sprite_V_Flip_Lit, "pivot_sprite_v_flip_lit" ); 
  286.     pragma Import( C, Pivot_Sprite_V_Flip_Trans, "pivot_sprite_v_flip_trans" ); 
  287.     pragma Import( C, Rotate_Scaled_Sprite, "rotate_scaled_sprite" ); 
  288.     pragma Import( C, Rotate_Scaled_Sprite_Lit, "rotate_scaled_sprite_lit" ); 
  289.     pragma Import( C, Rotate_Scaled_Sprite_Trans, "rotate_scaled_sprite_trans" ); 
  290.     pragma Import( C, Rotate_Scaled_Sprite_V_Flip, "rotate_scaled_sprite_v_flip" ); 
  291.     pragma Import( C, Rotate_Scaled_Sprite_V_Flip_Lit, "rotate_scaled_sprite_v_flip_lit" ); 
  292.     pragma Import( C, Rotate_Scaled_Sprite_V_Flip_Trans, "rotate_scaled_sprite_v_flip_trans" ); 
  293.     pragma Import( C, Rotate_Sprite, "rotate_sprite" ); 
  294.     pragma Import( C, Rotate_Sprite_Lit, "rotate_sprite_lit" ); 
  295.     pragma Import( C, Rotate_Sprite_Trans, "rotate_sprite_trans" ); 
  296.     pragma Import( C, Rotate_Sprite_V_Flip, "rotate_sprite_v_flip" ); 
  297.     pragma Import( C, Rotate_Sprite_V_Flip_Lit, "rotate_sprite_v_flip_lit" ); 
  298.     pragma Import( C, Rotate_Sprite_V_Flip_Trans, "rotate_sprite_v_flip_trans" ); 
  299.     pragma Import( C, Stretch_Blit, "stretch_blit" ); 
  300.     pragma Import( C, Stretch_Sprite, "stretch_sprite" ); 
  301.  
  302. end Allegro.Sprites;