aboutsummaryrefslogtreecommitdiff
path: root/Perl/demos
diff options
context:
space:
mode:
Diffstat (limited to 'Perl/demos')
-rw-r--r--Perl/demos/Tk/demos/zinc_lib/tkZincLogo.pl32
1 files changed, 20 insertions, 12 deletions
diff --git a/Perl/demos/Tk/demos/zinc_lib/tkZincLogo.pl b/Perl/demos/Tk/demos/zinc_lib/tkZincLogo.pl
index 0102be3..47779c2 100644
--- a/Perl/demos/Tk/demos/zinc_lib/tkZincLogo.pl
+++ b/Perl/demos/Tk/demos/zinc_lib/tkZincLogo.pl
@@ -12,7 +12,7 @@ use LogoZinc; # this module implements a class which instances are Zinc logo!
my $defaultfont = '-adobe-helvetica-bold-r-normal-*-140-*-*-*-*-*-*';
my $mw = MainWindow->new();
my $text = $mw->Scrolled(qw/Text -relief sunken -borderwidth 2 -setgrid true
- -height 5 -scrollbars ''/);
+ -height 7 -scrollbars ''/);
$text->pack(qw/-expand yes -fill both/);
$text->insert('0.0',
@@ -20,7 +20,10 @@ $text->insert('0.0',
You can transform this logo with your mouse:
Drag-Button 1 for moving the logo,
Drag-Button 2 for zooming the logo,
- Drag-Button 3 for rotating the logo.');
+ Drag-Button 3 for rotating the logo,
+ Shift-Drag-Button 1 for modifying the logo transparency,
+ Shift-Drag-Button 2 for modifying the logo gradient.'
+ );
my $zinc = $mw->Zinc(-width => 350, -height => 250,
-render => 1,
@@ -51,12 +54,10 @@ $zinc->Tk::bind('<ButtonRelease-3>', [\&release]);
$zinc->Tk::bind('<Shift-ButtonPress-1>', [\&press, \&modifyAlpha]);
$zinc->Tk::bind('<Shift-ButtonRelease-1>', [\&release]);
-
+
$zinc->Tk::bind('<Shift-ButtonPress-2>', [\&press, \&modifyGradient]);
$zinc->Tk::bind('<Shift-ButtonRelease-2>', [\&release]);
-$zinc->Tk::bind('<Shift-ButtonPress-3>', [\&press, \&rotate]);
-$zinc->Tk::bind('<Shift-ButtonRelease-3>', [\&release]);
#
# Controls for the window transform.
@@ -75,20 +76,27 @@ sub modifyAlpha {
my ($zinc) = @_;
my $ev = $zinc->XEvent();
my $lx = $ev->x;
- my $ly = $ev->y;
- my @res;
-
my $xrate = $lx / $zinc->cget(-width);
- my $yrate = $ly / $zinc->cget(-height);
$xrate = 0 if $xrate < 0;
$xrate = 1 if $xrate > 1;
+
+ my $alpha = $xrate * 100;
+
+ $zinc->itemconfigure($group, -alpha => $alpha);
+}
+
+sub modifyGradient {
+ my ($zinc) = @_;
+ my $ev = $zinc->XEvent();
+ my $ly = $ev->y;
+ my $yrate = $ly / $zinc->cget(-height);
+
$yrate = 0 if $yrate < 0;
$yrate = 1 if $yrate > 1;
-
- my $alpha = $yrate * 100;
+ my $gradientpercent = sprintf ("%d", $yrate * 100);
- $zinc->itemconfigure($group, -alpha => $yrate * 100);
+ $zinc->itemconfigure ('letters', -fillcolor => "#ffffff:100 0 28|#66848c:100 $gradientpercent|#7192aa:100 100/270");
}