Index

Package: Drawing_Contexts

Description

package Drawing_Contexts is

Types

Layer_Type

type Layer_Type is (Background, Foreground);

Drawing_Context

type Drawing_Context is private;
Encapsulates all of the information and operations required to draw within a specific context. All drawing operations performed with a Drawing_Context will be properly translated onto the context's target bitmap.

Subprograms & Entries

Create_Drawing_Context

function Create_Drawing_Context
( bmp: not null A_Bitmap;
offx, offy: Integer;
layer: Layer_Type ) return Drawing_Context;
Creates a new drawing context using the given bitmap. All drawing calls with this context will be translated to the bitmap by 'offx', 'offy' pixels.

Blit

procedure Blit
( dc: Drawing_Context;
source: A_Bitmap;
source_x, source_y, dest_x, dest_y: Integer;
width, height: Natural );
Solidly blits the bitmap, changing every pixel in the dest rectangle unless the source pixel contains the standard mask color.

Clear_To_Color

procedure Clear_To_Color
( dc: Drawing_Context;
color: Color_Type );
Clears the entire drawing area to a single color.

Draw_Alpha_Sprite

procedure Draw_Alpha_Sprite
( dc: Drawing_Context;
sprite: A_Bitmap;
x, y: Integer );
Draws a sprite using full alpha channel blending.

Draw_Sprite

procedure Draw_Sprite
( dc: Drawing_Context;
sprite: A_Bitmap;
x, y: Integer );
Draws a sprite using the standard mask color for transparent pixels.

Get_Height

function Get_Height
( dc: Drawing_Context ) return Natural;
Returns the height of the drawing area in pixels.

Get_Layer

function Get_Layer
( dc: Drawing_Context ) return Layer_Type;
Returns the layer of the drawing context that was specified at creation.

Get_Width

function Get_Width
( dc: Drawing_Context ) return Natural;
Returns the width of the drawing area in pixels.

Line

procedure Line
( dc: Drawing_Context;
x1, y1, x2, y2: Integer;
color: Color_Type );
Draws a straight line.

Rect

procedure Rect
( dc: Drawing_Context;
x1, y1, x2, y2: Integer;
color: Color_Type;
opacity: Natural := 255 );
Draws a rectangle.

Rectfill

procedure Rectfill
( dc: Drawing_Context;
x1, y1, x2, y2: Integer;
color: Color_Type;
opacity: Natural := 255 );
Draws a filled rectangle.

Stretch_Blit

procedure Stretch_Blit
( dc: Drawing_Context;
bmp: A_Bitmap;
source_x, source_y: Integer;
source_width, source_height: Positive;
dest_x, dest_y: Integer;
dest_width, dest_height: Positive );
Solidly blits the bitmap, stretching it to a specified size.

Stretch_Sprite

procedure Stretch_Sprite
( dc: Drawing_Context;
sprite: A_Bitmap;
x, y: Integer;
w, h: Positive;
proportional: Boolean );
Blits a bitmap using the transparent color as a mask. 'w' and 'h' are the destination size to stretch the sprite to. If 'proportional' is to True, the sprite will be drawn proportionally within the new width and height, instead of being stretched disproportionately to fill it entirely.

Textout

procedure Textout
( dc: Drawing_Context;
f: Font_Type;
s: String;
x, y: Integer;
color: Color_Type;
smooth: Boolean );
Draws a string string, using the given font. If 'smooth' is set to True, the text will be anti-aliased with the context's bitmap.

Triangle

procedure Triangle
( dc: Drawing_Context;
x1, y1: Integer;
x2, y2: Integer;
x3, y3: Integer;
color: Color_Type;
opacity: Natural := 255 );
Draws a triangle.