The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Image::BoxModel::Lowlevel - Lowlevel functions for Image::BoxModel

SYNOPSIS

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

DESCRIPTION

Image::BoxModel::Lowlevel implements some basic functionality.

It does so by using the methods from Image::BoxModel::Backend::[LIBRARY] The thing is, this is in the stage of being implemented at the moment.

There are more backends planned and more functionality for each backend. (backends, patches, wishes are very welcome - in this order ;-)

Image::BoxModel::Lowlevel can be used directly, which is considered painful. You need to specify the size of a box before you can put text on it, for example. This can lead to non-fitting text.

Better use the Modules

Image::BoxModel::Text for all things text

and

Image::BoxModel::Chart for charts.

The bad thing is, these modules are yet to be written. ;-)

Methods:

GetBoxSize

 ($width, $height) = $image -> GetBoxSize (box => "name_of_your_box");

Box

If you don't specify 'resize => $name_of_box_to_be_resized', the standard-box 'free' is chosen.

 $image -> Box (
        position =>[left|right|top|bottom], 
        width=> $x, 
        height => $y, 
        name => $name_of_new_box
 );

FloatBox

To position a free-floating box wherever you want. There is virtually no error-checking, so perhaps better keep your hands off. ;-)

 $image -> FloatBox(
        top =>$top, 
        bottom=>$bottom, 
        right=> $right, 
        left=> $top, 
        name=>"whatever_you_call_it", 
        background =>[color]
 );

GetTextSize

Get the boundig size of (rotated) text. Very useful to find out how big boxes need to be. ($width, $height) = GetTextSize( text => "Your Text", textsize => [number], rotate => [in degrees, may be negative as well] );

Text

Put (rotated, antialized) text on a box. Takes a bunch of parameters, of which "text" and "textsize" are mandatory.

 $image -> Text(
        text =>         $text,
        textsize => [number],
        fill=>          "black",                                #color of text, will be renamed soon
        font => "verdana",
        rotate=>        [in degrees, may be negative as well],
        box =>  "free",
        align =>        [Left|Center|Right]",           #align is how multiline-text is aligned
        position =>[Center                              #position is how text will be positioned inside its box
                        NorthWest|
                        North|
                        NorthEast|
                        West|
                        SoutEast|
                        South|
                        SouthWest|
                        West],
        background=> [color]                            #rather for debugging
 );

Save

Save the image to file. There is no error-checking at the moment if your chosen library supports the desired file-type.

Internal methods:

(documentation for myself rather than the user)

rotation

To rotate a given point by any point. It takes the angle in degrees, which is very comfortable to me. If you want to rotate something, feel free to use it. :-)

 ($x, $y) = $image -> rotation($x, $y, $x_center, $y_center, $angle);

Checks if verbose is on and then prints messages. $image -> print_message("Text");

EXPORT

Nothing. Please use the object oriented interface.

SEE ALSO

Nowhere at the moment.

AUTHOR

Matthias Bloch, <lt>matthias at puffin ch<gt>

COPYRIGHT AND LICENSE

Copyright (C) 2008 by :m)

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.