Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | .\" Automatically generated by Pod::Man v1.34, Pod::Parser v1.13 |
2 | .\" | |
3 | .\" Standard preamble: | |
4 | .\" ======================================================================== | |
5 | .de Sh \" Subsection heading | |
6 | .br | |
7 | .if t .Sp | |
8 | .ne 5 | |
9 | .PP | |
10 | \fB\\$1\fR | |
11 | .PP | |
12 | .. | |
13 | .de Sp \" Vertical space (when we can't use .PP) | |
14 | .if t .sp .5v | |
15 | .if n .sp | |
16 | .. | |
17 | .de Vb \" Begin verbatim text | |
18 | .ft CW | |
19 | .nf | |
20 | .ne \\$1 | |
21 | .. | |
22 | .de Ve \" End verbatim text | |
23 | .ft R | |
24 | .fi | |
25 | .. | |
26 | .\" Set up some character translations and predefined strings. \*(-- will | |
27 | .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left | |
28 | .\" double quote, and \*(R" will give a right double quote. | will give a | |
29 | .\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to | |
30 | .\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' | |
31 | .\" expand to `' in nroff, nothing in troff, for use with C<>. | |
32 | .tr \(*W-|\(bv\*(Tr | |
33 | .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' | |
34 | .ie n \{\ | |
35 | . ds -- \(*W- | |
36 | . ds PI pi | |
37 | . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch | |
38 | . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch | |
39 | . ds L" "" | |
40 | . ds R" "" | |
41 | . ds C` "" | |
42 | . ds C' "" | |
43 | 'br\} | |
44 | .el\{\ | |
45 | . ds -- \|\(em\| | |
46 | . ds PI \(*p | |
47 | . ds L" `` | |
48 | . ds R" '' | |
49 | 'br\} | |
50 | .\" | |
51 | .\" If the F register is turned on, we'll generate index entries on stderr for | |
52 | .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index | |
53 | .\" entries marked with X<> in POD. Of course, you'll have to process the | |
54 | .\" output yourself in some meaningful fashion. | |
55 | .if \nF \{\ | |
56 | . de IX | |
57 | . tm Index:\\$1\t\\n%\t"\\$2" | |
58 | .. | |
59 | . nr % 0 | |
60 | . rr F | |
61 | .\} | |
62 | .\" | |
63 | .\" For nroff, turn off justification. Always turn off hyphenation; it makes | |
64 | .\" way too many mistakes in technical documents. | |
65 | .hy 0 | |
66 | .if n .na | |
67 | .\" | |
68 | .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). | |
69 | .\" Fear. Run. Save yourself. No user-serviceable parts. | |
70 | . \" fudge factors for nroff and troff | |
71 | .if n \{\ | |
72 | . ds #H 0 | |
73 | . ds #V .8m | |
74 | . ds #F .3m | |
75 | . ds #[ \f1 | |
76 | . ds #] \fP | |
77 | .\} | |
78 | .if t \{\ | |
79 | . ds #H ((1u-(\\\\n(.fu%2u))*.13m) | |
80 | . ds #V .6m | |
81 | . ds #F 0 | |
82 | . ds #[ \& | |
83 | . ds #] \& | |
84 | .\} | |
85 | . \" simple accents for nroff and troff | |
86 | .if n \{\ | |
87 | . ds ' \& | |
88 | . ds ` \& | |
89 | . ds ^ \& | |
90 | . ds , \& | |
91 | . ds ~ ~ | |
92 | . ds / | |
93 | .\} | |
94 | .if t \{\ | |
95 | . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" | |
96 | . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' | |
97 | . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' | |
98 | . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' | |
99 | . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' | |
100 | . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' | |
101 | .\} | |
102 | . \" troff and (daisy-wheel) nroff accents | |
103 | .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' | |
104 | .ds 8 \h'\*(#H'\(*b\h'-\*(#H' | |
105 | .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] | |
106 | .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' | |
107 | .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' | |
108 | .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] | |
109 | .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] | |
110 | .ds ae a\h'-(\w'a'u*4/10)'e | |
111 | .ds Ae A\h'-(\w'A'u*4/10)'E | |
112 | . \" corrections for vroff | |
113 | .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' | |
114 | .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' | |
115 | . \" for low resolution devices (crt and lpr) | |
116 | .if \n(.H>23 .if \n(.V>19 \ | |
117 | \{\ | |
118 | . ds : e | |
119 | . ds 8 ss | |
120 | . ds o a | |
121 | . ds d- d\h'-1'\(ga | |
122 | . ds D- D\h'-1'\(hy | |
123 | . ds th \o'bp' | |
124 | . ds Th \o'LP' | |
125 | . ds ae ae | |
126 | . ds Ae AE | |
127 | .\} | |
128 | .rm #[ #] #H #V #F C | |
129 | .\" ======================================================================== | |
130 | .\" | |
131 | .IX Title "PHOTO 1" | |
132 | .TH PHOTO 1 "2000-12-30" "perl v5.8.0" "User Contributed Perl Documentation" | |
133 | .SH "NAME" | |
134 | Tk::Photo \- Full\-color images | |
135 | .SH "SYNOPSIS" | |
136 | .IX Header "SYNOPSIS" | |
137 | \&\ \fI$widget\fR\->\fBPhoto\fR(?\fIname\fR??, \fIoptions\fR?) | |
138 | .SH "DESCRIPTION" | |
139 | .IX Header "DESCRIPTION" | |
140 | A photo is an image whose pixels can display any color or be | |
141 | transparent. A photo image is stored internally in full color (32 | |
142 | bits per pixel), and is displayed using dithering if necessary. Image | |
143 | data for a photo image can be obtained from a file or a string, or it | |
144 | can be supplied from | |
145 | C code through a procedural interface. At present, only \s-1GIF\s0 and \s-1PPM/PGM\s0 | |
146 | formats are supported, but an interface exists to allow additional | |
147 | image file formats to be added easily. A photo image is transparent | |
148 | in regions where no image data has been supplied. | |
149 | .SH "CREATING PHOTOS" | |
150 | .IX Header "CREATING PHOTOS" | |
151 | Photos are created using the \fBPhoto\fR method. | |
152 | \&\fBPhoto\fR supports the following \fIoptions\fR: | |
153 | .IP "\fB\-data\fR => \fIstring\fR" 4 | |
154 | .IX Item "-data => string" | |
155 | Specifies the contents of the image as a string. The format of the | |
156 | string must be one of those for which there is an image file format | |
157 | handler that will accept string data. If both the \fB\-data\fR | |
158 | and \fB\-file\fR options are specified, the \fB\-file\fR option takes | |
159 | precedence. | |
160 | .IP "\fB\-format\fR => \fIformat-name\fR" 4 | |
161 | .IX Item "-format => format-name" | |
162 | Specifies the name of the file format for the data specified with the | |
163 | \&\fB\-data\fR or \fB\-file\fR option. | |
164 | .IP "\fB\-file\fR => \fIname\fR" 4 | |
165 | .IX Item "-file => name" | |
166 | \&\fIname\fR gives the name of a file that is to be read to supply data | |
167 | for the photo image. The file format must be one of those for which | |
168 | there is an image file format handler that can read data. | |
169 | .IP "\fB\-gamma\fR => \fIvalue\fR" 4 | |
170 | .IX Item "-gamma => value" | |
171 | Specifies that the colors allocated for displaying this image in a | |
172 | window should be corrected for a non-linear display with the specified | |
173 | gamma exponent value. (The intensity produced by most | |
174 | \&\s-1CRT\s0 displays is a power function of the input value, to a good | |
175 | approximation; gamma is the exponent and is typically around 2). | |
176 | The value specified must be greater than zero. The default | |
177 | value is one (no correction). In general, values greater than one | |
178 | will make the image lighter, and values less than one will make it | |
179 | darker. | |
180 | .IP "\fB\-height\fR => \fInumber\fR" 4 | |
181 | .IX Item "-height => number" | |
182 | Specifies the height of the image, in pixels. This option is useful | |
183 | primarily in situations where the user wishes to build up the contents | |
184 | of the image piece by piece. A value of zero (the default) allows the | |
185 | image to expand or shrink vertically to fit the data stored in it. | |
186 | .IP "\fB\-palette\fR => \fIpalette-spec\fR" 4 | |
187 | .IX Item "-palette => palette-spec" | |
188 | Specifies the resolution of the color cube to be allocated for | |
189 | displaying this image, and thus the number of colors used from the | |
190 | colormaps of the windows where it is displayed. The | |
191 | \&\fIpalette-spec\fR string may be either a single decimal number, | |
192 | specifying the number of shades of gray to use, or three decimal | |
193 | numbers separated by slashes (/), specifying the number of shades of | |
194 | red, green and blue to use, respectively. If the first form (a single | |
195 | number) is used, the image will be displayed in monochrome (i.e., | |
196 | grayscale). | |
197 | .IP "\fB\-width\fR => \fInumber\fR" 4 | |
198 | .IX Item "-width => number" | |
199 | Specifies the width of the image, in pixels. This option is useful | |
200 | primarily in situations where the user wishes to build up the contents | |
201 | of the image piece by piece. A value of zero (the default) allows the | |
202 | image to expand or shrink horizontally to fit the data stored in it. | |
203 | .SH "IMAGE METHODS" | |
204 | .IX Header "IMAGE METHODS" | |
205 | When a photo image is created, Tk also creates a new object. | |
206 | This object supports the \fBconfigure\fR and \fBcget\fR methods | |
207 | described in Tk::options which can be used to enquire and | |
208 | modify the options described above. | |
209 | .PP | |
210 | Those options that write data to the image generally expand the size | |
211 | of the image, if necessary, to accommodate the data written to the | |
212 | image, unless the user has specified non-zero values for the | |
213 | \&\fB\-width\fR and/or \fB\-height\fR configuration options, in which | |
214 | case the width and/or height, respectively, of the image will not be | |
215 | changed. | |
216 | .PP | |
217 | The following addition methods are available for photo images: | |
218 | .IP "\fI$image\fR\->\fBblank\fR" 4 | |
219 | .IX Item "$image->blank" | |
220 | Blank the image; that is, set the entire image to have no data, so it | |
221 | will be displayed as transparent, and the background of whatever | |
222 | window it is displayed in will show through. | |
223 | .IP "\fI$image\fR\->\fBcopy\fR(\fIsourceImage\fR ?,\fIoption value(s) ...\fR?)" 4 | |
224 | .IX Item "$image->copy(sourceImage ?,option value(s) ...?)" | |
225 | Copies a region from the image called \fIsourceImage\fR (which must | |
226 | be a photo image) to the image called \fI$image\fR, possibly with | |
227 | pixel zooming and/or subsampling. If no options are specified, this | |
228 | method copies the whole of \fIsourceImage\fR into \fI$image\fR, | |
229 | starting at coordinates (0,0) in \fI$image\fR. The following | |
230 | options may be specified: | |
231 | .RS 4 | |
232 | .IP "\fB\-from\fR => \fIx1 y1 ?x2 y2?\fR" 8 | |
233 | .IX Item "-from => x1 y1 ?x2 y2?" | |
234 | Specifies a rectangular sub-region of the source image to be copied. | |
235 | (\fIx1,y1\fR) and (\fIx2,y2\fR) specify diagonally opposite corners of | |
236 | the rectangle. If \fIx2\fR and \fIy2\fR are not specified, the | |
237 | default value is the bottom-right corner of the source image. The | |
238 | pixels copied will include the left and top edges of the specified | |
239 | rectangle but not the bottom or right edges. If the \fB\-from\fR | |
240 | option is not given, the default is the whole source image. | |
241 | .IP "\fB\-to\fR => \fIx1 y1 ?x2 y2?\fR" 8 | |
242 | .IX Item "-to => x1 y1 ?x2 y2?" | |
243 | Specifies a rectangular sub-region of the destination image to be | |
244 | affected. (\fIx1,y1\fR) and (\fIx2,y2\fR) specify diagonally opposite | |
245 | corners of the rectangle. If \fIx2\fR and \fIy2\fR are not specified, | |
246 | the default value is (\fIx1,y1\fR) plus the size of the source | |
247 | region (after subsampling and zooming, if specified). If \fIx2\fR and | |
248 | \&\fIy2\fR are specified, the source region will be replicated if | |
249 | necessary to fill the destination region in a tiled fashion. | |
250 | .IP "\fB\-shrink\fR" 8 | |
251 | .IX Item "-shrink" | |
252 | Specifies that the size of the destination image should be reduced, if | |
253 | necessary, so that the region being copied into is at the bottom-right | |
254 | corner of the image. This option will not affect the width or height | |
255 | of the image if the user has specified a non-zero value for the | |
256 | \&\fB\-width\fR or \fB\-height\fR configuration option, respectively. | |
257 | .IP "\fB\-zoom\fR => \fIx y\fR" 8 | |
258 | .IX Item "-zoom => x y" | |
259 | Specifies that the source region should be magnified by a factor of | |
260 | \&\fIx\fR in the X direction and \fIy\fR in the Y direction. If \fIy\fR | |
261 | is not given, the default value is the same as \fIx\fR. With this | |
262 | option, each pixel in the source image will be expanded into a block | |
263 | of \fIx\fR x \fIy\fR pixels in the destination image, all the same | |
264 | color. \fIx\fR and \fIy\fR must be greater than 0. | |
265 | .IP "\fB\-subsample\fR => \fIx y\fR" 8 | |
266 | .IX Item "-subsample => x y" | |
267 | Specifies that the source image should be reduced in size by using | |
268 | only every \fIx\fRth pixel in the X direction and \fIy\fRth pixel in | |
269 | the Y direction. Negative values will cause the image to be flipped | |
270 | about the Y or X axes, respectively. If \fIy\fR is not given, the | |
271 | default value is the same as \fIx\fR. | |
272 | .RE | |
273 | .RS 4 | |
274 | .RE | |
275 | .IP "\fI$image\fR\->\fBdata\fR(?\fIoption value(s), ...\fR?)" 4 | |
276 | .IX Item "$image->data(?option value(s), ...?)" | |
277 | returns image data in the form of a string. | |
278 | The following options may be specified: | |
279 | .RS 4 | |
280 | .IP "\fB\-background\fR => \fI color\fR" 8 | |
281 | .IX Item "-background => color" | |
282 | If the color is specified, the data will not contain any transparency | |
283 | information. In all transparent pixels the color will be replaced by | |
284 | the specified color. | |
285 | .IP "\fB\-format\fR => \fIformat-name\fR" 8 | |
286 | .IX Item "-format => format-name" | |
287 | Specifies the name of the image file format handler to be used to | |
288 | convert the data. Specifically, this method searches | |
289 | for the first handler whose name matches a initial substring of | |
290 | \&\fIformat-name\fR and which has the capability to write an string. | |
291 | If this option is not given, the data is returned in the default | |
292 | format as accepted by \fI$image\fR\->\fBput\fR. | |
293 | .IP "\fB\-from\fR => \fIx1 y1 ?x2 y2?\fR" 8 | |
294 | .IX Item "-from => x1 y1 ?x2 y2?" | |
295 | Specifies a rectangular region of \fI$image\fR to be written to the | |
296 | string. If only \fIx1\fR and \fIy1\fR are specified, the region | |
297 | extends from \fI(x1,y1)\fR to the bottom-right corner of | |
298 | \&\fI$image\fR. If all four coordinates are given, they specify | |
299 | diagonally opposite corners of the rectangular region. The default, | |
300 | if this option is not given, is the whole image. | |
301 | .RE | |
302 | .RS 4 | |
303 | .RE | |
304 | .IP "\fB\-grayscale\fR" 4 | |
305 | .IX Item "-grayscale" | |
306 | If this options is specified, the data will not contain color | |
307 | information. All pixel data will be transformed into grayscale. | |
308 | .IP "\fI$image\fR\->\fBget\fR(\fIx,y\fR)" 4 | |
309 | .IX Item "$image->get(x,y)" | |
310 | Returns the color of the pixel at coordinates (\fIx\fR,\fIy\fR) in the | |
311 | image as a list of three integers between 0 and 255, representing the | |
312 | red, green and blue components respectively. | |
313 | .IP "\fI$image\fR\->\fBput\fR(\fIdata\fR ?,\fB\-format\fR=>\fIformat-name\fR? ?,\fB\-to\fR=>\fI x1 y1 ?x2 y2?\fR?)" 4 | |
314 | .IX Item "$image->put(data ?,-format=>format-name? ?,-to=> x1 y1 ?x2 y2??)" | |
315 | Sets pixels in \fI imageName\fR to the data specified in | |
316 | \&\fIdata\fR. This command first searches the list of image file | |
317 | format handlers for a handler that can interpret the data | |
318 | in \fIdata\fR, and then reads the image in \fIfilename\fR into | |
319 | \&\fIimageName\fR (the destination image). The following options | |
320 | may be specified: | |
321 | .RS 4 | |
322 | .IP "\fB\-format \fR\fIformat-name\fR" 4 | |
323 | .IX Item "-format format-name" | |
324 | Specifies the format of the image data in \fIdata\fR. | |
325 | Specifically, only image file format handlers whose names begin with | |
326 | \&\fIformat-name\fR will be used while searching for an image data | |
327 | format handler to read the data. Otherwise \fIdata\fR is used to form a two-dimensional array of pixels | |
328 | that are then copied into the \fI$image\fR. \fIdata\fR is structured | |
329 | then as a list of horizontal rows, from top to bottom, each of which is | |
330 | a list of colors, listed from left to right. Each color may be specified | |
331 | by name (e.g., blue) or in hexadecimal form (e.g., #2376af). | |
332 | .IP "\fB\-from \fR\fIx1 y1 x2 y2\fR" 4 | |
333 | .IX Item "-from x1 y1 x2 y2" | |
334 | Specifies a rectangular sub-region of the image file data to be | |
335 | returned. If only \fIx1\fR and \fIy1\fR are specified, the region | |
336 | extends from (\fIx1,y1\fR) to the bottom-right corner of the image | |
337 | in the image file. If all four coordinates are specified, they | |
338 | specify diagonally opposite corners or the region. The default, | |
339 | if this option is not specified, is the whole of the image. | |
340 | .IP "\fB\-shrink\fR" 4 | |
341 | .IX Item "-shrink" | |
342 | If this option, the size of \fIimageName\fR will be reduced, if | |
343 | necessary, so that the region into which the image file data are read | |
344 | is at the bottom-right corner of the \fIimageName\fR. This option | |
345 | will not affect the width or height of the image if the user has | |
346 | specified a non-zero value for the \fB\-width\fR or \fB\-height\fR | |
347 | configuration option, respectively. | |
348 | .IP "\fB\-to \fR\fIx y\fR" 4 | |
349 | .IX Item "-to x y" | |
350 | Specifies the coordinates of the top-left corner of the region of | |
351 | \&\fIimageName\fR into which data from \fIfilename\fR are to be read. | |
352 | The default is (0,0). | |
353 | .RE | |
354 | .RS 4 | |
355 | .RE | |
356 | .IP "\fI$image\fR\->\fBread\fR(\fIfilename\fR ?,\fIoption value(s), ...\fR?)" 4 | |
357 | .IX Item "$image->read(filename ?,option value(s), ...?)" | |
358 | Reads image data from the file named \fIfilename\fR into the image. | |
359 | This method first searches the list of | |
360 | image file format handlers for a handler that can interpret the data | |
361 | in \fIfilename\fR, and then reads the image in \fIfilename\fR into | |
362 | \&\fI$image\fR (the destination image). The following options may be | |
363 | specified: | |
364 | .RS 4 | |
365 | .IP "\fB\-format\fR => \fIformat-name\fR" 8 | |
366 | .IX Item "-format => format-name" | |
367 | Specifies the format of the image data in \fIfilename\fR. | |
368 | Specifically, only image file format handlers whose names begin with | |
369 | \&\fIformat-name\fR will be used while searching for an image data | |
370 | format handler to read the data. | |
371 | .IP "\fB\-from\fR => \fIx1 y1 ?x2 y2?\fR" 8 | |
372 | .IX Item "-from => x1 y1 ?x2 y2?" | |
373 | Specifies a rectangular sub-region of the image file data to be copied | |
374 | to the destination image. If only \fIx1\fR and \fIy1\fR are | |
375 | specified, the region extends from (\fIx1,y1\fR) to the bottom-right | |
376 | corner of the image in the image file. If all four coordinates are | |
377 | specified, they specify diagonally opposite corners or the region. | |
378 | The default, if this option is not specified, is the whole of the | |
379 | image in the image file. | |
380 | .IP "\fB\-shrink\fR" 8 | |
381 | .IX Item "-shrink" | |
382 | If this option, the size of \fI$image\fR will be reduced, if | |
383 | necessary, so that the region into which the image file data are read | |
384 | is at the bottom-right corner of the \fI$image\fR. This option | |
385 | will not affect the width or height of the image if the user has | |
386 | specified a non-zero value for the \fB\-width\fR or \fB\-height\fR | |
387 | configuration option, respectively. | |
388 | .IP "\fB\-to\fR => \fIx y\fR" 8 | |
389 | .IX Item "-to => x y" | |
390 | Specifies the coordinates of the top-left corner of the region of | |
391 | \&\fI$image\fR into which data from \fIfilename\fR are to be read. | |
392 | The default is (0,0). | |
393 | .RE | |
394 | .RS 4 | |
395 | .RE | |
396 | .IP "\fI$image\fR\->\fBredither\fR" 4 | |
397 | .IX Item "$image->redither" | |
398 | The dithering algorithm used in displaying photo images propagates | |
399 | quantization errors from one pixel to its neighbors. | |
400 | If the image data for \fI$image\fR is supplied in pieces, the | |
401 | dithered image may not be exactly correct. Normally the difference is | |
402 | not noticeable, but if it is a problem, this method can be used to | |
403 | recalculate the dithered image in each window where the image is | |
404 | displayed. | |
405 | .IP "\fI$image\fR\->\fBwrite\fR(\fIfilename\fR ?,\fIoption value(s), ...\fR?)" 4 | |
406 | .IX Item "$image->write(filename ?,option value(s), ...?)" | |
407 | Writes image data from \fI$image\fR to a file named \fIfilename\fR. | |
408 | The following options may be specified: | |
409 | .RS 4 | |
410 | .IP "\fB\-background\fR\fI color\fR" 8 | |
411 | .IX Item "-background color" | |
412 | If the color is specified, the data will not contain any transparency | |
413 | information. In all transparent pixels the color will be replaced by | |
414 | the specified color. | |
415 | .IP "\fB\-format\fR => \fIformat-name\fR" 8 | |
416 | .IX Item "-format => format-name" | |
417 | Specifies the name of the image file format handler to be used to | |
418 | write the data to the file. Specifically, this subcommand searches | |
419 | for the first handler whose name matches a initial substring of | |
420 | \&\fIformat-name\fR and which has the capability to write an image | |
421 | file. If this option is not given, this subcommand uses the first | |
422 | handler that has the capability to write an image file. | |
423 | .IP "\fB\-from\fR => \fIx1 y1 ?x2 y2?\fR" 8 | |
424 | .IX Item "-from => x1 y1 ?x2 y2?" | |
425 | Specifies a rectangular region of \fI$image\fR to be written to the | |
426 | image file. If only \fIx1\fR and \fIy1\fR are specified, the region | |
427 | extends from \fI(x1,y1)\fR to the bottom-right corner of | |
428 | \&\fI$image\fR. If all four coordinates are given, they specify | |
429 | diagonally opposite corners of the rectangular region. The default, | |
430 | if this option is not given, is the whole image. | |
431 | .IP "\fB\-grayscale\fR" 8 | |
432 | .IX Item "-grayscale" | |
433 | If this options is specified, the data will not contain color | |
434 | information. All pixel data will be transformed into grayscale. | |
435 | .RE | |
436 | .RS 4 | |
437 | .RE | |
438 | .SH "IMAGE FORMATS" | |
439 | .IX Header "IMAGE FORMATS" | |
440 | The photo image code is structured to allow handlers for additional | |
441 | image file formats to be added easily. The photo image code maintains | |
442 | a list of these handlers. Handlers are added to the list by | |
443 | registering them with a call to \fBTk_CreatePhotoImageFormat\fR. The | |
444 | standard Tk distribution comes with handlers for \s-1PPM/PGM\s0 and \s-1GIF\s0 formats, | |
445 | which are automatically registered on initialization. | |
446 | .PP | |
447 | When reading an image file or processing | |
448 | string data specified with the \fB\-data\fR configuration option, the | |
449 | photo image code invokes each handler in turn until one is | |
450 | found that claims to be able to read the data in the file or string. | |
451 | Usually this will find the correct handler, but if it doesn't, the | |
452 | user may give a format name with the \fB\-format\fR option to specify | |
453 | which handler to use. In fact the photo image code will try those | |
454 | handlers whose names begin with the string specified for the | |
455 | \&\fB\-format\fR option (the comparison is case\-insensitive). For | |
456 | example, if the user specifies \fB\-format gif\fR, then a handler | |
457 | named \s-1GIF87\s0 or \s-1GIF89\s0 may be invoked, but a handler | |
458 | named \s-1JPEG\s0 may not (assuming that such handlers had been | |
459 | registered). | |
460 | .PP | |
461 | When writing image data to a file, the processing of the | |
462 | \&\fB\-format\fR option is slightly different: the string value given | |
463 | for the \fB\-format\fR option must begin with the complete name of the | |
464 | requested handler, and may contain additional information following | |
465 | that, which the handler can use, for example, to specify which variant | |
466 | to use of the formats supported by the handler. | |
467 | .SH "COLOR ALLOCATION" | |
468 | .IX Header "COLOR ALLOCATION" | |
469 | When a photo image is displayed in a window, the photo image code | |
470 | allocates colors to use to display the image and dithers the image, if | |
471 | necessary, to display a reasonable approximation to the image using | |
472 | the colors that are available. The colors are allocated as a color | |
473 | cube, that is, the number of colors allocated is the product of the | |
474 | number of shades of red, green and blue. | |
475 | .PP | |
476 | Normally, the number of | |
477 | colors allocated is chosen based on the depth of the window. For | |
478 | example, in an 8\-bit PseudoColor window, the photo image code will | |
479 | attempt to allocate seven shades of red, seven shades of green and | |
480 | four shades of blue, for a total of 198 colors. In a 1\-bit StaticGray | |
481 | (monochrome) window, it will allocate two colors, black and white. In | |
482 | a 24\-bit DirectColor or TrueColor window, it will allocate 256 shades | |
483 | each of red, green and blue. Fortunately, because of the way that | |
484 | pixel values can be combined in DirectColor and TrueColor windows, | |
485 | this only requires 256 colors to be allocated. If not all of the | |
486 | colors can be allocated, the photo image code reduces the number of | |
487 | shades of each primary color and tries again. | |
488 | .PP | |
489 | The user can exercise some control over the number of colors that a | |
490 | photo image uses with the \fB\-palette\fR configuration option. If | |
491 | this option is used, it specifies the maximum number of shades of | |
492 | each primary color to try to allocate. It can also be used to force | |
493 | the image to be displayed in shades of gray, even on a color display, | |
494 | by giving a single number rather than three numbers separated by | |
495 | slashes. | |
496 | .SH "CREDITS" | |
497 | .IX Header "CREDITS" | |
498 | The photo image type was designed and implemented by Paul Mackerras, | |
499 | based on his earlier photo widget and some suggestions from | |
500 | John Ousterhout. | |
501 | .SH "SEE ALSO" | |
502 | .IX Header "SEE ALSO" | |
503 | Tk::Bitmap | |
504 | Tk::Image | |
505 | Tk::Pixmap | |
506 | .SH "KEYWORDS" | |
507 | .IX Header "KEYWORDS" | |
508 | photo, image, color |