diff options
author | lecoanet | 2002-01-25 10:07:25 +0000 |
---|---|---|
committer | lecoanet | 2002-01-25 10:07:25 +0000 |
commit | 35c0ddffe17567ac70b1f19d38d5d9f9c557b1f5 (patch) | |
tree | 29af499c39941b2a3741cc44379891d45388596d /sandbox/triangles.pl | |
parent | d3df91149969d09b3a805a6468d85efcab77cc75 (diff) | |
download | tkzinc-35c0ddffe17567ac70b1f19d38d5d9f9c557b1f5.zip tkzinc-35c0ddffe17567ac70b1f19d38d5d9f9c557b1f5.tar.gz tkzinc-35c0ddffe17567ac70b1f19d38d5d9f9c557b1f5.tar.bz2 tkzinc-35c0ddffe17567ac70b1f19d38d5d9f9c557b1f5.tar.xz |
*** empty log message ***
Diffstat (limited to 'sandbox/triangles.pl')
-rw-r--r-- | sandbox/triangles.pl | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/sandbox/triangles.pl b/sandbox/triangles.pl new file mode 100644 index 0000000..84555b6 --- /dev/null +++ b/sandbox/triangles.pl @@ -0,0 +1,66 @@ +#!/usr/bin/perl -w + +use Tk; +use Tk::Zinc; +use Controls; +use Tk::Photo; +require Tk::PNG; + +$mw = MainWindow->new(); +$logo = $mw->Photo(-file => "logo.gif"); +$papier = $mw->Photo(-file => "texture-paper.xpm"); +$penguin = $mw->Photo(-format => 'png', + -file => "xpenguin.png"); + +$top = 1; +$zinc = $mw->Zinc(-render => 1, + -borderwidth => 0, + -highlightthickness => 0, + -relief => 'sunken', + -takefocus => 1, + -tile => $papier); +$zinc->pack(-expand => 1, -fill => 'both'); +$zinc->configure(-width => 500, -height => 500); +$gr1 = $zinc->add('group', $top); +$clip = $zinc->add('arc', $gr1, [50, 50, 399, 399], + -filled => 1, + -fillcolor => 'Pink:40', +# -fillpattern => 'AlphaStipple4', + -linewidth => 0); +#$zinc->itemconfigure($gr1, -clip => $clip); +$gr2 = $zinc->add('group', $gr1); +$clip2 = $zinc->add('rectangle', $gr2, [200, 200, 450, 300], + -filled => 1, +# -fillcolor => 'white:100|white:0', + -fillcolor => 'white:100 0|black:100 100/90', +# -fillcolor => 'white 0 |blue 20|blue 80|black:0 100/270', + -linewidth => 0); +#$zinc->itemconfigure($gr2, -clip => $clip2); +$view = $zinc->add('group', $gr2, -tags => "controls"); +$zinc->lower($clip); +$zinc->lower($clip2); + +new Controls($zinc); + +$cv2 = $zinc->add('curve', $view, [], + -linewidth => 2); +$cv3 = $zinc->add('curve', $view, [], + -linewidth => 2); + +$tri2 = $zinc->add('triangles', $view, [50, 50, 300, 50, 150, 150, 300, 150], + -colors => ['tan:50', '', '', 'red']); +$zinc->contour($cv2, 'union', $tri2); + +$tri3 = $zinc->add('triangles', $view, [150, 150, 50, 50, 150, 50, 300, 50], + -colors => ['grey50', 'blue', 'red', 'yellow'], + -fan => 1); +$zinc->contour($cv3, 'union', $tri3); +$zinc->translate($tri3, 0, 300); +$zinc->translate($cv3, 0, 300); + +$zinc->monitor(1); +$mw->Tk::bind('<p>', sub { print "perfs: ", join(',', $zinc->monitor()), "\n" }); +$mw->Tk::bind('<t>', sub { $zinc->remove($arc); }); +$mw->Tk::bind('<q>', sub { exit(0); }); +$zinc->focusFollowsMouse(); +MainLoop(); |