1Imager::Fill(3)       User Contributed Perl Documentation      Imager::Fill(3)
2
3
4

NAME

6         Imager::Fill - general fill types
7

SYNOPSIS

9         use Imager;
10         use Imager::Fill;
11
12         my $fill1 = Imager::Fill->new(solid=>$color, combine=>$combine);
13         my $fill2 = Imager::Fill->new(hatch=>'vline2', fg=>$color1, bg=>$color2,
14                                       dx=>$dx, dy=>$dy);
15         my $fill3 = Imager::Fill->new(fountain=>$type, ...);
16         my $fill4 = Imager::Fill->new(image=>$img, ...);
17         my $fill5 = Imager::Fill->new(type => "opacity", other => $fill,
18                                       opacity => ...);
19

DESCRIPTION

21       Creates fill objects for use by most filled area drawing functions.
22
23       All fills are created with the new method.
24
25       new
26             my $fill = Imager::Fill->new(...);
27
28           The parameters depend on the type of fill being created.  See below
29           for details.
30
31       The currently available fills are:
32
33       ·   solid
34
35       ·   hatch
36
37       ·   fountain (similar to gradients in paint software)
38

Common options

40       combine
41           The way in which the fill data is combined with the underlying
42           image.  See "Combine Types" in Imager::Draw.
43
44       In general colors can be specified as Imager::Color or
45       Imager::Color::Float objects.  The fill object will typically store
46       both types and convert from one to the other.  If a fill takes 2 color
47       objects they should have the same type.
48
49   Solid fills
50         my $fill = Imager::Fill->new(solid=>$color, $combine =>$combine)
51
52       Creates a solid fill, the only required parameter is "solid" which
53       should be the color to fill with.
54
55   Hatched fills
56         my $fill = Imager::Fill->new(hatch=>$type, fg=>$fgcolor, bg=>$bgcolor,
57                                      dx=>$dx, $dy=>$dy);
58
59       Creates a hatched fill.  You can specify the following keywords:
60
61       hatch
62           The type of hatch to perform, this can either be the numeric index
63           of the hatch (not recommended), the symbolic name of the hatch, or
64           an array of 8 integers which specify the pattern of the hatch.
65
66           Hatches are represented as cells 8x8 arrays of bits, which limits
67           their complexity.
68
69           Current hatch names are:
70
71           ·   "check1x1", "check2x2", "check4x4" - checkerboards at various
72               sizes
73
74           ·   "vline1", "vline2", "vline4" - 1, 2, or 4 vertical lines per
75               cell
76
77           ·   "hline1", "hline2", "hline4" - 1, 2, or 4 horizontal lines per
78               cell
79
80           ·   "slash1", "slash2" - 1 or 2 / lines per cell.
81
82           ·   "slosh1", "slosh2" - 1 or 2 \ lines per cell
83
84           ·   "grid1", "grid2", "grid4" - 1, 2, or 4 vertical and horizontal
85               lines per cell
86
87           ·   "dots1", "dots4", "dots16" - 1, 4 or 16 dots per cell
88
89           ·   "stipple", "stipple2" - see the samples
90
91           ·   "weave" - I hope this one is obvious.
92
93           ·   "cross1", "cross2" - 2 densities of crosshatch
94
95           ·   "vlozenge", "hlozenge" - something like lozenge tiles
96
97           ·   "scalesdown", "scalesup", "scalesleft", "scalesright" - Vaguely
98               like fish scales in each direction.
99
100           ·   "tile_L" - L-shaped tiles
101
102       *   "fg", "bg" - The "fg" color is rendered where bits are set in the
103           hatch, and the "bg" where they are clear.  If you use a transparent
104           "fg" or "bg", and set combine, you can overlay the hatch onto an
105           existing image.
106
107           "fg" defaults to black, "bg" to white.
108
109       *   "dx", "dy" - An offset into the hatch cell.  Both default to zero.
110
111       You can call Imager::Fill->hatches for a list of hatch names.
112
113   Fountain fills
114         my $fill = Imager::Fill->new(fountain=>$ftype,
115              xa=>$xa, ya=>$ya, xb=>$xb, yb=>$yb,
116              segments=>$segments, repeat=>$repeat, combine=>$combine,
117              super_sample=>$super_sample, ssample_param=>$ssample_param);
118
119       This fills the given region with a fountain fill.  This is exactly the
120       same fill as the "fountain" filter, but is restricted to the shape you
121       are drawing, and the fountain parameter supplies the fill type, and is
122       required.
123
124   Image Fills
125         my $fill = Imager::Fill->new(image=>$src, xoff=>$xoff, yoff=>$yoff,
126                                      matrix=>$matrix, $combine);
127
128       Fills the given image with a tiled version of the given image.  The
129       first non-zero value of "xoff" or "yoff" will provide an offset along
130       the given axis between rows or columns of tiles respectively.
131
132       The matrix parameter performs a co-ordinate transformation from the co-
133       ordinates in the target image to the fill image co-ordinates.  Linear
134       interpolation is used to determine the fill pixel.  You can use the
135       Imager::Matrix2d class to create transformation matrices.
136
137       The matrix parameter will significantly slow down the fill.
138
139   Opacity modification fill
140         my $fill = Imager::Fill->new(type => "opacity",
141             other => $fill, opacity => 0.25);
142
143       This can be used to make a fill that is a more translucent or opaque
144       version of an existing fill.  This is intended for use where you
145       receive a fill object as a parameter and need to change the opacity.
146
147       Parameters:
148
149       ·   type => "opacity" - Required
150
151       ·   other - the fill to produce a modified version of.  This must be an
152           Imager::Fill object.  Required.
153
154       ·   opacity - multiplier for the source fill opacity.  Default: 0.5.
155
156       The source fills combine mode is used.
157

OTHER METHODS

159       Imager::Fill->hatches
160           A list of all defined hatch names.
161
162       Imager::Fill->combines
163           A list of all combine types.
164

FUTURE PLANS

166       I'm planning on adding the following types of fills:
167
168       ·   "checkerboard" - combines 2 other fills in a checkerboard
169
170       ·   "combine" - combines 2 other fills using the levels of an image
171
172       ·   "regmach" - uses the transform2() register machine to create fills
173

AUTHOR

175       Tony Cook <tony@develop-help.com>
176

SEE ALSO

178       Imager(3)
179
180
181
182perl v5.12.3                      2011-06-06                   Imager::Fill(3)
Impressum