OSDN Git Service

FIRST REPOSITORY
[eos/hostdependOTHERS.git] / HP / util / HP / man / man3 / CrtPhImgFmt.3
1 '\"
2 '\" Copyright (c) 1994 The Australian National University
3 '\" Copyright (c) 1994-1997 Sun Microsystems, Inc.
4 '\"
5 '\" See the file "license.terms" for information on usage and redistribution
6 '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
7 '\" 
8 '\" Author: Paul Mackerras (paulus@cs.anu.edu.au),
9 '\"         Department of Computer Science,
10 '\"         Australian National University.
11 '\"
12 '\" RCS: @(#) $Id: CrtPhImgFmt.3,v 1.4 2000/02/08 11:31:30 hobbs Exp $
13 '\"
14 '\" The definitions below are for supplemental macros used in Tcl/Tk
15 '\" manual entries.
16 '\"
17 '\" .AP type name in/out ?indent?
18 '\"     Start paragraph describing an argument to a library procedure.
19 '\"     type is type of argument (int, etc.), in/out is either "in", "out",
20 '\"     or "in/out" to describe whether procedure reads or modifies arg,
21 '\"     and indent is equivalent to second arg of .IP (shouldn't ever be
22 '\"     needed;  use .AS below instead)
23 '\"
24 '\" .AS ?type? ?name?
25 '\"     Give maximum sizes of arguments for setting tab stops.  Type and
26 '\"     name are examples of largest possible arguments that will be passed
27 '\"     to .AP later.  If args are omitted, default tab stops are used.
28 '\"
29 '\" .BS
30 '\"     Start box enclosure.  From here until next .BE, everything will be
31 '\"     enclosed in one large box.
32 '\"
33 '\" .BE
34 '\"     End of box enclosure.
35 '\"
36 '\" .CS
37 '\"     Begin code excerpt.
38 '\"
39 '\" .CE
40 '\"     End code excerpt.
41 '\"
42 '\" .VS ?version? ?br?
43 '\"     Begin vertical sidebar, for use in marking newly-changed parts
44 '\"     of man pages.  The first argument is ignored and used for recording
45 '\"     the version when the .VS was added, so that the sidebars can be
46 '\"     found and removed when they reach a certain age.  If another argument
47 '\"     is present, then a line break is forced before starting the sidebar.
48 '\"
49 '\" .VE
50 '\"     End of vertical sidebar.
51 '\"
52 '\" .DS
53 '\"     Begin an indented unfilled display.
54 '\"
55 '\" .DE
56 '\"     End of indented unfilled display.
57 '\"
58 '\" .SO
59 '\"     Start of list of standard options for a Tk widget.  The
60 '\"     options follow on successive lines, in four columns separated
61 '\"     by tabs.
62 '\"
63 '\" .SE
64 '\"     End of list of standard options for a Tk widget.
65 '\"
66 '\" .OP cmdName dbName dbClass
67 '\"     Start of description of a specific option.  cmdName gives the
68 '\"     option's name as specified in the class command, dbName gives
69 '\"     the option's name in the option database, and dbClass gives
70 '\"     the option's class in the option database.
71 '\"
72 '\" .UL arg1 arg2
73 '\"     Print arg1 underlined, then print arg2 normally.
74 '\"
75 '\" RCS: @(#) $Id: man.macros,v 1.3 1999/04/16 00:46:35 stanton Exp $
76 '\"
77 '\"     # Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
78 .if t .wh -1.3i ^B
79 .nr ^l \n(.l
80 .ad b
81 '\"     # Start an argument description
82 .de AP
83 .ie !"\\$4"" .TP \\$4
84 .el \{\
85 .   ie !"\\$2"" .TP \\n()Cu
86 .   el          .TP 15
87 .\}
88 .ta \\n()Au \\n()Bu
89 .ie !"\\$3"" \{\
90 \&\\$1  \\fI\\$2\\fP    (\\$3)
91 .\".b
92 .\}
93 .el \{\
94 .br
95 .ie !"\\$2"" \{\
96 \&\\$1  \\fI\\$2\\fP
97 .\}
98 .el \{\
99 \&\\fI\\$1\\fP
100 .\}
101 .\}
102 ..
103 '\"     # define tabbing values for .AP
104 .de AS
105 .nr )A 10n
106 .if !"\\$1"" .nr )A \\w'\\$1'u+3n
107 .nr )B \\n()Au+15n
108 .\"
109 .if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
110 .nr )C \\n()Bu+\\w'(in/out)'u+2n
111 ..
112 .AS Tcl_Interp Tcl_CreateInterp in/out
113 '\"     # BS - start boxed text
114 '\"     # ^y = starting y location
115 '\"     # ^b = 1
116 .de BS
117 .br
118 .mk ^y
119 .nr ^b 1u
120 .if n .nf
121 .if n .ti 0
122 .if n \l'\\n(.lu\(ul'
123 .if n .fi
124 ..
125 '\"     # BE - end boxed text (draw box now)
126 .de BE
127 .nf
128 .ti 0
129 .mk ^t
130 .ie n \l'\\n(^lu\(ul'
131 .el \{\
132 .\"     Draw four-sided box normally, but don't draw top of
133 .\"     box if the box started on an earlier page.
134 .ie !\\n(^b-1 \{\
135 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
136 .\}
137 .el \}\
138 \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
139 .\}
140 .\}
141 .fi
142 .br
143 .nr ^b 0
144 ..
145 '\"     # VS - start vertical sidebar
146 '\"     # ^Y = starting y location
147 '\"     # ^v = 1 (for troff;  for nroff this doesn't matter)
148 .de VS
149 .if !"\\$2"" .br
150 .mk ^Y
151 .ie n 'mc \s12\(br\s0
152 .el .nr ^v 1u
153 ..
154 '\"     # VE - end of vertical sidebar
155 .de VE
156 .ie n 'mc
157 .el \{\
158 .ev 2
159 .nf
160 .ti 0
161 .mk ^t
162 \h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
163 .sp -1
164 .fi
165 .ev
166 .\}
167 .nr ^v 0
168 ..
169 '\"     # Special macro to handle page bottom:  finish off current
170 '\"     # box/sidebar if in box/sidebar mode, then invoked standard
171 '\"     # page bottom macro.
172 .de ^B
173 .ev 2
174 'ti 0
175 'nf
176 .mk ^t
177 .if \\n(^b \{\
178 .\"     Draw three-sided box if this is the box's first page,
179 .\"     draw two sides but no top otherwise.
180 .ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
181 .el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
182 .\}
183 .if \\n(^v \{\
184 .nr ^x \\n(^tu+1v-\\n(^Yu
185 \kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
186 .\}
187 .bp
188 'fi
189 .ev
190 .if \\n(^b \{\
191 .mk ^y
192 .nr ^b 2
193 .\}
194 .if \\n(^v \{\
195 .mk ^Y
196 .\}
197 ..
198 '\"     # DS - begin display
199 .de DS
200 .RS
201 .nf
202 .sp
203 ..
204 '\"     # DE - end display
205 .de DE
206 .fi
207 .RE
208 .sp
209 ..
210 '\"     # SO - start of list of standard options
211 .de SO
212 .SH "STANDARD OPTIONS"
213 .LP
214 .nf
215 .ta 4c 8c 12c
216 .ft B
217 ..
218 '\"     # SE - end of list of standard options
219 .de SE
220 .fi
221 .ft R
222 .LP
223 See the \\fBoptions\\fR manual entry for details on the standard options.
224 ..
225 '\"     # OP - start of full description for a single option
226 .de OP
227 .LP
228 .nf
229 .ta 4c
230 Command-Line Name:      \\fB\\$1\\fR
231 Database Name:  \\fB\\$2\\fR
232 Database Class: \\fB\\$3\\fR
233 .fi
234 .IP
235 ..
236 '\"     # CS - begin code excerpt
237 .de CS
238 .RS
239 .nf
240 .ta .25i .5i .75i 1i
241 ..
242 '\"     # CE - end code excerpt
243 .de CE
244 .fi
245 .RE
246 ..
247 .de UL
248 \\$1\l'|0\(ul'\\$2
249 ..
250 .TH Tk_CreatePhotoImageFormat 3 8.3 Tk "Tk Library Procedures"
251 .BS
252 .SH NAME
253 Tk_CreatePhotoImageFormat \- define new file format for photo images
254 .SH SYNOPSIS
255 .nf
256 \fB#include <tk.h>\fR
257 \fB#include <tkPhoto.h>\fR
258 .sp
259 \fBTk_CreatePhotoImageFormat\fR(\fIformatPtr\fR)
260 .SH ARGUMENTS
261 .AS Tk_PhotoImageFormat *formatPtr
262 .AP Tk_PhotoImageFormat *formatPtr in
263 Structure that defines the new file format.
264 .BE
265
266 .SH DESCRIPTION
267 .PP
268 \fBTk_CreatePhotoImageFormat\fR is invoked to define a new file format
269 for image data for use with photo images.  The code that implements an
270 image file format is called an image file format handler, or
271 handler for short.  The photo image code
272 maintains a list of handlers that can be used to read and
273 write data to or from a file.  Some handlers may also
274 support reading image data from a string or converting image data to a
275 string format.
276 The user can specify which handler to use with the \fB\-format\fR
277 image configuration option or the \fB\-format\fR option to the
278 \fBread\fR and \fBwrite\fR photo image subcommands.
279 .PP
280 An image file format handler consists of a collection of procedures
281 plus a Tk_PhotoImageFormat structure, which contains the name of the
282 image file format and pointers to six procedures provided by the
283 handler to deal with files and strings in this format.  The
284 Tk_PhotoImageFormat structure contains the following fields:
285 .CS
286 typedef struct Tk_PhotoImageFormat {
287         char *\fIname\fR;
288         Tk_ImageFileMatchProc *\fIfileMatchProc\fR;
289         Tk_ImageStringMatchProc *\fIstringMatchProc\fR;
290         Tk_ImageFileReadProc *\fIfileReadProc\fR;
291         Tk_ImageStringReadProc *\fIstringReadProc\fR;
292         Tk_ImageFileWriteProc *\fIfileWriteProc\fR;
293         Tk_ImageStringWriteProc *\fIstringWriteProc\fR;
294 } Tk_PhotoImageFormat;
295 .CE
296 .PP
297 The handler need not provide implementations of all six procedures.
298 For example, the procedures that handle string data would not be
299 provided for a format in which the image data are stored in binary,
300 and could therefore contain null characters.  If any procedure is not
301 implemented, the corresponding pointer in the Tk_PhotoImageFormat
302 structure should be set to NULL.  The handler must provide the
303 \fIfileMatchProc\fR procedure if it provides the \fIfileReadProc\fR
304 procedure, and the \fIstringMatchProc\fR procedure if it provides the
305 \fIstringReadProc\fR procedure.
306
307 .SH PORTABILITY
308 .PP
309 In Tk 8.2 and earlier, a different interface was used. Tk 8.3 will
310 still support the old format handlers if the format name is in upper
311 case. If you still want to compile old format handlers with Tk8.3,
312 use the flag -DUSE_OLD_IMAGE. This will restore all function prototypes
313 to match the pre-8.3 situation.
314
315 .SH NAME
316 .PP
317 \fIformatPtr->name\fR provides a name for the image type.
318 Once \fBTk_CreatePhotoImageFormat\fR returns, this name may be used
319 in the \fB\-format\fR photo image configuration and subcommand option.
320 The manual page for the photo image (photo(n)) describes how image
321 file formats are chosen based on their names and the value given to
322 the \fB\-format\fR option. For new format handlers, the name should
323 be in lower case. Pre-8.3 format handlers are assumed to be in
324 upper case.
325
326 .SH FILEMATCHPROC
327 \fIformatPtr->fileMatchProc\fR provides the address of a procedure for
328 Tk to call when it is searching for an image file format handler
329 suitable for reading data in a given file.
330 \fIformatPtr->fileMatchProc\fR must match the following prototype:
331 .CS
332 typedef int Tk_ImageFileMatchProc(
333         Tcl_Channel \fIchan\fR,
334         CONST char *\fIfileName\fR,
335         Tcl_Obj *\fIformat\fR,
336         int *\fIwidthPtr\fR,
337         int *\fIheightPtr\fR,
338         Tcl_Interp *\fIinterp\fR);
339 .CE
340 The \fIfileName\fR argument is the name of the file containing the
341 image data, which is open for reading as \fIchan\fR.  The
342 \fIformat\fR argument contains the value given for the
343 \fB\-format\fR option, or NULL if the option was not specified.
344 If the data in the file appears to be in the format supported by this
345 handler, the \fIformatPtr->fileMatchProc\fR procedure should store the
346 width and height of the image in *\fIwidthPtr\fR and *\fIheightPtr\fR
347 respectively, and return 1.  Otherwise it should return 0.
348
349 .SH STRINGMATCHPROC
350 \fIformatPtr->stringMatchProc\fR provides the address of a procedure for
351 Tk to call when it is searching for an image file format handler for
352 suitable for reading data from a given string.
353 \fIformatPtr->stringMatchProc\fR must match the following prototype:
354 .CS
355 typedef int Tk_ImageStringMatchProc(
356         Tcl_Obj *\fIdata\fR,
357         Tcl_Obj *\fIformat\fR,
358         int *\fIwidthPtr\fR,
359         int *\fIheightPtr\fR,
360         Tcl_Interp *\fIinterp\fR);
361 .CE
362 The \fIdata\fR argument points to the object containing the image
363 data.  The \fIformat\fR argument contains the value given for
364 the \fB\-format\fR option, or NULL if the option was not specified.
365 If the data in the string appears to be in the format supported by
366 this handler, the \fIformatPtr->stringMatchProc\fR procedure should
367 store the width and height of the image in *\fIwidthPtr\fR and
368 *\fIheightPtr\fR respectively, and return 1.  Otherwise it should
369 return 0.
370
371 .SH FILEREADPROC
372 \fIformatPtr->fileReadProc\fR provides the address of a procedure for
373 Tk to call to read data from an image file into a photo image.
374 \fIformatPtr->fileReadProc\fR must match the following prototype:
375 .CS
376 typedef int Tk_ImageFileReadProc(
377         Tcl_Interp *\fIinterp\fR,
378         Tcl_Channel \fIchan\fR,
379         CONST char *\fIfileName\fR,
380         Tcl_Obj *\fIformat\fR,
381         PhotoHandle \fIimageHandle\fR,
382         int \fIdestX\fR, int \fIdestY\fR,
383         int \fIwidth\fR, int \fIheight\fR,
384         int \fIsrcX\fR, int \fIsrcY\fR);
385 .CE
386 The \fIinterp\fR argument is the interpreter in which the command was
387 invoked to read the image; it should be used for reporting errors.
388 The image data is in the file named \fIfileName\fR, which is open for
389 reading as \fIchan\fR.  The \fIformat\fR argument contains the
390 value given for the \fB\-format\fR option, or NULL if the option was
391 not specified.  The image data in the file, or a subimage of it, is to
392 be read into the photo image identified by the handle
393 \fIimageHandle\fR.  The subimage of the data in the file is of
394 dimensions \fIwidth\fR x \fIheight\fR and has its top-left corner at
395 coordinates (\fIsrcX\fR,\fIsrcY\fR).  It is to be stored in the photo
396 image with its top-left corner at coordinates
397 (\fIdestX\fR,\fIdestY\fR) using the \fBTk_PhotoPutBlock\fR procedure.
398 The return value is a standard Tcl return value.
399
400 .SH STRINGREADPROC
401 \fIformatPtr->stringReadProc\fR provides the address of a procedure for
402 Tk to call to read data from a string into a photo image.
403 \fIformatPtr->stringReadProc\fR must match the following prototype:
404 .CS
405 typedef int Tk_ImageStringReadProc(
406         Tcl_Interp *\fIinterp\fR,
407         Tcl_Obj *\fIdata\fR,
408         Tcl_Obj *\fIformat\fR,
409         PhotoHandle \fIimageHandle\fR,
410         int \fIdestX\fR, int \fIdestY\fR,
411         int \fIwidth\fR, int \fIheight\fR,
412         int \fIsrcX\fR, int \fIsrcY\fR);
413 .CE
414 The \fIinterp\fR argument is the interpreter in which the command was
415 invoked to read the image; it should be used for reporting errors.
416 The \fIdata\fR argument points to the image data in object form.
417 The \fIformat\fR argument contains the
418 value given for the \fB\-format\fR option, or NULL if the option was
419 not specified.  The image data in the string, or a subimage of it, is to
420 be read into the photo image identified by the handle
421 \fIimageHandle\fR.  The subimage of the data in the string is of
422 dimensions \fIwidth\fR x \fIheight\fR and has its top-left corner at
423 coordinates (\fIsrcX\fR,\fIsrcY\fR).  It is to be stored in the photo
424 image with its top-left corner at coordinates
425 (\fIdestX\fR,\fIdestY\fR) using the \fBTk_PhotoPutBlock\fR procedure.
426 The return value is a standard Tcl return value.
427
428 .SH FILEWRITEPROC
429 \fIformatPtr->fileWriteProc\fR provides the address of a procedure for
430 Tk to call to write data from a photo image to a file.
431 \fIformatPtr->fileWriteProc\fR must match the following prototype:
432 .CS
433 typedef int Tk_ImageFileWriteProc(
434         Tcl_Interp *\fIinterp\fR,
435         CONST char *\fIfileName\fR,
436         Tcl_Obj *\fIformat\fR,
437         Tk_PhotoImageBlock *\fIblockPtr\fR);
438 .CE
439 The \fIinterp\fR argument is the interpreter in which the command was
440 invoked to write the image; it should be used for reporting errors.
441 The image data to be written are in memory and are described by the
442 Tk_PhotoImageBlock structure pointed to by \fIblockPtr\fR; see the
443 manual page FindPhoto(3) for details.  The \fIfileName\fR argument
444 points to the string giving the name of the file in which to write the
445 image data.  The \fIformat\fR argument contains the
446 value given for the \fB\-format\fR option, or NULL if the option was
447 not specified.  The format string can contain extra characters
448 after the name of the format.  If appropriate, the
449 \fIformatPtr->fileWriteProc\fR procedure may interpret these
450 characters to specify further details about the image file.
451 The return value is a standard Tcl return value.
452
453 .SH STRINGWRITEPROC
454 \fIformatPtr->stringWriteProc\fR provides the address of a procedure for
455 Tk to call to translate image data from a photo image into a string.
456 \fIformatPtr->stringWriteProc\fR must match the following prototype:
457 .CS
458 typedef int Tk_ImageStringWriteProc(
459         Tcl_Interp *\fIinterp\fR,
460         Tcl_Obj *\fIformat\fR,
461         Tk_PhotoImageBlock *\fIblockPtr\fR);
462 .CE
463 The \fIinterp\fR argument is the interpreter in which the command was
464 invoked to convert the image; it should be used for reporting errors.
465 The image data to be converted are in memory and are described by the
466 Tk_PhotoImageBlock structure pointed to by \fIblockPtr\fR; see the
467 manual page FindPhoto(3) for details.  The data for the string
468 should be put in the interpreter \fIinterp\fR result.
469 The \fIformat\fR argument contains the
470 value given for the \fB\-format\fR option, or NULL if the option was
471 not specified.  The format string can contain extra characters
472 after the name of the format.  If appropriate, the
473 \fIformatPtr->stringWriteProc\fR procedure may interpret these
474 characters to specify further details about the image file.
475 The return value is a standard Tcl return value.
476
477 .SH "SEE ALSO"
478 Tk_FindPhoto, Tk_PhotoPutBlock
479
480 .SH KEYWORDS
481 photo image, image file