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

NAME

6         Imager::Fill - general fill types
7

SYNOPSIS

9         my $fill1 = Imager::Fill->new(solid=>$color, combine=>$combine);
10         my $fill2 = Imager::Fill->new(hatch=>'vline2', fg=>$color1, bg=>$color2,
11                                       dx=>$dx, dy=>$dy);
12         my $fill3 = Imager::Fill->new(fountain=>$type, ...);
13         my $fill4 = Imager::Fill->new(image=>$img, ...);
14

DESCRIPTION

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

Common options

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

OTHER METHODS

148       Imager::Fill->hatches
149           A list of all defined hatch names.
150
151       Imager::Fill->combines
152           A list of all combine types.
153

FUTURE PLANS

155       I'm planning on adding the following types of fills:
156
157       checkerboard
158           combines 2 other fills in a checkerboard
159
160       combine
161           combines 2 other fills using the levels of an image
162
163       regmach
164           uses the transform2() register machine to create fills
165

AUTHOR

167       Tony Cook <tony@develop-help.com>
168

SEE ALSO

170       Imager(3)
171
172
173
174perl v5.8.8                       2008-03-28                   Imager::Fill(3)
Impressum