From c30424db45ba7bc0ff4a3bccbaae0ae0b02d289f Mon Sep 17 00:00:00 2001 From: mertz Date: Wed, 18 Jun 2003 13:28:03 +0000 Subject: adding parameters to the axial gradient to limit the span of the gradient --- Perl/demos/Tk/demos/zinc_lib/color-x.pl | 26 +++++++++++++++++++++++--- Perl/demos/Tk/demos/zinc_lib/color-y.pl | 29 +++++++++++++++++++++++++---- 2 files changed, 48 insertions(+), 7 deletions(-) (limited to 'Perl/demos/Tk') diff --git a/Perl/demos/Tk/demos/zinc_lib/color-x.pl b/Perl/demos/Tk/demos/zinc_lib/color-x.pl index 679f19e..d576102 100644 --- a/Perl/demos/Tk/demos/zinc_lib/color-x.pl +++ b/Perl/demos/Tk/demos/zinc_lib/color-x.pl @@ -15,16 +15,26 @@ my $zinc = $mw->Zinc(-width => 700, -height => 600, die "no openGL rendering on this X server" unless $zinc->cget(-render); -$zinc->add('rectangle', 1, [10,10, 690, 100], -fillcolor => "red | blue", -filled => 1); + +$zinc->add('rectangle', 1, [10,10, 690, 50], -fillcolor => "=axial 0 | red | blue", -filled => 1); $zinc->add('text', 1, -font => $defaultfont, - -text => "A variation from non transparent red to non transparent blue.\n", + -text => "A variation from non transparent red to non transparent blue.", -anchor => 'nw', -position => [20, 20]); -$zinc->add('rectangle', 1, [10,110, 690, 200], -fillcolor => "=axial 0 |red;40|blue;40", -filled => 1); +$zinc->add('rectangle', 1, [10,60, 690, 100], -fillcolor => "=axial -30 0 30 0 | red | blue", -filled => 1); + +$zinc->add('text', 1, + -font => $defaultfont, + -text => "The same with a reduced span.", + -anchor => 'nw', + -position => [20, 70]); + + +$zinc->add('rectangle', 1, [10,110, 690, 150], -fillcolor => "=axial 0 |red;40|blue;40", -filled => 1); $zinc->add('text', 1, -font => $defaultfont, @@ -32,6 +42,16 @@ $zinc->add('text', 1, -anchor => 'nw', -position => [20, 120]); + +$zinc->add('rectangle', 1, [10,160, 690, 200], -fillcolor => "=axial -30 0 30 0 |red;40|blue;40", -filled => 1); + +$zinc->add('text', 1, + -font => $defaultfont, + -text => "The same with a reduced span.", + -anchor => 'nw', + -position => [20, 170]); + + # we are using here the X explicit notation for rgb color # we could also have used CIE encoding. If interested, # please read the X man pages diff --git a/Perl/demos/Tk/demos/zinc_lib/color-y.pl b/Perl/demos/Tk/demos/zinc_lib/color-y.pl index b119d0a..c450c72 100644 --- a/Perl/demos/Tk/demos/zinc_lib/color-y.pl +++ b/Perl/demos/Tk/demos/zinc_lib/color-y.pl @@ -17,23 +17,43 @@ my $zinc = $mw->Zinc(-width => 700, -height => 600, die "no openGL rendering on this X server" unless $zinc->cget(-render); -$zinc->add('rectangle', 1, [10, 10, 690, 100], -fillcolor => "=axial 90 |red |blue", -filled => 1); +$zinc->add('rectangle', 1, [10, 10, 340, 100], -fillcolor => "=axial 90 |red |blue", -filled => 1); $zinc->add('text', 1, -font => $defaultfont, - -text => "A variation from non transparent red to non transparent blue.\n", + -text => "A variation from non transparent red\n to non transparent blue.", -anchor => 'nw', -position => [20, 20]); -$zinc->add('rectangle', 1, [10,110, 690, 200], -fillcolor => "=axial 90|red;40 |blue;40", -filled => 1); +$zinc->add('rectangle', 1, [360, 10, 690, 100], -fillcolor => "=axial 0 30 0 -30 |red |blue", -filled => 1); $zinc->add('text', 1, -font => $defaultfont, - -text => "A variation from 40%transparent red to 40% transparent blue.", + -text => "The same with a reduced span.", + -anchor => 'nw', + -position => [370, 20]); + + + +$zinc->add('rectangle', 1, [10,110, 330, 200], -fillcolor => "=axial 90|red;40 |blue;40", -filled => 1); + +$zinc->add('text', 1, + -font => $defaultfont, + -text => "A variation from 40%transparent red\nto 40% transparent blue.", -anchor => 'nw', -position => [20, 120]); + +$zinc->add('rectangle', 1, [360,110, 690, 200], -fillcolor => "=axial 0 30 0 -30|red;40 |blue;40", -filled => 1); + +$zinc->add('text', 1, + -font => $defaultfont, + -text => "The same with a reduced span.", + -anchor => 'nw', + -position => [370, 120]); + + $zinc->add('rectangle', 1, [10, 210, 690, 300], -fillcolor => "=axial 90 |red;40|green;40 50|blue;40", -filled => 1); $zinc->add('text', 1, @@ -43,6 +63,7 @@ $zinc->add('text', 1, -anchor => 'nw', -position => [20, 220]); + $zinc->add('text', 1, -font => $defaultfont, -text => "Two overlaping transparently colored rectangles on a white background", -- cgit v1.1