The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Image::BoxModel::Text - Text function for Image::BoxModel

SYNOPSIS

  For an example and general information see Image::BoxModel.pm

DESCRIPTION

Image::BoxModel::Text implements direct inserting of text. It has the following method 'Annotate' which a Image::BoxModel object inherits.

It uses Image::BoxModel::Lowlevel for defining boxes and drawing text. See there for more information.

'Annotate' will guarantee that every text lives in its own box and avoids many possible bugs, like text being overwritten by other texts in the same box, to small boxes..

Anyway, if you have a good reason, feel free to use the methods from ::Lowlevel directly. This can end in completely non-box-model-style images.

Method

Annotate

 $name_of_box = $image -> Annotate (
        text                    => $text                                        # mandatory
        name                    => $name_of_box
        position                => [top|bottom|right|left],
        textsize                => $size,
        font                    => $font,                                       
        rotate                  => [in degrees, may be negative as well],
        align                   => [Center|Left|Right],         # align is how multiline-text is aligned
        text_position   => [Center                                      # position is how text will be positioned inside its box
                                                NorthWest|
                                                North|
                                                NorthEast|
                                                West|
                                                SoutEast|
                                                South|
                                                SouthWest|
                                                West],
        background              => (color),
        padding_right   => [number],
        padding_left    => [number],
        padding_top     => [number],
        padding_bottom  => [number],
 )

All parameters except "text" are preset with defaults. These are the first value above or generally "0" for numbers (except "12" for textsize), and "white" for colors.

$name_of_box is a number, starting from 1.

ArrayBox

 $image -> ArrayBox (
        values => \@array,      #holds the texts
        textsize => [number],
        rotate => [degree],
        resize => [name of box],
        position => [top | bottom | right | left],
        name => [name of new box],
        background => [color]   #optional
 );

Creates a exactly fitting box for an simple array of values. It does not understand what to do with arrays of arrays or the like. The new box is directly stored into the $image object.

It returns nothing.

Can only be used from Image::BoxModel::Chart objects at the moment. Or manually add Image::BoxModel::Chart::Data to your @ISA and use() it.

If the new box is positioned top or bottom, ArrayBox assumes that the user wants to draw the values side by side, if the position is left or right, that the values are "piled" bottom up or top down.