with Allegro.Bitmaps; use Allegro.Bitmaps;
with Interfaces; use Interfaces;
with System; use System;
package Allegro.Drawing.Primitives is
function Al_Init_Primitives_Addon return Boolean;
procedure Al_Shutdown_Primitives_Addon;
pragma Import( C, Al_Shutdown_Primitives_Addon, "al_shutdown_primitives_addon" );
function Al_Get_Allegro_Primitives_Version return Unsigned_32;
pragma Import( C, Al_Get_Allegro_Primitives_Version, "al_get_allegro_primitives_version" );
type Point_2D is
record
x, y : Float;
end record;
pragma Convention( C, Point_2D );
type Point_2D_Array is array (Integer range <>) of Point_2D;
pragma Convention( C, Point_2D_Array );
procedure Al_Draw_Line( x1, y1,
x2, y2 : Float;
color : Allegro_Color;
thickness : Float );
pragma Import( C, Al_Draw_Line, "al_draw_line" );
procedure Al_Draw_Triangle( x1, y1,
x2, y2,
x3, y3 : Float;
color : Allegro_Color;
thickness : Float );
pragma Import( C, Al_Draw_Triangle, "al_draw_triangle" );
procedure Al_Draw_Rectangle( x1, y1,
x2, y2 : Float;
color : Allegro_Color;
thickness : Float );
pragma Import( C, Al_Draw_Rectangle, "al_draw_rectangle" );
procedure Al_Draw_Rounded_Rectangle( x1, y1,
x2, y2 : Float;
rx, ry : Float;
color : Allegro_Color;
thickness : Float );
pragma Import( C, Al_Draw_Rounded_Rectangle, "al_draw_rounded_rectangle" );
procedure Al_Calculate_Arc( dest : Address;
stride : Integer;
cx, cy : Float;
rx, ry : Float;
start_theta : Float;
delta_theta : Float;
thickness : Float;
num_segments : Integer );
pragma Import( C, Al_Calculate_Arc, "al_calculate_arc" );
procedure Al_Calculate_Arc( dest : Point_2D_Array;
cx, cy : Float;
rx, ry : Float;
start_theta : Float;
delta_theta : Float;
thickness : Float );
pragma Precondition( dest'Length > 0 );
pragma Precondition( thickness <= 0.0 or else dest'Length mod 2 = 0 );
procedure Al_Draw_Circle( cx, cy : Float;
r : Float;
color : Allegro_Color;
thickness : Float );
pragma Import( C, Al_Draw_Circle, "al_draw_circle" );
procedure Al_Draw_Ellipse( cx, cy : Float;
rx, ry : Float;
color : Allegro_Color;
thickness : Float );
pragma Import( C, Al_Draw_Ellipse, "al_draw_ellipse" );
procedure Al_Draw_Arc( cx, cy : Float;
r : Float;
start_theta : Float;
delta_theta : Float;
color : Allegro_Color;
thickness : Float );
pragma Import( C, Al_Draw_Arc, "al_draw_arc" );
procedure Al_Draw_Elliptical_Arc( cx, cy : Float;
rx, ry : Float;
start_theta : Float;
delta_theta : Float;
color : Allegro_Color;
thickness : Float );
pragma Import( C, Al_Draw_Elliptical_Arc, "al_draw_elliptical_arc" );
procedure Al_Draw_Pieslice( cx, cy : Float;
r : Float;
start_theta : Float;
delta_theta : Float;
color : Allegro_Color;
thickness : Float );
pragma Import( C, Al_Draw_Pieslice, "al_draw_pieslice" );
procedure Al_Calculate_Spline( dest : Address;
stride : Integer;
points : Address;
thickness : Float;
num_segments : Integer );
pragma Import( C, Al_Calculate_Spline, "al_calculate_spline" );
procedure Al_Calculate_Spline( dest : Point_2D_Array;
points : Point_2D_Array;
thickness : Float );
pragma Precondition( dest'Length > 0 );
pragma Precondition( thickness <= 0.0 or else dest'Length mod 2 = 0 );
pragma Precondition( points'Length = 4 );
procedure Al_Draw_Spline( points : Address;
color : Allegro_Color;
thickness : Float );
pragma Import( C, Al_Draw_Spline, "al_draw_spline" );
procedure Al_Draw_Spline( points : Point_2D_Array;
color : Allegro_Color;
thickness : Float );
pragma Precondition( points'Length = 4 );
procedure Al_Calculate_Ribbon( dest : Address;
dest_stride : Integer;
points : Address;
points_stride : Integer;
thickness : Float;
num_segments : Integer );
pragma Import( C, Al_Calculate_Ribbon, "al_calculate_ribbon" );
procedure Al_Calculate_Ribbon( dest : Point_2D_Array;
points : Point_2D_Array;
thickness : Float );
pragma Precondition( dest'Length > 0 );
pragma Precondition( points'Length > 0 );
pragma Precondition( (thickness <= 0.0 and then dest'Length = points'Length) or else
(thickness > 0.0 and then dest'Length = points'Length * 2) );
procedure Al_Draw_Ribbon( points : Address;
stride : Integer;
color : Allegro_Color;
thickness : Float;
num_segments : Integer );
pragma Import( C, Al_Draw_Ribbon, "al_draw_ribbon" );
procedure Al_Draw_Ribbon( points : Point_2D_Array;
color : Allegro_Color;
thickness : Float );
pragma Precondition( points'Length > 0 );
procedure Al_Draw_Filled_Triangle( x1, y1,
x2, y2,
x3, y3 : Float;
color : Allegro_Color );
pragma Import( C, Al_Draw_Filled_Triangle, "al_draw_filled_triangle" );
procedure Al_Draw_Filled_Rectangle( x1, y1,
x2, y2 : Float;
color : Allegro_Color );
pragma Import( C, Al_Draw_Filled_Rectangle, "al_draw_filled_rectangle" );
procedure Al_Draw_Filled_Ellipse( cx, cy : Float;
rx, ry : Float;
color : Allegro_Color );
pragma Import( C, Al_Draw_Filled_Ellipse, "al_draw_filled_ellipse" );
procedure Al_Draw_Filled_Circle( cx, cy : Float;
r : Float;
color : Allegro_Color );
pragma Import( C, Al_Draw_Filled_Circle, "al_draw_filled_circle" );
procedure Al_Draw_Filled_Pieslice( cx, cy : Float;
r : Float;
start_theta : Float;
delta_theta : Float;
color : Allegro_Color );
pragma Import( C, Al_Draw_Filled_Pieslice, "al_draw_filled_pieslice" );
procedure Al_Draw_Filled_Rounded_Rectangle( x1, y1 : Float;
x2, y2 : Float;
rx, ry : Float;
color : Allegro_Color );
pragma Import( C, Al_Draw_Filled_Rounded_Rectangle, "al_draw_filled_rounded_rectangle" );
type Allegro_Vertex is
record
x, y, z : Float;
u, v : Float;
color : Allegro_Color;
end record;
pragma Convention( C, Allegro_Vertex );
type Allegro_Vertex_Array is array (Integer range <>) of Allegro_Vertex;
pragma Convention( C, Allegro_Vertex_Array );
type Allegro_Prim_Attr is (
ALLEGRO_PRIM_NONE,
ALLEGRO_PRIM_POSITION,
ALLEGRO_PRIM_COLOR_ATTR,
ALLEGRO_PRIM_TEX_COORD,
ALLEGRO_PRIM_TEX_COORD_PIXEL,
ALLEGRO_PRIM_ATTR_NUM
);
pragma Convention( C, Allegro_Prim_Attr );
type Allegro_Prim_Storage is (
ALLEGRO_PRIM_FLOAT_2,
ALLEGRO_PRIM_FLOAT_3,
ALLEGRO_PRIM_SHORT_2,
ALLEGRO_PRIM_COLOR
);
pragma Convention( C, Allegro_Prim_Storage );
type Allegro_Vertex_Element is
record
attribute : Allegro_Prim_Attr;
storage : Allegro_Prim_Storage;
offset : Integer;
end record;
pragma Convention( C, Allegro_Vertex_Element );
type Allegro_Vertex_Element_Array is array (Integer range <>) of Allegro_Vertex_Element;
pragma Convention( C, Allegro_Vertex_Element_Array );
type Allegro_Vertex_Decl is limited private;
type A_Allegro_Vertex_Decl is access all Allegro_Vertex_Decl;
type Allegro_Prim_Type is (
ALLEGRO_PRIM_LINE_LIST,
ALLEGRO_PRIM_LINE_STRIP,
ALLEGRO_PRIM_LINE_LOOP,
ALLEGRO_PRIM_TRIANGLE_LIST,
ALLEGRO_PRIM_TRIANGLE_STRIP,
ALLEGRO_PRIM_TRIANGLE_FAN,
ALLEGRO_PRIM_POINT_LIST,
ALLEGRO_PRIM_NUM_TYPES
);
pragma Convention( C, Allegro_Prim_Type );
type Vertex_Index_Array is array (Natural range <>) of Integer;
function Al_Create_Vertex_Decl( elements : Address;
stride : Integer ) return A_Allegro_Vertex_Decl;
pragma Import( C, Al_Create_Vertex_Decl, "al_create_vertex_decl" );
function Al_Create_Vertex_Decl( elements : Allegro_Vertex_Element_Array;
stride : Positive ) return A_Allegro_Vertex_Decl;
pragma Precondition( elements'Length > 0 );
procedure Al_Destroy_Vertex_Decl( decl : in out A_Allegro_Vertex_Decl );
procedure Al_Draw_Prim( vertices : Address;
decl : A_Allegro_Vertex_Decl;
texture : A_Allegro_Bitmap;
start : Integer;
stop : Integer;
primType : Allegro_Prim_Type );
pragma Import( C, Al_Draw_Prim, "al_draw_prim" );
procedure Al_Draw_Prim( vertices : Allegro_Vertex_Array;
texture : A_Allegro_Bitmap;
start : Integer;
stop : Integer;
primType : Allegro_Prim_Type );
function Al_Draw_Indexed_Prim( vertices : Address;
decl : A_Allegro_Vertex_Decl;
texture : A_Allegro_Bitmap;
indices : Vertex_Index_Array;
primType : Allegro_Prim_Type ) return Integer;
procedure Al_Draw_Indexed_Prim( vertices : Address;
decl : A_Allegro_Vertex_Decl;
texture : A_Allegro_Bitmap;
indices : Vertex_Index_Array;
primType : Allegro_Prim_Type );
procedure Al_Draw_Indexed_Prim( vertices : Allegro_Vertex_Array;
texture : A_Allegro_Bitmap;
indices : Vertex_Index_Array;
primType : Allegro_Prim_Type );
private
type Allegro_Vertex_Decl is limited null record;
pragma Convention( C, Allegro_Vertex_Decl );
end Allegro.Drawing.Primitives;