Tk::AbstractCanvas

Canvas with abstract center, zoom, and rotate methods
Download

Tk::AbstractCanvas Ranking & Summary

Advertisement

  • Rating:
  • License:
  • GPL
  • Price:
  • FREE
  • Publisher Name:
  • Pip Stuart
  • Publisher web site:
  • http://search.cpan.org/~pip/XML-Tidy-1.2.54HJnFa/Tidy.pm

Tk::AbstractCanvas Tags


Tk::AbstractCanvas Description

Canvas with abstract center, zoom, and rotate methods Tk::AbstractCanvas is a Tk canvas class with abstract center, zoom, and rotate methods.SYNOPSIS #!/usr/bin/perl -w use strict; use Tk; use Tk::AbstractCanvas; my $mwin = Tk::MainWindow->new(); my $acnv = $mwin->AbstractCanvas()->pack( '-expand' => 1, '-fill' => 'both'); #$acnv->invertY(1); # uncomment for inverted y-axis $acnv->controlNav(1); # super Control Navigation $acnv->rectToPoly(1); #$acnv->ovalToPoly(1); my $rect = $acnv->createRectangle( 7, 8, 24, 23, '-fill' => 'red'); my $oval = $acnv->createOval( 23, 24, 32, 27, '-fill' => 'green'); my $line = $acnv->createLine( 0, 1, 31, 32, '-fill' => 'blue', '-arrow' => 'last'); my $labl = $mwin->Label('-text' => 'Hello AbstractCanvas! =)'); my $wind = $acnv->createWindow(15, 16, '-window' => $labl); $acnv->CanvasBind('< Button-1 >' => sub { $acnv->zoom(1.04); } ); $acnv->CanvasBind('< Button-2 >' => sub { $acnv->rotate($rect, 5); $acnv->rotate($wind, 5); # should do nothing because can't $acnv->rotate($oval, -5); # rotate about center $acnv->rotate($line, -5); } ); $acnv->CanvasBind('< Button-3 >' => sub { $acnv->zoom(0.97); } ); $acnv->viewAll(); MainLoop();AbstractCanvas provides an alternative to a Tk::Canvas object which abstracts the coordinates of objects drawn onto the Canvas. This allows the entire Canvas to be zoomed or rotated. Rotations modify the coordinates that the original object was placed at but zooming the whole canvas does not.Tk::AbstractCanvas is derived from the excellent modules Tk::WorldCanvas by Joseph Skrovan (which was itself based on a version by Rudy Albachten) and Tk::RotCanvas by Ala Qumsieh. Requirements: · Perl


Tk::AbstractCanvas Related Software