Tk::RotCanvas - Canvas widget with arbitrary rotation support
$canvas = $parent->RotCanvas(?options?); my $obj = $canvas->create('polygon', @coords, %options); $canvas->rotate($obj, $angle, ?x, y?);
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.
Canvas
As mentioned previously, there is only one new method. All other canvas methods work as expected.
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.
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.
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.
Special thanks go to Larry Shatzer for developing the code to handle ovals.
Ala Qumsieh qumsieh@cim.mcgill.ca
This module is distributed under the same terms as Perl itself.
To install Tk::RotCanvas, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Tk::RotCanvas
CPAN shell
perl -MCPAN -e shell install Tk::RotCanvas
For more information on module installation, please visit the detailed CPAN module installation guide.