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.Bitmaps;                   use Allegro.Bitmaps; 
  10. with Allegro.Fixed_Point_Math;          use Allegro.Fixed_Point_Math; 
  11. with Allegro.Truecolor;                 use Allegro.Truecolor; 
  12.  
  13. -- Allegro 4.4.2 - Drawing primitives 
  14. -- This package is missing: 
  15. -- _putpixel, _putpixel15, _putpixel16, _putpixel24, _putpixel32, _getpixel, 
  16. -- _getpixel15, _getpixel16, _getpixel24, _getpixel32, calc_spline, spline 
  17. package Allegro.Drawing is 
  18.  
  19.     type Point is 
  20.         record 
  21.             x, y : Integer; 
  22.         end record; 
  23.  
  24.     type Point_Array is array (Integer range <>) of Point; 
  25.  
  26.     type A_Draw_Proc is 
  27.         access procedure( bmp : A_Bitmap; x, y : Integer; d : Integer ); 
  28.  
  29.     --------------------------------------------------------------------------- 
  30.  
  31.     procedure Arc( bmp   : not null A_Bitmap; 
  32.                    x, y  : Integer; 
  33.                    ang1, 
  34.                    ang2  : Fixed; 
  35.                    r     : Integer; 
  36.                    color : Color_Type ); 
  37.  
  38.     procedure Circle( bmp    : not null A_Bitmap; 
  39.                       x, y, 
  40.                       radius : Integer; 
  41.                       color  : Color_Type ); 
  42.  
  43.     procedure Circlefill( bmp    : not null A_Bitmap; 
  44.                           x, y, 
  45.                           radius : Integer; 
  46.                           color  : Color_Type ); 
  47.  
  48.     procedure Clear_Bitmap( bmp : not null A_Bitmap ); 
  49.  
  50.     procedure Clear_To_Color( bmp : not null A_Bitmap; color : Color_Type ); 
  51.  
  52.     procedure Clear_To_Transparent( bmp : not null A_Bitmap ); 
  53.  
  54.     procedure Do_Arc( bmp    : not null A_Bitmap; 
  55.                       x, y, 
  56.                       a1, a2 : Fixed; 
  57.                       r      : Integer; 
  58.                       d      : Integer; 
  59.                       proc   : not null A_Draw_Proc ); 
  60.  
  61.     procedure Do_Circle( bmp    : not null A_Bitmap; 
  62.                          x, y, 
  63.                          radius : Integer; 
  64.                          d      : Integer; 
  65.                          proc   : not null A_Draw_Proc ); 
  66.  
  67.     procedure Do_Ellipse( bmp    : not null A_Bitmap; 
  68.                           x, y, 
  69.                           rx, ry : Integer; 
  70.                           d      : Integer; 
  71.                           proc   : not null A_Draw_Proc ); 
  72.  
  73.     procedure Do_Line( bmp    : not null A_Bitmap; 
  74.                        x1, y1, 
  75.                        x2, y2 : Integer; 
  76.                        d      : Integer; 
  77.                        proc   : not null A_Draw_Proc ); 
  78.  
  79.     procedure Ellipse( bmp    : not null A_Bitmap; 
  80.                        x, y, 
  81.                        rx, ry : Integer; 
  82.                        color  : Color_Type ); 
  83.  
  84.     procedure Ellipsefill( bmp    : not null A_Bitmap; 
  85.                            x, y, 
  86.                            rx, ry : Integer; 
  87.                            color  : Color_Type ); 
  88.  
  89.     procedure Fastline( bmp    : not null A_Bitmap; 
  90.                         x1, y1, 
  91.                         x2, y2 : Integer; 
  92.                         color  : Color_Type ); 
  93.  
  94.     procedure Floodfill( bmp   : not null A_Bitmap; 
  95.                          x, y  : Integer; 
  96.                          color : Color_Type ); 
  97.  
  98.     function Getpixel( bmp : not null A_Bitmap; x, y : Integer ) return Color_Type; 
  99.  
  100.     procedure Hline( bmp       : not null A_Bitmap; 
  101.                      x1, y, x2 : Integer; 
  102.                      color     : Color_Type ); 
  103.  
  104.     procedure Line( bmp    : not null A_Bitmap; 
  105.                     x1, y1, 
  106.                     x2, y2 : Integer; 
  107.                     color  : Color_Type ); 
  108.  
  109.     procedure Polygon( bmp    : not null A_Bitmap; 
  110.                        points : Point_Array; 
  111.                        color  : Color_Type ); 
  112.  
  113.     procedure Putpixel( bmp   : not null A_Bitmap; 
  114.                         x, y  : Integer; 
  115.                         color : Color_Type ); 
  116.  
  117.     procedure Rect( bmp    : not null A_Bitmap; 
  118.                     x1, y1, 
  119.                     x2, y2 : Integer; 
  120.                     color  : Color_Type ); 
  121.  
  122.     procedure Rectfill( bmp    : not null A_Bitmap; 
  123.                         x1, y1, 
  124.                         x2, y2 : Integer; 
  125.                         color  : Color_Type ); 
  126.  
  127.     procedure Triangle( bmp    : not null A_Bitmap; 
  128.                         x1, y1, 
  129.                         x2, y2, 
  130.                         x3, y3 : Integer; 
  131.                         color  : Color_Type ); 
  132.  
  133.     procedure Vline( bmp       : not null A_Bitmap; 
  134.                      x, y1, y2 : Integer; 
  135.                      color     : Color_Type ); 
  136.  
  137. private 
  138.  
  139.     pragma Convention( C, Point ); 
  140.     pragma Convention( C, Point_Array ); 
  141.     pragma Convention( C, A_Draw_Proc ); 
  142.  
  143.     pragma Import( C, Arc, "arc" ); 
  144.     pragma Import( C, Circle, "circle" ); 
  145.     pragma Import( C, Circlefill, "circlefill" ); 
  146.     pragma Import( C, Clear_Bitmap, "clear_bitmap" ); 
  147.     pragma Import( C, Clear_To_Color, "clear_to_color" ); 
  148.     pragma Import( C, Do_Arc, "do_arc" ); 
  149.     pragma Import( C, Do_Circle, "do_circle" ); 
  150.     pragma Import( C, Do_Ellipse, "do_ellipse" ); 
  151.     pragma Import( C, Do_Line, "do_line" ); 
  152.     pragma Import( C, Ellipsefill, "ellipsefill" ); 
  153.     pragma Import( C, Ellipse, "ellipse" ); 
  154.     pragma Import( C, Fastline, "fastline" ); 
  155.     pragma Import( C, Floodfill, "floodfill" ); 
  156.     pragma Import( C, Getpixel, "getpixel" ); 
  157.     pragma Import( C, Hline, "hline" ); 
  158.     pragma Import( C, Line, "line" ); 
  159.     pragma Import( C, Putpixel, "putpixel" ); 
  160.     pragma Import( C, Rect, "rect" ); 
  161.     pragma Import( C, Rectfill, "rectfill" ); 
  162.     pragma Import( C, Triangle, "triangle" ); 
  163.     pragma Import( C, Vline, "vline" ); 
  164.  
  165. end Allegro.Drawing;