aboutsummaryrefslogtreecommitdiff
path: root/Perl/demos
diff options
context:
space:
mode:
authormertz2003-06-18 14:05:20 +0000
committermertz2003-06-18 14:05:20 +0000
commit5ae790348e37d2e01dc72cd5ebe937b7df0b7688 (patch)
tree217c2f5a700e9387cd2b95e0e39059442afc8f54 /Perl/demos
parentc30424db45ba7bc0ff4a3bccbaae0ae0b02d289f (diff)
downloadtkzinc-5ae790348e37d2e01dc72cd5ebe937b7df0b7688.zip
tkzinc-5ae790348e37d2e01dc72cd5ebe937b7df0b7688.tar.gz
tkzinc-5ae790348e37d2e01dc72cd5ebe937b7df0b7688.tar.bz2
tkzinc-5ae790348e37d2e01dc72cd5ebe937b7df0b7688.tar.xz
adding some conical and path gradients in the demos
Diffstat (limited to 'Perl/demos')
-rw-r--r--Perl/demos/Tk/demos/zinc_lib/color-path-and-conic.pl69
-rw-r--r--Perl/demos/zinc-demos3
2 files changed, 71 insertions, 1 deletions
diff --git a/Perl/demos/Tk/demos/zinc_lib/color-path-and-conic.pl b/Perl/demos/Tk/demos/zinc_lib/color-path-and-conic.pl
new file mode 100644
index 0000000..2755358
--- /dev/null
+++ b/Perl/demos/Tk/demos/zinc_lib/color-path-and-conic.pl
@@ -0,0 +1,69 @@
+#!/usr/bin/perl
+# $Id$
+# these simple samples have been developped by C. Mertz mertz@cena.fr
+
+use Tk;
+use Tk::Zinc;
+use strict;
+
+my $defaultfont = '-adobe-helvetica-bold-r-normal-*-120-*-*-*-*-*-*';
+my $mw = MainWindow->new();
+my $zinc = $mw->Zinc(-width => 700, -height => 600,
+ -borderwidth => 3, -relief => 'sunken',
+ -render => 1, # for activating the openGL render
+ )->pack;
+
+die "no openGL rendering on this X server" unless $zinc->cget(-render);
+
+
+$zinc->add('rectangle', 1, [10, 10, 80, 80], -fillcolor => "=path 0 0 |red |blue", -filled => 1);
+
+$zinc->add('text', 1,
+ -font => $defaultfont,
+ -text => "Path variation from non-transparent red to non-transparent blue\nin a squarre. The gradient start at the middle of the bbox.",
+ -anchor => 'nw',
+ -position => [120, 20]);
+
+$zinc->add('arc', 1, [10, 110, 90, 190], -fillcolor => "=conical 135 |black;40|white;40", -filled => 1);
+
+$zinc->add('text', 1,
+ -font => $defaultfont,
+ -text => "Conical variation from 40%transparent black to 40% transparent white\nin a disc, center in the middle of the bbox",
+ -anchor => 'nw',
+ -position => [120, 120]);
+
+
+$zinc->add('arc', 1, [10, 210, 90, 290], -fillcolor => "=path -30 +30 |red;40|green;40 50|blue;40", -filled => 1);
+
+$zinc->add('text', 1,
+ -font => $defaultfont,
+ -text => "A path variation from 40%transparent red to 40% transparent blue.\n".
+ "through a 40%green on the middle of the disc. The gradient center\nis toward the SW of the bbox.",
+ -anchor => 'nw',
+ -position => [120, 220]);
+
+
+
+$zinc->add('text', 1,
+ -font => $defaultfont,
+ -text => "overlaping path and conical, transparently colored items on a white background",
+ -anchor => 'nw',
+ -position => [20, 320]);
+
+$zinc->add('rectangle', 1, [10, 340, 690, 590], -fillcolor => "white", -filled => 1);
+
+$zinc->add('rectangle', 1, [20, 365, 220, 565], -fillcolor => "=path -40 -40 |red;40|green;40 50|blue;40", -filled => 1);
+
+$zinc->add('arc', 1, [150, 365, 350, 565], -fillcolor => "=conical 20 -30 45 |yellow;40|black;40 50|cyan;40", -filled => 1);
+
+$zinc->add('arc', 1, [320, 365, 480, 565], -fillcolor => "=path 0 0 |black;100|black;100 20|white;40", -filled => 1, -linewidth => 0);
+
+#$zinc->add('arc', 1, [480, 365, 580, 500], -fillcolor => "=radial -10 16 |black;100|white;40", -filled => 1);
+
+$zinc->add('arc', 1, [580, 410, 680, 580], -fillcolor => "=conical -40 -40 135 |black;70|white;20", -filled => 1);
+#$zinc->add('arc', 1, [580, 410, 680, 580], -fillcolor => "=radial 40 40 |black;70|white;20", -filled => 1);
+
+
+
+MainLoop;
+
diff --git a/Perl/demos/zinc-demos b/Perl/demos/zinc-demos
index a931d92..414a0a6 100644
--- a/Perl/demos/zinc-demos
+++ b/Perl/demos/zinc-demos
@@ -187,7 +187,8 @@ $T->insert('end', "1. The TkZinc Logo (requires openGL).\n", [qw/demo demo-tkZi
$T->insert('end', "2. Axial color variation on the X axis (requires openGL).\n", [qw/demo demo-color-x/]);
$T->insert('end', "3. Axial color variation on the Y axis (requires openGL).\n", [qw/demo demo-color-y/]);
$T->insert('end', "4. Circular color variation (requires openGL).\n", [qw/demo demo-color-circular/]);
-$T->insert('end', "5. The triangles item (requires openGL).\n", [qw/demo demo-triangles/]);
+$T->insert('end', "5. Path and Conical color variations (requires openGL).\n", [qw/demo demo-color-path-and-conic/]);
+$T->insert('end', "6. The triangles item (requires openGL).\n", [qw/demo demo-triangles/]);