Index

Package: Scaling

Description

package Scaling is
Note: The Scaling package is not thread-safe.

Types

Filter_Type

type Filter_Type is
    (
        Filter_Nearest,    -- effectively no filter
        Filter_Quality,    -- choose best looking filter
        Filter_HQX,
        Filter_2xSaI,
        Filter_Eagle,
        Filter_ScaleX
    );

Constants & Global variables

INIT_EXCEPTION

INIT_EXCEPTION : exception;

Subprograms & Entries

Initialize

procedure Initialize
( color_depth: Integer );
Initializes the scaling filters. This must be called before Scale. Raises INIT_EXCEPTION with a message, if not successful.

Finalize

procedure Finalize;
Finalizes the scaling filters before application exit. Calling this will have no effect if Initialize hasn't been called.

Scale

procedure Scale
( src, dst: not null A_Bitmap;
src_width, src_height: Positive;
magnification: Float;
filter: Filter_Type := Filter_Nearest );
Scales the upper left corner of the source bitmap onto the upper left corner of the destination bitmap. The filter type is used to do the scale if it is available for the given magnification. If the requested filter can't scale to the requested magnification, the default filter is used. Scale will have no effect if Initialize hasn't been called.

To_Filter

function To_Filter
( name: String;
default: Filter_Type := Filter_Type'First ) return Filter_Type;
Filter names are Filter_Type members without the Filter_ prefix. If the name doesn't match a filter, 'default' will be returned.