diff options
Diffstat (limited to 'Perl/demos')
-rw-r--r-- | Perl/demos/Tk/demos/zinc_lib/counter.pl | 22 |
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 |