aboutsummaryrefslogtreecommitdiff
path: root/Perl/demos/Tk/demos/zinc_lib/counter.pl
diff options
context:
space:
mode:
authormertz2003-07-08 13:21:20 +0000
committermertz2003-07-08 13:21:20 +0000
commit7ac8976b4cddf6ca773ab40ed4108417acc2f18a (patch)
tree76f9a4ac51605273b16d5c9c1e0200418c06b216 /Perl/demos/Tk/demos/zinc_lib/counter.pl
parent6a7ccb7fe33c23e765827604e735910bff4f6a29 (diff)
downloadtkzinc-7ac8976b4cddf6ca773ab40ed4108417acc2f18a.zip
tkzinc-7ac8976b4cddf6ca773ab40ed4108417acc2f18a.tar.gz
tkzinc-7ac8976b4cddf6ca773ab40ed4108417acc2f18a.tar.bz2
tkzinc-7ac8976b4cddf6ca773ab40ed4108417acc2f18a.tar.xz
slight modification to make the demo interesting even without
a gradient in the background
Diffstat (limited to 'Perl/demos/Tk/demos/zinc_lib/counter.pl')
-rw-r--r--Perl/demos/Tk/demos/zinc_lib/counter.pl22
1 files changed, 17 insertions, 5 deletions
diff --git a/Perl/demos/Tk/demos/zinc_lib/counter.pl b/Perl/demos/Tk/demos/zinc_lib/counter.pl
index 7c03047..5eded67 100644
--- a/Perl/demos/Tk/demos/zinc_lib/counter.pl
+++ b/Perl/demos/Tk/demos/zinc_lib/counter.pl
@@ -26,11 +26,20 @@ my $zinc = $mw->Zinc(-width => 700, -height => 400,
-render => 1,
)->pack;
-my $r = $zinc->add('rectangle', 1,
- [0,0,700,700],
- -filled => 1, -linewidth => 0,
- -fillcolor => "=axial 90 |red;40|green;40 50|blue;40"
- );
+if ($zinc->cget(-render)) {
+ $zinc->add('rectangle', 1,
+ [0,0,700,400],
+ -filled => 1, -linewidth => 0,
+ -fillcolor => "=axial 90 |red;40|green;40 50|blue;40"
+ );
+} else { ## no openGL rendering!
+ # creating a curve in the background to demonstrate the clipping
+ # of the hole in the counter
+ $zinc->add('curve', 1, [30,30, 350,150, 670,30, 400,200, 670,370, 350,250, 30,370, 300,200, 30,30],
+ -filled => 1,
+ -fillcolor => "tan",
+ );
+}
# The explanation displayed when running this demo
$zinc->add('text', 1,
@@ -253,6 +262,9 @@ my $fleche=$zinc-> add('curve', $group2, [$x0+40,$y0+40,$x1-100,$y1-25],
$zinc->itemconfigure($clipped_group2, -clip => $clipping_item2);
+# this translation if for having an "interesting" background in the counter hole
+# when we do not have openGL and a gradient in the background
+$zinc->translate($general_group,0,21);
###################################################
# Actions automatiques