Server IP : 103.119.228.120 / Your IP : 18.116.43.109 Web Server : Apache System : Linux v8.techscape8.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64 User : nobody ( 99) PHP Version : 5.6.40 Disable Function : shell_exec,symlink,system,exec,proc_get_status,proc_nice,proc_terminate,define_syslog_variables,syslog,openlog,closelog,escapeshellcmd,passthru,ocinum cols,ini_alter,leak,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dl,dll,myshellexec,proc_open,socket_bind,proc_close,escapeshellarg,parse_ini_filepopen,fpassthru,exec,passthru,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,popen,show_source,proc_nice,proc_terminate,proc_get_status,proc_close,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,dl,symlink,shell_exec,system,dl,passthru,escapeshellarg,escapeshellcmd,myshellexec,c99_buff_prepare,c99_sess_put,fpassthru,getdisfunc,fx29exec,fx29exec2,is_windows,disp_freespace,fx29sh_getupdate,fx29_buff_prepare,fx29_sess_put,fx29shexit,fx29fsearch,fx29ftpbrutecheck,fx29sh_tools,fx29sh_about,milw0rm,imagez,sh_name,myshellexec,checkproxyhost,dosyayicek,c99_buff_prepare,c99_sess_put,c99getsource,c99sh_getupdate,c99fsearch,c99shexit,view_perms,posix_getpwuid,posix_getgrgid,posix_kill,parse_perms,parsesort,view_perms_color,set_encoder_input,ls_setcheckboxall,ls_reverse_all,rsg_read,rsg_glob,selfURL,dispsecinfo,unix2DosTime,addFile,system,get_users,view_size,DirFiles,DirFilesWide,DirPrintHTMLHeaders,GetFilesTotal,GetTitles,GetTimeTotal,GetMatchesCount,GetFileMatchesCount,GetResultFiles,fs_copy_dir,fs_copy_obj,fs_move_dir,fs_move_obj,fs_rmdir,SearchText,getmicrotime MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/local/share/man/man3/ |
Upload File : |
.\" Automatically generated by Pod::Man 2.27 (Pod::Simple 3.28) .\" .\" 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 turned on, 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 "GD::Simple 3" .TH GD::Simple 3 "2016-08-24" "perl v5.16.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" GD::Simple \- Simplified interface to GD library .SH "SYNOPSIS" .IX Header "SYNOPSIS" For a nice tutorial on using this module, see Gabor Szabo's article at http://perlmaven.com/drawing\-images\-using\-gd\-simple. .PP .Vb 1 \& use GD::Simple; \& \& # create a new image \& $img = GD::Simple\->new(400,250); \& \& # draw a red rectangle with blue borders \& $img\->bgcolor(\*(Aqred\*(Aq); \& $img\->fgcolor(\*(Aqblue\*(Aq); \& $img\->rectangle(10,10,50,50); \& \& # draw an empty rectangle with green borders \& $img\->bgcolor(undef); \& $img\->fgcolor(\*(Aqgreen\*(Aq); \& $img\->rectangle(30,30,100,100); \& \& # move to (80,80) and draw a green line to (100,190) \& $img\->moveTo(80,80); \& $img\->lineTo(100,190); \& \& # draw a solid orange ellipse \& $img\->moveTo(110,100); \& $img\->bgcolor(\*(Aqorange\*(Aq); \& $img\->fgcolor(\*(Aqorange\*(Aq); \& $img\->ellipse(40,40); \& \& # draw a black filled arc \& $img\->moveTo(150,150); \& $img\->fgcolor(\*(Aqblack\*(Aq); \& $img\->arc(50,50,0,100,gdNoFill|gdEdged); \& \& # draw a string at (10,180) using the default \& # built\-in font \& $img\->moveTo(10,180); \& $img\->string(\*(AqThis is very simple\*(Aq); \& \& # draw a string at (280,210) using 20 point \& # times italic, angled upward 90 degrees \& $img\->moveTo(280,210); \& $img\->font(\*(AqTimes:italic\*(Aq); \& $img\->fontsize(20); \& $img\->angle(\-90); \& $img\->string(\*(AqThis is very fancy\*(Aq); \& \& # some turtle graphics \& $img\->moveTo(300,100); \& $img\->penSize(3,3); \& $img\->angle(0); \& $img\->line(20); # 20 pixels going to the right \& $img\->turn(30); # set turning angle to 30 degrees \& $img\->line(20); # 20 pixel line \& $img\->line(20); \& $img\->line(20); \& $img\->turn(\-90); # set turning angle to \-90 degrees \& $img\->line(50); # 50 pixel line \& \& # draw a cyan polygon edged in blue \& my $poly = new GD::Polygon; \& $poly\->addPt(150,100); \& $poly\->addPt(199,199); \& $poly\->addPt(100,199); \& $img\->bgcolor(\*(Aqcyan\*(Aq); \& $img\->fgcolor(\*(Aqblue\*(Aq); \& $img\->penSize(1,1); \& $img\->polygon($poly); \& \& # convert into png data \& print $img\->png; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" GD::Simple is a subclass of the \s-1GD\s0 library that shortens many of the long \s-1GD\s0 method calls by storing information about the pen color, size and position in the \s-1GD\s0 object itself. It also adds a small number of \&\*(L"turtle graphics\*(R" style calls for those who prefer to work in polar coordinates. In addition, the library allows you to use symbolic names for colors, such as \*(L"chartreuse\*(R", and will manage the colors for you. .SS "The Pen" .IX Subsection "The Pen" GD::Simple maintains a \*(L"pen\*(R" whose settings are used for line\- and shape-drawing operations. The pen has the following properties: .IP "fgcolor" 4 .IX Item "fgcolor" The pen foreground color is the color of lines and the borders of filled and unfilled shapes. .IP "bgcolor" 4 .IX Item "bgcolor" The pen background color is the color of the contents of filled shapes. .IP "pensize" 4 .IX Item "pensize" The pen size is the width of the pen. Larger sizes draw thicker lines. .IP "position" 4 .IX Item "position" The pen position is its current position on the canvas in (X,Y) coordinates. .IP "angle" 4 .IX Item "angle" When drawing in turtle mode, the pen angle determines the current direction of lines of relative length. .IP "turn" 4 .IX Item "turn" When drawing in turtle mode, the turn determines the clockwise or counterclockwise angle that the pen will turn before drawing the next line. .IP "font" 4 .IX Item "font" The font to use when drawing text. Both built-in bitmapped fonts and TrueType fonts are supported. .IP "fontsize" 4 .IX Item "fontsize" The size of the font to use when drawing with TrueType fonts. .PP One sets the position and properties of the pen and then draws. As the drawing progresses, the position of the pen is updated. .SS "Methods" .IX Subsection "Methods" GD::Simple introduces a number of new methods, a few of which have the same name as GD::Image methods, and hence change their behavior. In addition to these new methods, GD::Simple objects support all of the GD::Image methods. If you make a method call that isn't directly supported by GD::Simple, it refers the request to the underlying GD::Image object. Hence one can load a \s-1JPEG\s0 image into GD::Simple and declare it to be TrueColor by using this call, which is effectively inherited from GD::Image: .PP .Vb 1 \& my $img = GD::Simple\->newFromJpeg(\*(Aq./myimage.jpg\*(Aq,1); .Ve .PP The rest of this section describes GD::Simple\-specific methods. .ie n .IP "$img = GD::Simple\->new($x,$y [,$truecolor])" 4 .el .IP "\f(CW$img\fR = GD::Simple\->new($x,$y [,$truecolor])" 4 .IX Item "$img = GD::Simple->new($x,$y [,$truecolor])" .PD 0 .ie n .IP "$img = GD::Simple\->new($gd)" 4 .el .IP "\f(CW$img\fR = GD::Simple\->new($gd)" 4 .IX Item "$img = GD::Simple->new($gd)" .PD Create a new GD::Simple object. There are two forms of \fInew()\fR. In the first form, pass the width and height of the desired canvas, and optionally a boolean flag to request a truecolor image. In the second form, pass a previously-created GD::Image object. .IP "GD::Simple\->class('\s-1GD\s0');" 4 .IX Item "GD::Simple->class('GD');" .PD 0 .IP "GD::Simple\->class('\s-1GD::SVG\s0');" 4 .IX Item "GD::Simple->class('GD::SVG');" .PD Select whether \fInew()\fR should use \s-1GD\s0 or \s-1GD::SVG\s0 internally. Call GD::Simple\->class('\s-1GD::SVG\s0') before calling \fInew()\fR if you wish to generate \s-1SVG\s0 images. .Sp If future \s-1GD\s0 subclasses are created, this method will subport them. .ie n .IP "$img\->moveTo($x,$y)" 4 .el .IP "\f(CW$img\fR\->moveTo($x,$y)" 4 .IX Item "$img->moveTo($x,$y)" This call changes the position of the pen without drawing. It moves the pen to position ($x,$y) on the drawing canvas. .ie n .IP "$img\->move($dx,$dy)" 4 .el .IP "\f(CW$img\fR\->move($dx,$dy)" 4 .IX Item "$img->move($dx,$dy)" .PD 0 .ie n .IP "$img\->move($dr)" 4 .el .IP "\f(CW$img\fR\->move($dr)" 4 .IX Item "$img->move($dr)" .PD This call changes the position of the pen without drawing. When called with two arguments it moves the pen \f(CW$dx\fR pixels to the right and \f(CW$dy\fR pixels downward. When called with one argument it moves the pen \f(CW$dr\fR pixels along the vector described by the current pen angle. .ie n .IP "$img\->lineTo($x,$y)" 4 .el .IP "\f(CW$img\fR\->lineTo($x,$y)" 4 .IX Item "$img->lineTo($x,$y)" The \fIlineTo()\fR call simultaneously draws and moves the pen. It draws a line from the current pen position to the position defined by ($x,$y) using the current pen size and color. After drawing, the position of the pen is updated to the new position. .ie n .IP "$img\->line($x1,$y1,$x2,$y2 [,$color])" 4 .el .IP "\f(CW$img\fR\->line($x1,$y1,$x2,$y2 [,$color])" 4 .IX Item "$img->line($x1,$y1,$x2,$y2 [,$color])" .PD 0 .ie n .IP "$img\->line($dx,$dy)" 4 .el .IP "\f(CW$img\fR\->line($dx,$dy)" 4 .IX Item "$img->line($dx,$dy)" .ie n .IP "$img\->line($dr)" 4 .el .IP "\f(CW$img\fR\->line($dr)" 4 .IX Item "$img->line($dr)" .PD The \fIline()\fR call simultaneously draws and moves the pen. When called with two arguments it draws a line from the current position of the pen to the position \f(CW$dx\fR pixels to the right and \f(CW$dy\fR pixels down. When called with one argument, it draws a line \f(CW$dr\fR pixels long along the angle defined by the current pen angle. .Sp When called with four or five arguments, \fIline()\fR behaves like GD::Image\->\fIline()\fR. .ie n .IP "$img\->clear" 4 .el .IP "\f(CW$img\fR\->clear" 4 .IX Item "$img->clear" This method clears the canvas by painting over it with the current background color. .ie n .IP "$img\->rectangle($x1,$y1,$x2,$y2)" 4 .el .IP "\f(CW$img\fR\->rectangle($x1,$y1,$x2,$y2)" 4 .IX Item "$img->rectangle($x1,$y1,$x2,$y2)" This method draws the rectangle defined by corners ($x1,$y1), ($x2,$y2). The rectangle's edges are drawn in the foreground color and its contents are filled with the background color. To draw a solid rectangle set bgcolor equal to fgcolor. To draw an unfilled rectangle (transparent inside), set bgcolor to undef. .ie n .IP "$img\->ellipse($width,$height)" 4 .el .IP "\f(CW$img\fR\->ellipse($width,$height)" 4 .IX Item "$img->ellipse($width,$height)" This method draws the ellipse centered at the current location with width \f(CW$width\fR and height \f(CW$height\fR. The ellipse's border is drawn in the foreground color and its contents are filled with the background color. To draw a solid ellipse set bgcolor equal to fgcolor. To draw an unfilled ellipse (transparent inside), set bgcolor to undef. .ie n .IP "$img\->arc($cx,$cy,$width,$height,$start,$end [,$style])" 4 .el .IP "\f(CW$img\fR\->arc($cx,$cy,$width,$height,$start,$end [,$style])" 4 .IX Item "$img->arc($cx,$cy,$width,$height,$start,$end [,$style])" This method draws filled and unfilled arcs. See \s-1GD\s0 for a description of the arguments. To draw a solid arc (such as a pie wedge) set bgcolor equal to fgcolor. To draw an unfilled arc, set bgcolor to undef. .ie n .IP "$img\->polygon($poly)" 4 .el .IP "\f(CW$img\fR\->polygon($poly)" 4 .IX Item "$img->polygon($poly)" This method draws filled and unfilled polygon using the current settings of fgcolor for the polygon border and bgcolor for the polygon fill color. See \s-1GD\s0 for a description of creating polygons. To draw a solid polygon set bgcolor equal to fgcolor. To draw an unfilled polygon, set bgcolor to undef. .ie n .IP "$img\->polyline($poly)" 4 .el .IP "\f(CW$img\fR\->polyline($poly)" 4 .IX Item "$img->polyline($poly)" This method draws polygons without closing the first and last vertices (similar to GD::Image\->\fIunclosedPolygon()\fR). It uses the fgcolor to draw the line. .ie n .IP "$img\->string($string)" 4 .el .IP "\f(CW$img\fR\->string($string)" 4 .IX Item "$img->string($string)" This method draws the indicated string starting at the current position of the pen. The pen is moved to the end of the drawn string. Depending on the font selected with the \fIfont()\fR method, this will use either a bitmapped \s-1GD\s0 font or a TrueType font. The angle of the pen will be consulted when drawing the text. For TrueType fonts, any angle is accepted. For \s-1GD\s0 bitmapped fonts, the angle can be either 0 (draw horizontal) or \-90 (draw upwards). .Sp For consistency between the TrueType and \s-1GD\s0 font behavior, the string is always drawn so that the current position of the pen corresponds to the bottom left of the first character of the text. This is different from the \s-1GD\s0 behavior, in which the first character of bitmapped fonts hangs down from the pen point. .Sp This method returns a polygon indicating the bounding box of the rendered text. If an error occurred (such as invalid font specification) it returns undef and an error message in $@. .ie n .IP "$metrics = $img\->fontMetrics" 4 .el .IP "\f(CW$metrics\fR = \f(CW$img\fR\->fontMetrics" 4 .IX Item "$metrics = $img->fontMetrics" .PD 0 .IP "($metrics,$width,$height) = GD::Simple\->fontMetrics($font,$fontsize,$string)" 4 .IX Item "($metrics,$width,$height) = GD::Simple->fontMetrics($font,$fontsize,$string)" .PD This method returns information about the current font, most commonly a TrueType font. It can be invoked as an instance method (on a previously-created GD::Simple object) or as a class method (on the \&'GD::Simple' class). .Sp When called as an instance method, \fIfontMetrics()\fR takes no arguments and returns a single hash reference containing the metrics that describe the currently selected font and size. The hash reference contains the following information: .Sp .Vb 2 \& xheight the base height of the font from the bottom to the top of \& a lowercase \*(Aqm\*(Aq \& \& ascent the length of the upper stem of the lowercase \*(Aqd\*(Aq \& \& descent the length of the lower step of the lowercase \*(Aqj\*(Aq \& \& lineheight the distance from the bottom of the \*(Aqj\*(Aq to the top of \& the \*(Aqd\*(Aq \& \& leading the distance between two adjacent lines .Ve .ie n .IP "($delta_x,$delta_y)= $img\->stringBounds($string)" 4 .el .IP "($delta_x,$delta_y)= \f(CW$img\fR\->stringBounds($string)" 4 .IX Item "($delta_x,$delta_y)= $img->stringBounds($string)" This method indicates the X and Y offsets (which may be negative) that will occur when the given string is drawn using the current font, fontsize and angle. When the string is drawn horizontally, it gives the width and height of the string's bounding box. .ie n .IP "$delta_x = $img\->stringWidth($string)" 4 .el .IP "\f(CW$delta_x\fR = \f(CW$img\fR\->stringWidth($string)" 4 .IX Item "$delta_x = $img->stringWidth($string)" This method indicates the width of the string given the current font, fontsize and angle. It is the same as ($img\->stringBounds($string))[0] .ie n .IP "($x,$y) = $img\->curPos" 4 .el .IP "($x,$y) = \f(CW$img\fR\->curPos" 4 .IX Item "($x,$y) = $img->curPos" Return the current position of the pen. Set the current position using \fImoveTo()\fR. .ie n .IP "$font = $img\->font([$newfont] [,$newsize])" 4 .el .IP "\f(CW$font\fR = \f(CW$img\fR\->font([$newfont] [,$newsize])" 4 .IX Item "$font = $img->font([$newfont] [,$newsize])" Get or set the current font. Fonts can be GD::Font objects, TrueType font file paths, or fontconfig font patterns like \*(L"Times:italic\*(R" (see fontconfig). The latter feature requires that you have the fontconfig library installed and are using libgd version 2.0.33 or higher. .Sp As a shortcut, you may pass two arguments to set the font and the fontsize simultaneously. The fontsize is only valid when drawing with TrueType fonts. .ie n .IP "$size = $img\->fontsize([$newfontsize])" 4 .el .IP "\f(CW$size\fR = \f(CW$img\fR\->fontsize([$newfontsize])" 4 .IX Item "$size = $img->fontsize([$newfontsize])" Get or set the current font size. This is only valid for TrueType fonts. .ie n .IP "$size = $img\->penSize([$newpensize])" 4 .el .IP "\f(CW$size\fR = \f(CW$img\fR\->penSize([$newpensize])" 4 .IX Item "$size = $img->penSize([$newpensize])" Get or set the current pen width for use during line drawing operations. .ie n .IP "$angle = $img\->angle([$newangle])" 4 .el .IP "\f(CW$angle\fR = \f(CW$img\fR\->angle([$newangle])" 4 .IX Item "$angle = $img->angle([$newangle])" Set the current angle for use when calling \fIline()\fR or \fImove()\fR with a single argument. .Sp Here is an example of using \fIturn()\fR and \fIangle()\fR together to draw an octagon. The first line drawn is the downward-slanting top right edge. The last line drawn is the horizontal top of the octagon. .Sp .Vb 4 \& $img\->moveTo(200,50); \& $img\->angle(0); \& $img\->turn(360/8); \& for (1..8) { $img\->line(50) } .Ve .ie n .IP "$angle = $img\->turn([$newangle])" 4 .el .IP "\f(CW$angle\fR = \f(CW$img\fR\->turn([$newangle])" 4 .IX Item "$angle = $img->turn([$newangle])" Get or set the current angle to turn prior to drawing lines. This value is only used when calling \fIline()\fR or \fImove()\fR with a single argument. The turning angle will be applied to each call to \fIline()\fR or \&\fImove()\fR just before the actual drawing occurs. .Sp Angles are in degrees. Positive values turn the angle clockwise. .ie n .IP "$color = $img\->fgcolor([$newcolor])" 4 .el .IP "\f(CW$color\fR = \f(CW$img\fR\->fgcolor([$newcolor])" 4 .IX Item "$color = $img->fgcolor([$newcolor])" Get or set the pen's foreground color. The current pen color can be set by (1) using an (r,g,b) triple; (2) using a previously-allocated color from the \s-1GD\s0 palette; or (3) by using a symbolic color name such as \*(L"chartreuse.\*(R" The list of color names can be obtained using \&\fIcolor_names()\fR. The special color name 'transparent' will create a completely transparent color. .ie n .IP "$color = $img\->bgcolor([$newcolor])" 4 .el .IP "\f(CW$color\fR = \f(CW$img\fR\->bgcolor([$newcolor])" 4 .IX Item "$color = $img->bgcolor([$newcolor])" Get or set the pen's background color. The current pen color can be set by (1) using an (r,g,b) triple; (2) using a previously-allocated color from the \s-1GD\s0 palette; or (3) by using a symbolic color name such as \*(L"chartreuse.\*(R" The list of color names can be obtained using \&\fIcolor_names()\fR. The special color name 'transparent' will create a completely transparent color. .ie n .IP "$index = $img\->translate_color(@args)" 4 .el .IP "\f(CW$index\fR = \f(CW$img\fR\->translate_color(@args)" 4 .IX Item "$index = $img->translate_color(@args)" Translates a color into a \s-1GD\s0 palette or TrueColor index. You may pass either an (r,g,b) triple or a symbolic color name. If you pass a previously-allocated index, the method will return it unchanged. .ie n .IP "$index = $img\->alphaColor(@args,$alpha)" 4 .el .IP "\f(CW$index\fR = \f(CW$img\fR\->alphaColor(@args,$alpha)" 4 .IX Item "$index = $img->alphaColor(@args,$alpha)" Creates an alpha color. You may pass either an (r,g,b) triple or a symbolic color name, followed by an integer indicating its opacity. The opacity value ranges from 0 (fully opaque) to 127 (fully transparent). .ie n .IP "@names = GD::Simple\->color_names" 4 .el .IP "\f(CW@names\fR = GD::Simple\->color_names" 4 .IX Item "@names = GD::Simple->color_names" .PD 0 .ie n .IP "$translate_table = GD::Simple\->color_names" 4 .el .IP "\f(CW$translate_table\fR = GD::Simple\->color_names" 4 .IX Item "$translate_table = GD::Simple->color_names" .PD Called in a list context, \fIcolor_names()\fR returns the list of symbolic color names recognized by this module. Called in a scalar context, the method returns a hash reference in which the keys are the color names and the values are array references containing [r,g,b] triples. .ie n .IP "$gd = $img\->gd" 4 .el .IP "\f(CW$gd\fR = \f(CW$img\fR\->gd" 4 .IX Item "$gd = $img->gd" Return the internal GD::Image object. Usually you will not need to call this since all \s-1GD\s0 methods are automatically referred to this object. .IP "($red,$green,$blue) = GD::Simple\->HSVtoRGB($hue,$saturation,$value)" 4 .IX Item "($red,$green,$blue) = GD::Simple->HSVtoRGB($hue,$saturation,$value)" Convert a Hue/Saturation/Value (\s-1HSV\s0) color into an \s-1RGB\s0 triple. The hue, saturation and value are integers from 0 to 255. .IP "($hue,$saturation,$value) = GD::Simple\->RGBtoHSV($hue,$saturation,$value)" 4 .IX Item "($hue,$saturation,$value) = GD::Simple->RGBtoHSV($hue,$saturation,$value)" Convert a Red/Green/Blue (\s-1RGB\s0) value into a Hue/Saturation/Value (\s-1HSV\s0) triple. The hue, saturation and value are integers from 0 to 255. .SH "COLORS" .IX Header "COLORS" This script will create an image showing all the symbolic colors. .PP .Vb 1 \& #!/usr/bin/perl \& \& use strict; \& use GD::Simple; \& \& my @color_names = GD::Simple\->color_names; \& my $cols = int(sqrt(@color_names)); \& my $rows = int(@color_names/$cols)+1; \& \& my $cell_width = 100; \& my $cell_height = 50; \& my $legend_height = 16; \& my $width = $cols * $cell_width; \& my $height = $rows * $cell_height; \& \& my $img = GD::Simple\->new($width,$height); \& $img\->font(gdSmallFont); \& \& for (my $c=0; $c<$cols; $c++) { \& for (my $r=0; $r<$rows; $r++) { \& my $color = $color_names[$c*$rows + $r] or next; \& my @topleft = ($c*$cell_width,$r*$cell_height); \& my @botright = ($topleft[0]+$cell_width,$topleft[1]+$cell_height\-$legend_height); \& $img\->bgcolor($color); \& $img\->fgcolor($color); \& $img\->rectangle(@topleft,@botright); \& $img\->moveTo($topleft[0]+2,$botright[1]+$legend_height\-2); \& $img\->fgcolor(\*(Aqblack\*(Aq); \& $img\->string($color); \& } \& } \& \& print $img\->png; .Ve .SH "AUTHOR" .IX Header "AUTHOR" The GD::Simple module is copyright 2004, Lincoln D. Stein. It is distributed under the same terms as Perl itself. See the \*(L"Artistic License\*(R" in the Perl source code distribution for licensing terms. .PP The latest versions of \s-1GD\s0.pm are available at https://github.com/lstein/Perl\-GD .SH "SEE ALSO" .IX Header "SEE ALSO" \&\s-1GD\s0, GD::Polyline, \&\s-1GD::SVG\s0, Image::Magick