.\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.35)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is >0, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{\
. if \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{\
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff
.if n \{\
. ds #H 0
. ds #V .8m
. ds #F .3m
. ds #[ \f1
. ds #] \fP
.\}
.if t \{\
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
. ds #V .6m
. ds #F 0
. ds #[ \&
. ds #] \&
.\}
. \" simple accents for nroff and troff
.if n \{\
. ds ' \&
. ds ` \&
. ds ^ \&
. ds , \&
. ds ~ ~
. ds /
.\}
.if t \{\
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
. \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
. \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
. \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
. ds : e
. ds 8 ss
. ds o a
. ds d- d\h'-1'\(ga
. ds D- D\h'-1'\(hy
. ds th \o'bp'
. ds Th \o'LP'
. ds ae ae
. ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "Tk::Canvas::GradientColor 3"
.TH Tk::Canvas::GradientColor 3 "2022-02-23" "perl v5.26.3" "User Contributed Perl Documentation"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAME"
Tk::Canvas::GradientColor \- To create a Canvas widget with background gradient color.
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 3
\& #!/usr/bin/perl
\& use strict;
\& use warnings;
\&
\& use Tk;
\& use Tk::Canvas::GradientColor;
\&
\& my $mw = MainWindow\->new(
\& \-title => \*(AqTk::Canvas::GradientColor\*(Aq,
\& \-background => \*(Aqwhite\*(Aq,
\& );
\&
\& my $canvas = $mw\->GradientColor(
\& \-width => 400,
\& \-height => 400,
\& )\->pack(qw/ \-fill both \-expand 1 /);
\&
\& $mw\->update;
\& sleep 3;
\&
\& # Change color
\& $canvas\->set_gradientcolor(
\& \-start_color => \*(Aq#000000\*(Aq,
\& \-end_color => \*(Aq#00CDFF\*(Aq,
\& );
\&
\& $mw\->update;
\& sleep 3;
\&
\& # Change type
\& $canvas\->set_gradientcolor(
\& \-start => 50,
\& \-end => 100,
\& \-type => \*(Aqmirror_vertical\*(Aq
\& );
\&
\& MainLoop();
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
Tk::Canvas::GradientColor is an extension of the Canvas widget. It is an easy way to build a
canvas widget with gradient background color.
.SH "STANDARD OPTIONS"
.IX Header "STANDARD OPTIONS"
\&\fB\-background\fR \fB\-borderwidth\fR \fB\-closeenough\fR \fB\-confine\fR
\&\fB\-cursor\fR \fB\-height\fR \fB\-highlightbackground\fR \fB\-highlightcolor\fR
\&\fB\-highlightthickness\fR \fB\-insertbackground\fR \fB\-insertborderwidth\fR \fB\-insertofftime\fR
\&\fB\-insertontime\fR \fB\-insertwidth\fR \fB\-relief\fR \fB\-scrollregion\fR
\&\fB\-selectbackground\fR \fB\-selectborderwidth\fR \fB\-selectforeground\fR \fB\-takefocus\fR
\&\fB\-width\fR \fB\-xscrollcommand\fR \fB\-xscrollincrement\fR \fB\-yscrollcommand\fR
\&\fB\-yscrollincrement\fR
.SH "WIDGET-SPECIFIC METHODS"
.IX Header "WIDGET-SPECIFIC METHODS"
The Canvas method creates a widget object. This object supports the
configure and cget methods described in Tk::options which can be used
to enquire and modify the options described above.
.SS "disabled_gradientcolor"
.IX Subsection "disabled_gradientcolor"
.IP "\fI\f(CI$canvas_bg\fI\fR\->\fBdisabled_gradientcolor\fR" 4
.IX Item "$canvas_bg->disabled_gradientcolor"
Disabled background gradient color. The canvas widget will have the background color set by \fI\-background\fR option.
.Sp
.Vb 1
\& $canvas_bg\->disabled_gradientcolor;
.Ve
.SS "enabled_gradientcolor"
.IX Subsection "enabled_gradientcolor"
.IP "\fI\f(CI$canvas_bg\fI\fR\->\fBenabled_gradientcolor\fR" 4
.IX Item "$canvas_bg->enabled_gradientcolor"
Enabled background gradient color. Background gradient color is activated by default. Use this method if
\&\fIdisabled_gradientcolor\fR method is called.
.Sp
.Vb 1
\& $canvas_bg\->enabled_gradientcolor;
.Ve
.SS "get_gradientcolor"
.IX Subsection "get_gradientcolor"
.IP "\fI\f(CI$canvas_bg\fI\fR\->\fBget_gradientcolor\fR" 4
.IX Item "$canvas_bg->get_gradientcolor"
Return a hash reference which contains the options to create the background gradient color.
.Sp
.Vb 1
\& my $ref_gradient_options = $canvas_bg\->get_gradientcolor;
.Ve
.SS "set_gradientcolor"
.IX Subsection "set_gradientcolor"
.IP "\fI\f(CI$canvas_bg\fI\fR\->\fBset_gradientcolor\fR(?options)" 4
.IX Item "$canvas_bg->set_gradientcolor(?options)"
.PD 0
.IP "\(bu" 8
.PD
\&\fI\-type\fR
.Sp
8 types are available : linear_horizontal, linear_vertical, mirror_horizontal, mirror_vertical, radial, losange, corner_right and corner_left.
.Sp
.Vb 1
\& \-type => \*(Aqcorner_left\*(Aq,
.Ve
.Sp
Default : \fBlinear_horizontal\fR
.IP "\(bu" 8
\&\fI\-start_color\fR
.Sp
First color of gradient color.
.Sp
.Vb 1
\& \-start_color => \*(Aqred\*(Aq,
.Ve
.Sp
Default : \fB#8BC2F5\fR
.IP "\(bu" 8
\&\fI\-end_color\fR
.Sp
Last color of gradient color.
.Sp
.Vb 1
\& \-end_color => \*(Aq#FFCD9F\*(Aq,
.Ve
.Sp
Default : \fBwhite\fR
.IP "\(bu" 8
\&\fI\-start\fR
.Sp
.Vb 1
\& \-start => 50, # Must be >= 0, <= 100 and start < end
.Ve
.Sp
Use it for linear_horizontal and linear_vertical type. The first color starts at 'start' percent width of canvas.
The easy way to understand is to test the example in this documentation.
.Sp
Ex : width canvas = 1000px, start = 50 : the first part of canvas has the background color of start_color
and the gradient color start at 500px.
.Sp
Default : \fB0\fR
.Sp
Use it for mirror_horizontal and mirror_vertical type. The first color starts at 'start' percent width of canvas.
The easy way to understand is to test the example in this documentation.
.Sp
Ex : width canvas = 1000px, start = 50 : the background gradient color begins at 50 percent in two directions.
.Sp
Default : \fB50\fR
.IP "\(bu" 8
\&\fI\-end\fR
.Sp
.Vb 1
\& \-end => 80, # Must be >= 0, <= 100 and end > start
.Ve
.Sp
Use it for linear_horizontal and linear_vertical type. The last color finishes at 'end' percent width of canvas. The
easy way to understand is to test the example in this documentation.
.Sp
Default : \fB100\fR
.Sp
Use it for mirror_horizontal and mirror_vertical type. The last color finishes at 'end' percent width of canvas and opposite.
The easy way to understand is to test the example in this documentation.
.Sp
Default : \fB100\fR
.IP "\(bu" 8
\&\fI\-number_color\fR
.Sp
Number of colors between first and last color to create the gradient.
.Sp
.Vb 1
\& \-number_color => 200,
.Ve
.Sp
Default : \fB100\fR
.SS "rgb_to_hex"
.IX Subsection "rgb_to_hex"
.IP "\fI\f(CI$canvas_bg\fI\fR\->\fBrgb_to_hex\fR(\fI\f(CI$red\fI, \f(CI$green\fI, \f(CI$blue\fI\fR)" 4
.IX Item "$canvas_bg->rgb_to_hex($red, $green, $blue)"
Return hexa code of rgb color.
.Sp
.Vb 1
\& my $color = $canvas_bg\->rgb_to_hex(200, 102, 65); # return #C86641
.Ve
.SS "hex_to_rgb"
.IX Subsection "hex_to_rgb"
.IP "\fI\f(CI$canvas_bg\fI\fR\->\fBhex_to_rgb\fR(\fIstring\fR)" 4
.IX Item "$canvas_bg->hex_to_rgb(string)"
Return an array with red, green an blue code rgb color.
.Sp
.Vb 2
\& my ( $red, $green, $blue ) = $canvas_bg\->hex_to_rgb(\*(Aq#C86641\*(Aq); # return 200, 102, 65
\& my ( $red, $green, $blue ) = $canvas_bg\->hex_to_rgb(\*(Aqgray\*(Aq); # return 190, 190, 190
.Ve
.SH "EXAMPLES"
.IX Header "EXAMPLES"
An example to test the configuration of the widget:
.PP
.Vb 3
\& #!/usr/bin/perl
\& use strict;
\& use warnings;
\&
\& use Tk;
\& use Tk::Canvas::GradientColor;
\& use Tk::BrowseEntry;
\&
\& my $mw = MainWindow\->new(
\& \-title => \*(Aqgradient color with canvas\*(Aq,
\& \-background => \*(Aqsnow\*(Aq,
\& );
\&
\& my $canvas = $mw\->GradientColor(
\& \-background => \*(Aq#005500\*(Aq,
\& \-width => 500,
\& \-height => 500,
\& )\->pack(qw/ \-fill both \-expand 1 /);
\&
\& my %arg_gradient = (
\& \-type => undef,
\& \-start_color => \*(Aq#A780C1\*(Aq,
\& \-end_color => \*(Aqwhite\*(Aq,
\& \-start => undef,
\& \-end => undef,
\& \-number_color => undef,
\& );
\&
\& # configure start color
\& my $bouton_color1 = $canvas\->Button(
\& \-text => \*(Aqselect color start\*(Aq,
\& \-command => sub {
\& $arg_gradient{\-start_color} = $canvas\->chooseColor( \-title => \*(Aqselect color start\*(Aq );
\& $canvas\->set_gradientcolor(%arg_gradient);
\& },
\& );
\&
\& # configure end color
\& my $bouton_color2 = $canvas\->Button(
\& \-text => \*(Aqselect color end\*(Aq,
\& \-command => sub {
\& $arg_gradient{\-end_color} = $canvas\->chooseColor( \-title => \*(Aqselect color end\*(Aq );
\& $canvas\->set_gradientcolor(%arg_gradient);
\& },
\& );
\&
\& my $type = $canvas\->BrowseEntry(
\& \-label => \*(AqType gradient color\*(Aq,
\& \-choices => [
\& qw/ linear_horizontal linear_vertical mirror_horizontal mirror_vertical radial losange corner_right corner_left/
\& ],
\& \-background => \*(Aqwhite\*(Aq,
\& \-state => \*(Aqreadonly\*(Aq,
\& \-disabledbackground => \*(Aqyellow\*(Aq,
\& \-browsecmd => sub {
\& my ( $widget, $selection ) = @_;
\& $arg_gradient{\-type} = $selection;
\& $canvas\->set_gradientcolor(%arg_gradient);
\& },
\& );
\&
\& my $start_num = $canvas\->Scale(
\& \-background => \*(Aqwhite\*(Aq,
\& \-label => \*(AqStart\*(Aq,
\& \-from => 0,
\& \-to => 100,
\& \-variable => 0,
\& \-orient => \*(Aqhorizontal\*(Aq,
\& \-sliderlength => 10,
\& \-command => sub {
\& my $selection = shift;
\& $arg_gradient{\-start} = $selection;
\& $canvas\->set_gradientcolor(%arg_gradient);
\& },
\& );
\&
\& my $end_num = $canvas\->Scale(
\& \-background => \*(Aqwhite\*(Aq,
\& \-label => \*(AqEnd\*(Aq,
\& \-from => 0,
\& \-to => 100,
\& \-variable => \*(Aq100\*(Aq,
\& \-orient => \*(Aqhorizontal\*(Aq,
\& \-sliderlength => 10,
\& \-command => sub {
\& my $selection = shift;
\& $arg_gradient{\-end} = $selection;
\& $canvas\->set_gradientcolor(%arg_gradient);
\& },
\& );
\& my $num = 100;
\& my $entry_number_color = $canvas\->BrowseEntry(
\& \-label => \*(AqNumber color\*(Aq,
\& \-choices => [qw/ 2 3 4 5 10 50 100 150 200 250 300 400 500 750 1000 1500 2000 2500/],
\& \-state => \*(Aqreadonly\*(Aq,
\& \-disabledbackground => \*(Aqyellow\*(Aq,
\& \-background => \*(Aqwhite\*(Aq,
\& \-variable => \e$num,
\& \-browsecmd => sub {
\& my ( $widget, $selection ) = @_;
\& $arg_gradient{\-number_color} = $selection;
\& $canvas\->set_gradientcolor(%arg_gradient);
\& },
\& );
\&
\& my $disabled_gradientcolor = $canvas\->Button(
\& \-text => \*(Aqdisabled_gradientcolor\*(Aq,
\& \-command => sub { $canvas\->disabled_gradientcolor; },
\& );
\& my $enabled_gradientcolor = $canvas\->Button(
\& \-text => \*(Aqenabled_gradientcolor\*(Aq,
\& \-command => sub { $canvas\->enabled_gradientcolor; },
\& );
\&
\& $canvas\->createWindow( 100, 100, \-window => $bouton_color1 );
\& $canvas\->createWindow( 400, 100, \-window => $bouton_color2 );
\& $canvas\->createWindow( 100, 150, \-window => $start_num );
\& $canvas\->createWindow( 100, 200, \-window => $end_num );
\& $canvas\->createWindow( 350, 150, \-window => $entry_number_color );
\& $canvas\->createWindow( 350, 200, \-window => $type );
\& $canvas\->createWindow( 100, 350, \-window => $disabled_gradientcolor );
\& $canvas\->createWindow( 400, 350, \-window => $enabled_gradientcolor );
\&
\& MainLoop;
.Ve
.SH "AUTHOR"
.IX Header "AUTHOR"
Djibril Ousmanou, \f(CW\*(C`<djibel at cpan.org>\*(C'\fR
.SH "BUGS"
.IX Header "BUGS"
Please report any bugs or feature requests to \f(CW\*(C`bug\-Tk\-Canvas\-GradientColor at rt.cpan.org\*(C'\fR, or through
the web interface at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Tk\-Canvas\-GradientColor>. I will be notified, and then you'll
automatically be notified of progress on your bug as I make changes.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
See Tk::Canvas for details of the standard options.
.SH "SUPPORT"
.IX Header "SUPPORT"
You can find documentation for this module with the perldoc command.
.PP
.Vb 1
\& perldoc Tk::Canvas::GradientColor
.Ve
.PP
You can also look for information at:
.IP "\(bu" 4
\&\s-1RT: CPAN\s0's request tracker
.Sp
<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Tk\-Canvas\-GradientColor>
.IP "\(bu" 4
AnnoCPAN: Annotated \s-1CPAN\s0 documentation
.Sp
<http://annocpan.org/dist/Tk\-Canvas\-GradientColor>
.IP "\(bu" 4
\&\s-1CPAN\s0 Ratings
.Sp
<http://cpanratings.perl.org/d/Tk\-Canvas\-GradientColor>
.IP "\(bu" 4
Search \s-1CPAN\s0
.Sp
<http://search.cpan.org/dist/Tk\-Canvas\-GradientColor/>
.SH "ACKNOWLEDGEMENTS"
.IX Header "ACKNOWLEDGEMENTS"
.SH "COPYRIGHT & LICENSE"
.IX Header "COPYRIGHT & LICENSE"
Copyright 2014 Djibril Ousmanou, all rights reserved.
.PP
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.