aboutsummaryrefslogtreecommitdiff
path: root/sandbox/testshape.pl
diff options
context:
space:
mode:
Diffstat (limited to 'sandbox/testshape.pl')
-rw-r--r--sandbox/testshape.pl46
1 files changed, 40 insertions, 6 deletions
diff --git a/sandbox/testshape.pl b/sandbox/testshape.pl
index a55de42..0d225cc 100644
--- a/sandbox/testshape.pl
+++ b/sandbox/testshape.pl
@@ -14,6 +14,13 @@ $zinc = $mw->Zinc(-render => 1,
$zinc->pack(-expand => 1, -fill => 'both');
$zinc->configure(-width => 500, -height => 500);
+$zinc->gname('white:40 0 60|black 50|white 100(0 0', 'oeil');
+$zinc->gname('white:0 0 10|black:100 100/0', 'oeil2');
+$zinc->gname('white:100|black:100(-35 -25', 'boule');
+$zinc->gname('white:100|black:100(-15 -100', 'arrondi');
+$zinc->gname('white:100|black:100/45', 'cyl');
+$zinc->gname('white|black[50 0', 'path');
+
# $arc = $zinc->add('arc', $top, [50, 50, 200, 100],
# -visible => 0);
#$zinc->itemconfigure($top, -clip => $arc);
@@ -26,11 +33,38 @@ $view = $zinc->add('group', $top, -tags => "controls");
# -closed => 1,
# -filled => 1);
-$arc = $zinc->add('arc', $view, [90,0, 160,50],
+$g1 = $zinc->add('group', $view);
+$zinc->translate($g1, 100, 300);
+$rect = $zinc->add('rectangle', $g1, [-40,-50, 40,50],
+ -filled => 1,
+ -fillcolor => 'path'
+ );
+$g2 = $zinc->add('group', $view);
+$zinc->translate($g2, 200, 300);
+$arc = $zinc->add('arc', $g2, [0,0, 100,100],
+ -filled => 1,
+ -linecolor => 'white',
+ -fillcolor => 'boule',
+ -startangle => 120,
+ -extent => 120,
+ -closed => 1,
+ -pieslice => 1,
+# -fillcolor => 'tan'
+ );
+$arc2 = $zinc->add('arc', $view, [90,0, 160,50],
+ -visible => 0,
+ -linewidth => 0,
+ -filled => 1,
+ -fillcolor => 'brown');
+$g3 = $zinc->add('group', $view);
+$zinc->translate($g3, 300, 300);
+$cv3 = $zinc->add('curve', $g3, [[-50, -40], [0, 0], [-50, 40], [50, 40], [50, -40]],
-visible => 0,
- -linewidth => 0,
-filled => 1,
- -fillcolor => 'brown');
+ -fillcolor => "#ffffff:100 0 28|#66848c:100 80|#7192aa:100 100/270"
+# -fillcolor => 'cyl'
+);
+
# $rect = $zinc->add('rectangle', $view, [200,230, 220,250],
# -visible => 1,
# -linewidth => 2,
@@ -48,7 +82,7 @@ $cv2 = $zinc->add('curve', $view, [],
-filled => 1);
$text = $zinc->add('text', $view,
-visible => 1,
- -text => 'Un Texte ICI',
+ -text => 'Un Texte ICI°°°°°',
-position => [200, 100],
-color => '#008000');
$zinc->contour($cv2, 'add', [[20, 20], [20, 100, 'c'], [120, 100], [120, 20]]);
@@ -58,7 +92,7 @@ $zinc->contour($cv2, 'addhole', [90, 70, 150, 70, 150, 150, 90, 150]);
$zinc->contour($cv2, 'add', [200, 200, 200, 220, 220, 220, 220, 200]);
$zinc->contour($cv2, 'addhole', [100, 10, 180, 10, 180, 60, 100, 60]);
-$zinc->contour($cv2, 'add', $arc);
+$zinc->contour($cv2, 'add', $arc2);
$zinc->contour($cv2, 'add', $text);
# $rect2 = $zinc->add('rectangle', $view, [40,81, 80,130],
@@ -82,8 +116,8 @@ $zinc->Tk::bind('<b>', sub {my ($x,$y,$c) = $zinc->coords($cv2, 0, 1);
$zinc->Tk::bind('<1>', sub {
my $ev = $zinc->XEvent();
my $it = $zinc->find('closest', $ev->x, $ev->y);
- my @t = $zinc->vertexat($it, $ev->x, $ev->y);
print "Closest: $it\n";
+ my @t = $zinc->vertexat($it, $ev->x, $ev->y);
print "VertexAt: ", join(', ', @t), "\n";
});