aboutsummaryrefslogtreecommitdiff
path: root/sandbox/local.pl
blob: cabd58be64556b571c4f2543edc2e0e4ecf5dc29 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
#!/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 => 0,
		  -borderwidth => 5,
		  -highlightthickness => 5,
		  -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('rectangle', $gr1, [50, 50, 399, 399],
$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(260 230', 
#		    -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);

$rect2 = $zinc->add('rectangle', $view, [150, 50, 300, 300],
		    -visible => 1,
		    -linewidth => 0,
		    -tile => $logo,
		    -fillcolor => 'white:50',
		    -filled => 1);
$rect = $zinc->add('rectangle', $view, [100, 100, 200, 200],
		   -visible => 1,
		   -linewidth => 4,
		   -linealpha => 100,
#		   -fillcolor => 'pink:50',
		   -fillcolor => 'tan',
		   -relief => 'sunken',
		   -filled => 1
		   );

$mp = $zinc->add('curve', $view, [50, 150, 100, 250, 270, 170,
				  220, 100, 200, 100, 180, 0,
				  140, 140, 70, 0],
		 -visible => 1,
		 -composescale => 1,
		 -composerotation => 1,
		 -linewidth => 4,
		 -relief => 'sunken',
		 -closed => 1,
		 -joinstyle => 'round',
		 -linecolor => 'black',
		 -linealpha => 50,
		 -filled => 1,
		 -fillcolor => 'white|black[100 100',
#		 -fillcolor => 'white',
#		 -fillpattern => 'AlphaStipple8',
#		 -tile => $papier,
		 -marker => '',
		 -markercolor => 'red');
#$zinc->itemconfigure($gr1, -clip => $mp);

$mp2 = $zinc->add('curve', $view, [100, 450, 200, 450],
		  -linewidth => 10,
		  -closed => 0,
		  -joinstyle => 'round',
		  -linecolor => 'tan',
		  -linealpha => 50,
		  -filled => 1,
#		 -fillcolor => 'white|black(10 10',
		  -fillcolor => 'wheat',
#		 -fillpattern => 'AlphaStipple8',
#		 -tile => $papier,
		  -marker => '',
		  -markercolor => 'red');

$zinc->add('reticle', $view,
	   -visible => 0,
	   -position => [300, 300],
	   -firstradius => 60,
	   -stepsize => 30,
#	   -numcircles => 7,
	   -linecolor => 'gray30',
	   -brightlinecolor => 'gray100',
#	   -brightlinestyle => 'mixed'
	   );

$x = 100;
$y = 20;
for ($i = 0; $i < 100; $i++) {
    $x = $x+5;
    $y = $y+7;
    $zinc->add('text', $view,
	       -visible => 0,
	       -text => "BlaBla et tout et tout, bref...",
	       -position => [$x, $y], -anchor => 'nw',
	       -color => 'red', -alpha => 30);
}
$peng = $zinc->add('icon', $view,
		   -image => $penguin, -position => [300, 300],
		   -anchor => 'center',
		   -alpha => 50);

$fvwm = $zinc->add('icon', $top,
		   -mask => '@fvwm.xbm',
		   -position => [50, 20],
		   -anchor => 'center',
		   -color => 'orange',
		   -alpha => 100);

#$zinc->gname('white 0 80|black[0 0', 'cone');
$zinc->gname('white:50 0 80|black 30|white 100(0 0', 'oeil');
$zinc->gname('white:100|black:100(-20 -15', 'boule');
$zinc->gname('white:100|black:100(-15 -100', 'arrondi');
$zinc->gname('white:100|black:100/45', 'cyl');
$arc = $zinc->add('arc', $view, [-45, -45, 45, 45],
		  -visible => 1,
		  -fillcolor => 'boule',
		  -linewidth => 1,
		  -filled => 1,
		  -startangle => 0,
#		  -extent => 240,
		  -closed => 1,
#		  -tile => $logo,
		  -pieslice => 0
		  );
$zinc->add('rectangle', $view, [100, 100, 200, 200],
	   -fillcolor => 'cyl',
	   -linewidth => 1,
	   -filled => 1,
	   -visible => 0
	   );

$zinc->translate($arc, 125, 300);

#$arc2 = $zinc->add('arc', $view, [-65, -35, 65, 35],
#		  -fillcolor => 'black|white(0 0',
#		  -linewidth => 1,
#		  -filled => 1);
#$zinc->translate($arc2, 125, 55);
		  
#$zinc->raise($fvwm);

$tab = $zinc->add('tabular', $view, 10,
		  -position => [300, 300],
		  -labelformat => '100x50');
$zinc->itemconfigure($tab, 0,
		     -visible => 1,
#		     -image => $logo,
		     -text => 'blabla',
		     -font => "cenapii-digistrips-b12",
		     -border => ['contour'],
		     -bordercolor => 'black',
		     -filled => 1,
		     -tile => $papier,
		     -reliefthickness => 4,
		     -relief => 'sunken',
		     -backcolor => 'tan');
$zinc->raise($tab);

$zinc->translate($rect, -150, -150);
$zinc->rotate($rect, 35);
$zinc->translate($rect, 150, 150);

$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();