.\" Automatically generated by Pod::Man 2.28 (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 "Imager::Fill 3pm" .TH Imager::Fill 3pm "2014-01-10" "perl v5.20.1" "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" .Vb 1 \& Imager::Fill \- general fill types .Ve .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& use Imager; \& use Imager::Fill; \& \& my $fill1 = Imager::Fill\->new(solid=>$color, combine=>$combine); \& my $fill2 = Imager::Fill\->new(hatch=>\*(Aqvline2\*(Aq, fg=>$color1, bg=>$color2, \& dx=>$dx, dy=>$dy); \& my $fill3 = Imager::Fill\->new(fountain=>$type, ...); \& my $fill4 = Imager::Fill\->new(image=>$img, ...); \& my $fill5 = Imager::Fill\->new(type => "opacity", other => $fill, \& opacity => ...); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Creates fill objects for use by most filled area drawing functions. .PP All fills are created with the new method. .IP "new" 4 .IX Item "new" .Vb 1 \& my $fill = Imager::Fill\->new(...); .Ve .Sp The parameters depend on the type of fill being created. See below for details. .PP The currently available fills are: .IP "\(bu" 4 solid .IP "\(bu" 4 hatch .IP "\(bu" 4 fountain (similar to gradients in paint software) .IP "\(bu" 4 image \- fill with an image, possibly transformed .IP "\(bu" 4 opacity \- a lower opacity version of some other fill .SH "Common options" .IX Header "Common options" .IP "combine" 4 .IX Item "combine" The way in which the fill data is combined with the underlying image. See \*(L"Combine Types\*(R" in Imager::Draw. .PP In general colors can be specified as Imager::Color or Imager::Color::Float objects. The fill object will typically store both types and convert from one to the other. If a fill takes 2 color objects they should have the same type. .SS "Solid fills" .IX Subsection "Solid fills" .Vb 1 \& my $fill = Imager::Fill\->new(solid=>$color, combine =>$combine) .Ve .PP Creates a solid fill, the only required parameter is \f(CW\*(C`solid\*(C'\fR which should be the color to fill with. .PP A translucent red fill: .PP .Vb 1 \& my $red = Imager::Fill\->new(solid => "FF000080", combine => "normal"); .Ve .SS "Hatched fills" .IX Subsection "Hatched fills" .Vb 2 \& my $fill = Imager::Fill\->new(hatch=>$type, fg=>$fgcolor, bg=>$bgcolor, \& dx=>$dx, $dy=>$dy); .Ve .PP Creates a hatched fill. You can specify the following keywords: .IP "\(bu" 4 \&\f(CW\*(C`hatch\*(C'\fR \- The type of hatch to perform, this can either be the numeric index of the hatch (not recommended), the symbolic name of the hatch, or an array of 8 integers which specify the pattern of the hatch. .Sp Hatches are represented as cells 8x8 arrays of bits, which limits their complexity. .Sp Current hatch names are: .RS 4 .IP "\(bu" 4 \&\f(CW\*(C`check1x1\*(C'\fR, \f(CW\*(C`check2x2\*(C'\fR, \f(CW\*(C`check4x4\*(C'\fR \- checkerboards at various sizes .IP "\(bu" 4 \&\f(CW\*(C`vline1\*(C'\fR, \f(CW\*(C`vline2\*(C'\fR, \f(CW\*(C`vline4\*(C'\fR \- 1, 2, or 4 vertical lines per cell .IP "\(bu" 4 \&\f(CW\*(C`hline1\*(C'\fR, \f(CW\*(C`hline2\*(C'\fR, \f(CW\*(C`hline4\*(C'\fR \- 1, 2, or 4 horizontal lines per cell .IP "\(bu" 4 \&\f(CW\*(C`slash1\*(C'\fR, \f(CW\*(C`slash2\*(C'\fR \- 1 or 2 / lines per cell. .IP "\(bu" 4 \&\f(CW\*(C`slosh1\*(C'\fR, \f(CW\*(C`slosh2\*(C'\fR \- 1 or 2 \e lines per cell .IP "\(bu" 4 \&\f(CW\*(C`grid1\*(C'\fR, \f(CW\*(C`grid2\*(C'\fR, \f(CW\*(C`grid4\*(C'\fR \- 1, 2, or 4 vertical and horizontal lines per cell .IP "\(bu" 4 \&\f(CW\*(C`dots1\*(C'\fR, \f(CW\*(C`dots4\*(C'\fR, \f(CW\*(C`dots16\*(C'\fR \- 1, 4 or 16 dots per cell .IP "\(bu" 4 \&\f(CW\*(C`stipple\*(C'\fR, \f(CW\*(C`stipple2\*(C'\fR \- see the samples .IP "\(bu" 4 \&\f(CW\*(C`weave\*(C'\fR \- I hope this one is obvious. .IP "\(bu" 4 \&\f(CW\*(C`cross1\*(C'\fR, \f(CW\*(C`cross2\*(C'\fR \- 2 densities of crosshatch .IP "\(bu" 4 \&\f(CW\*(C`vlozenge\*(C'\fR, \f(CW\*(C`hlozenge\*(C'\fR \- something like lozenge tiles .IP "\(bu" 4 \&\f(CW\*(C`scalesdown\*(C'\fR, \f(CW\*(C`scalesup\*(C'\fR, \f(CW\*(C`scalesleft\*(C'\fR, \f(CW\*(C`scalesright\*(C'\fR \- Vaguely like fish scales in each direction. .IP "\(bu" 4 \&\f(CW\*(C`tile_L\*(C'\fR \- L\-shaped tiles .RE .RS 4 .RE .IP "\(bu" 4 \&\f(CW\*(C`fg\*(C'\fR, \f(CW\*(C`bg\*(C'\fR \- The \f(CW\*(C`fg\*(C'\fR color is rendered where bits are set in the hatch, and the \f(CW\*(C`bg\*(C'\fR where they are clear. If you use a transparent \&\f(CW\*(C`fg\*(C'\fR or \f(CW\*(C`bg\*(C'\fR, and set combine, you can overlay the hatch onto an existing image. .Sp \&\f(CW\*(C`fg\*(C'\fR defaults to black, \f(CW\*(C`bg\*(C'\fR to white. .IP "\(bu" 4 \&\f(CW\*(C`dx\*(C'\fR, \f(CW\*(C`dy\*(C'\fR \- An offset into the hatch cell. Both default to zero. .PP A blue and white 4\-pixel check pattern: .PP .Vb 1 \& my $fill = Imager::Fill\->new(hatch => "check2x2", fg => "blue"); .Ve .PP You can call Imager::Fill\->hatches for a list of hatch names. .SS "Fountain fills" .IX Subsection "Fountain fills" .Vb 4 \& my $fill = Imager::Fill\->new(fountain=>$ftype, \& xa=>$xa, ya=>$ya, xb=>$xb, yb=>$yb, \& segments=>$segments, repeat=>$repeat, combine=>$combine, \& super_sample=>$super_sample, ssample_param=>$ssample_param); .Ve .PP This fills the given region with a fountain fill. This is exactly the same fill as the \f(CW\*(C`fountain\*(C'\fR filter, but is restricted to the shape you are drawing, and the fountain parameter supplies the fill type, and is required. .PP A radial fill from white to transparent centered on (50, 50) with a 50 pixel radius: .PP .Vb 6 \& use Imager::Fountain; \& my $segs = Imager::Fountain\->simple(colors => [ "FFFFFF", "FFFFFF00" ], \& positions => [ 0, 1 ]); \& my $fill = Imager::Fill\->new(fountain => "radial", segments => $segs, \& xa => 50, ya => 50, xb => 0, yb => 50, \& combine => "normal"); .Ve .SS "Image Fills" .IX Subsection "Image Fills" .Vb 2 \& my $fill = Imager::Fill\->new(image=>$src, xoff=>$xoff, yoff=>$yoff, \& matrix=>$matrix, combine => $combine); .Ve .PP Fills the given image with a tiled version of the given image. The first non-zero value of \f(CW\*(C`xoff\*(C'\fR or \f(CW\*(C`yoff\*(C'\fR will provide an offset along the given axis between rows or columns of tiles respectively. .PP The matrix parameter performs a co-ordinate transformation from the co-ordinates in the target image to the fill image co-ordinates. Linear interpolation is used to determine the fill pixel. You can use the Imager::Matrix2d class to create transformation matrices. .PP The matrix parameter will significantly slow down the fill. .PP .Vb 2 \& # some image to act as a texture \& my $txim = Imager\->new(...); \& \& # simple tiling \& my $fill = Imager::Fill\->new(image => $txim); \& \& # tile with a vertical offset \& my $fill = Imager::Fill\->new(image => $txim, yoff => 10); \& \& # tile with a horizontal offset \& my $fill = Imager::Fill\->new(image => $txim, xoff => 10); \& \& # rotated \& use Imager::Matrix2d; \& my $fill = Imager::Fill\->new(image => $txim, \& matrix => Imager::Matrix2d\->rotate(degrees => 20)); .Ve .SS "Opacity modification fill" .IX Subsection "Opacity modification fill" .Vb 2 \& my $fill = Imager::Fill\->new(type => "opacity", \& other => $fill, opacity => 0.25); .Ve .PP This can be used to make a fill that is a more translucent or opaque version of an existing fill. This is intended for use where you receive a fill object as a parameter and need to change the opacity. .PP Parameters: .IP "\(bu" 4 type => \*(L"opacity\*(R" \- Required .IP "\(bu" 4 other \- the fill to produce a modified version of. This must be an Imager::Fill object. Required. .IP "\(bu" 4 opacity \- multiplier for the source fill opacity. Default: 0.5. .PP The source fills combine mode is used. .PP .Vb 2 \& my $hatch = Imager::Fill\->new(hatch => "check4x4", combine => "normal"); \& my $fill = Imager::Fill\->new(type => "opacity", other => $hatch); .Ve .SH "OTHER METHODS" .IX Header "OTHER METHODS" .IP "Imager::Fill\->hatches" 4 .IX Item "Imager::Fill->hatches" A list of all defined hatch names. .IP "Imager::Fill\->combines" 4 .IX Item "Imager::Fill->combines" A list of all combine types. .SH "FUTURE PLANS" .IX Header "FUTURE PLANS" I'm planning on adding the following types of fills: .IP "\(bu" 4 \&\f(CW\*(C`checkerboard\*(C'\fR \- combines 2 other fills in a checkerboard .IP "\(bu" 4 \&\f(CW\*(C`combine\*(C'\fR \- combines 2 other fills using the levels of an image .IP "\(bu" 4 \&\f(CW\*(C`regmach\*(C'\fR \- uses the \fItransform2()\fR register machine to create fills .SH "AUTHOR" .IX Header "AUTHOR" Tony Cook .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fIImager\fR\|(3)