Index

Package: Drawing

Description

package Drawing is
Copyright (c) 2012 Kevin Wellwood All rights reserved. This source code is distributed under the Modified BSD License. For terms and conditions, see license.txt.

Types

Filter_Type

type Filter_Type is
    (
        Filter_Nearest,    -- effectively no filter
        Filter_Linear,     -- linear scaling by Allegro
        Filter_xBR         -- xBR filter (2x, 3x, 4x only)
    );

Subprograms & Entries

Push_State

procedure Push_State;
Stores the current drawing state, including the target bitmap, blender, and transformation, on a stack. Calling the corresponding Pop_State will reset the state to what it was just before the push. Note: This procedure must NOT be called from multiple threads. The state stack is not stored in thread-local memory.

Pop_State

procedure Pop_State;
Pops the drawing state from the previous corresponding call to Push_State and restores it. Note: This procedure must NOT be called from multiple threads. The state stack is not stored in thread-local memory.

Set_Target_Bitmap

procedure Set_Target_Bitmap
( bmp: not null A_Allegro_Bitmap );
Sets the drawing target bitmap.

Get_Target_Bitmap

function Get_Target_Bitmap return A_Allegro_Bitmap;
Returns the drawing target bitmap.

Get_Target_Width

function Get_Target_Width return Natural;
Returns the width of the drawing target in pixels.

Get_Target_Height

function Get_Target_Height return Natural;
Returns the height of the drawing target in pixels.

Clear_To_Color

procedure Clear_To_Color
( color: Allegro_Color );
Clears the entire drawing target to a single color.

Draw_Bitmap

procedure Draw_Bitmap
( bmp: A_Allegro_Bitmap;
x, y: Integer );
Draws 'bmp' onto the drawing target, using the given location for its top left corner.

Draw_Bitmap_Stretched

procedure Draw_Bitmap_Stretched
( bmp: A_Allegro_Bitmap;
x, y: Integer;
width, height: Positive;
proportional: Boolean := False );
Draws 'bmp' onto the drawing target, stretching it to 'width' x 'height'. If 'proportional' is to True, 'bmp' will be drawn proportionally within the given width and height, instead of being stretched disproportionately to fill exactly 'width' x 'height'.

Draw_Bitmap_Region_Stretched

procedure Draw_Bitmap_Region_Stretched
( bmp: A_Allegro_Bitmap;
srcX, srcY: Integer;
srcWidth, srcHeight: Positive;
destX, destY: Integer;
destWidth, destHeight: Positive );
Draws a region of 'bmp' onto the drawing target, stretching it to the specified dimensions without respect to the original proportions.

Draw_String

procedure Draw_String
( str: String;
x, y: Integer;
font: A_Font;
color: Allegro_Color );
Draws a string onto the drawing target.

Line_H

procedure Line_H
( x1, x2: Integer;
y: Integer;
color: Allegro_Color );
Draws a horizontal line on the drawing target.

Line_V

procedure Line_V
( x: Integer;
y1, y2: Integer;
color: Allegro_Color );
Draws a vertical line on the drawing target.

Rect

procedure Rect
( x1, y1, x2, y2: Integer;
color: Allegro_Color );
Draws a rectangle on the drawing target.

Rectfill

procedure Rectfill
( x1, y1, x2, y2: Integer;
color: Allegro_Color );
Draws a filled rectangle on the drawing target.

Rectfill_Additive

procedure Rectfill_Additive
( x1, y1, x2, y2: Integer;
color: Allegro_Color );
Draws a filled rectangle using additive blending.

Triangle

procedure Triangle
( x1, y1: Integer;
x2, y2: Integer;
x3, y3: Integer;
color: Allegro_Color );
Draws a triangle on the drawing target.

Triangle_Filled

procedure Triangle_Filled
( x1, y1: Integer;
x2, y2: Integer;
x3, y3: Integer;
color: Allegro_Color );
Draws a filled triangle on the drawing target.

To_Filter

function To_Filter
( name: String;
default: Filter_Type := Filter_Type'First ) return Filter_Type;

To_Name

function To_Name
( filter: Filter_Type ) return String;