Ala Qumsieh

NAME

Tk::RotCanvas - Canvas widget with arbitrary rotation support

SYNOPSIS

    $canvas = $parent->RotCanvas(?options?);
    my $obj = $canvas->create('polygon', @coords, %options);
    $canvas->rotate($obj, $angle, ?x, y?);

DESCRIPTION

This module is a small wrapper around the Canvas widget that adds a new rotate() method. This method allows the rotation of various canvas objects by arbitrary angles.

NEW METHODS

As mentioned previously, there is only one new method. All other canvas methods work as expected.

$canvas->rotate(TagOrID, angle ?,x, y?)

This method rotates the object identified by TagOrID by an angle angle. The angle is specified in degrees. If a coordinate is specified, then the object is rotated about that point. Else, the object is rotated about its center of mass.

LIMITATIONS

As it stands, the module can only handle the following object types:

  • Lines

  • Rectangles

  • Polygons

  • Ovals

All other object types (bitmap, image, arc, text and window) can not be handled yet. A warning is issued if the user tries to rotate one of these object types. Hopefully, more types will be handled in the future.

MORE DETAILS YOU DON'T NEED TO KNOW

To be able to handle rectangles, the module intercepts any calls to createRectangle() and create() and changes all rectangles to polygons. The user should not be alarmed if type() returned polygon when a rectangle was expected.

Similarly, ovals are converted into polygons.

THANKS

Special thanks go to Larry Shatzer for developing the code to handle ovals.

AUTHOR

Ala Qumsieh qumsieh@cim.mcgill.ca

COPYRIGHTS

This module is distributed under the same terms as Perl itself.