Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / src / nas,5.n2.os.2 / lib / python / man / man3 / Tk_CreatePhotoImageFormat.3
CommitLineData
86530b38
AT
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.5 2001/08/23 19:11:22 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.4 2000/08/25 06:18:32 ericm 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 5.5c 11c
216.ft B
217..
218'\" # SE - end of list of standard options
219.de SE
220.fi
221.ft R
222.LP
223See 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
230Command-Line Name: \\fB\\$1\\fR
231Database Name: \\fB\\$2\\fR
232Database 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
253Tk_CreatePhotoImageFormat \- define new file format for photo images
254.SH SYNOPSIS
255.nf
256\fB#include <tk.h>\fR
257.sp
258\fBTk_CreatePhotoImageFormat\fR(\fIformatPtr\fR)
259.SH ARGUMENTS
260.AS Tk_PhotoImageFormat *formatPtr
261.AP Tk_PhotoImageFormat *formatPtr in
262Structure that defines the new file format.
263.BE
264
265.SH DESCRIPTION
266.PP
267\fBTk_CreatePhotoImageFormat\fR is invoked to define a new file format
268for image data for use with photo images. The code that implements an
269image file format is called an image file format handler, or
270handler for short. The photo image code
271maintains a list of handlers that can be used to read and
272write data to or from a file. Some handlers may also
273support reading image data from a string or converting image data to a
274string format.
275The user can specify which handler to use with the \fB\-format\fR
276image configuration option or the \fB\-format\fR option to the
277\fBread\fR and \fBwrite\fR photo image subcommands.
278.PP
279An image file format handler consists of a collection of procedures
280plus a Tk_PhotoImageFormat structure, which contains the name of the
281image file format and pointers to six procedures provided by the
282handler to deal with files and strings in this format. The
283Tk_PhotoImageFormat structure contains the following fields:
284.CS
285typedef struct Tk_PhotoImageFormat {
286 char *\fIname\fR;
287 Tk_ImageFileMatchProc *\fIfileMatchProc\fR;
288 Tk_ImageStringMatchProc *\fIstringMatchProc\fR;
289 Tk_ImageFileReadProc *\fIfileReadProc\fR;
290 Tk_ImageStringReadProc *\fIstringReadProc\fR;
291 Tk_ImageFileWriteProc *\fIfileWriteProc\fR;
292 Tk_ImageStringWriteProc *\fIstringWriteProc\fR;
293} Tk_PhotoImageFormat;
294.CE
295.PP
296The handler need not provide implementations of all six procedures.
297For example, the procedures that handle string data would not be
298provided for a format in which the image data are stored in binary,
299and could therefore contain null characters. If any procedure is not
300implemented, the corresponding pointer in the Tk_PhotoImageFormat
301structure should be set to NULL. The handler must provide the
302\fIfileMatchProc\fR procedure if it provides the \fIfileReadProc\fR
303procedure, and the \fIstringMatchProc\fR procedure if it provides the
304\fIstringReadProc\fR procedure.
305
306.SH PORTABILITY
307.PP
308In Tk 8.2 and earlier, a different interface was used. Tk 8.3 will
309still support the old format handlers if the format name is in upper
310case. If you still want to compile old format handlers with Tk8.3,
311use the flag -DUSE_OLD_IMAGE. This will restore all function prototypes
312to match the pre-8.3 situation.
313
314.SH NAME
315.PP
316\fIformatPtr->name\fR provides a name for the image type.
317Once \fBTk_CreatePhotoImageFormat\fR returns, this name may be used
318in the \fB\-format\fR photo image configuration and subcommand option.
319The manual page for the photo image (photo(n)) describes how image
320file formats are chosen based on their names and the value given to
321the \fB\-format\fR option. For new format handlers, the name should
322be in lower case. Pre-8.3 format handlers are assumed to be in
323upper case.
324
325.SH FILEMATCHPROC
326\fIformatPtr->fileMatchProc\fR provides the address of a procedure for
327Tk to call when it is searching for an image file format handler
328suitable for reading data in a given file.
329\fIformatPtr->fileMatchProc\fR must match the following prototype:
330.CS
331typedef int Tk_ImageFileMatchProc(
332 Tcl_Channel \fIchan\fR,
333 CONST char *\fIfileName\fR,
334 Tcl_Obj *\fIformat\fR,
335 int *\fIwidthPtr\fR,
336 int *\fIheightPtr\fR,
337 Tcl_Interp *\fIinterp\fR);
338.CE
339The \fIfileName\fR argument is the name of the file containing the
340image data, which is open for reading as \fIchan\fR. The
341\fIformat\fR argument contains the value given for the
342\fB\-format\fR option, or NULL if the option was not specified.
343If the data in the file appears to be in the format supported by this
344handler, the \fIformatPtr->fileMatchProc\fR procedure should store the
345width and height of the image in *\fIwidthPtr\fR and *\fIheightPtr\fR
346respectively, and return 1. Otherwise it should return 0.
347
348.SH STRINGMATCHPROC
349\fIformatPtr->stringMatchProc\fR provides the address of a procedure for
350Tk to call when it is searching for an image file format handler for
351suitable for reading data from a given string.
352\fIformatPtr->stringMatchProc\fR must match the following prototype:
353.CS
354typedef int Tk_ImageStringMatchProc(
355 Tcl_Obj *\fIdata\fR,
356 Tcl_Obj *\fIformat\fR,
357 int *\fIwidthPtr\fR,
358 int *\fIheightPtr\fR,
359 Tcl_Interp *\fIinterp\fR);
360.CE
361The \fIdata\fR argument points to the object containing the image
362data. The \fIformat\fR argument contains the value given for
363the \fB\-format\fR option, or NULL if the option was not specified.
364If the data in the string appears to be in the format supported by
365this handler, the \fIformatPtr->stringMatchProc\fR procedure should
366store the width and height of the image in *\fIwidthPtr\fR and
367*\fIheightPtr\fR respectively, and return 1. Otherwise it should
368return 0.
369
370.SH FILEREADPROC
371\fIformatPtr->fileReadProc\fR provides the address of a procedure for
372Tk to call to read data from an image file into a photo image.
373\fIformatPtr->fileReadProc\fR must match the following prototype:
374.CS
375typedef int Tk_ImageFileReadProc(
376 Tcl_Interp *\fIinterp\fR,
377 Tcl_Channel \fIchan\fR,
378 CONST char *\fIfileName\fR,
379 Tcl_Obj *\fIformat\fR,
380 PhotoHandle \fIimageHandle\fR,
381 int \fIdestX\fR, int \fIdestY\fR,
382 int \fIwidth\fR, int \fIheight\fR,
383 int \fIsrcX\fR, int \fIsrcY\fR);
384.CE
385The \fIinterp\fR argument is the interpreter in which the command was
386invoked to read the image; it should be used for reporting errors.
387The image data is in the file named \fIfileName\fR, which is open for
388reading as \fIchan\fR. The \fIformat\fR argument contains the
389value given for the \fB\-format\fR option, or NULL if the option was
390not specified. The image data in the file, or a subimage of it, is to
391be read into the photo image identified by the handle
392\fIimageHandle\fR. The subimage of the data in the file is of
393dimensions \fIwidth\fR x \fIheight\fR and has its top-left corner at
394coordinates (\fIsrcX\fR,\fIsrcY\fR). It is to be stored in the photo
395image with its top-left corner at coordinates
396(\fIdestX\fR,\fIdestY\fR) using the \fBTk_PhotoPutBlock\fR procedure.
397The return value is a standard Tcl return value.
398
399.SH STRINGREADPROC
400\fIformatPtr->stringReadProc\fR provides the address of a procedure for
401Tk to call to read data from a string into a photo image.
402\fIformatPtr->stringReadProc\fR must match the following prototype:
403.CS
404typedef int Tk_ImageStringReadProc(
405 Tcl_Interp *\fIinterp\fR,
406 Tcl_Obj *\fIdata\fR,
407 Tcl_Obj *\fIformat\fR,
408 PhotoHandle \fIimageHandle\fR,
409 int \fIdestX\fR, int \fIdestY\fR,
410 int \fIwidth\fR, int \fIheight\fR,
411 int \fIsrcX\fR, int \fIsrcY\fR);
412.CE
413The \fIinterp\fR argument is the interpreter in which the command was
414invoked to read the image; it should be used for reporting errors.
415The \fIdata\fR argument points to the image data in object form.
416The \fIformat\fR argument contains the
417value given for the \fB\-format\fR option, or NULL if the option was
418not specified. The image data in the string, or a subimage of it, is to
419be read into the photo image identified by the handle
420\fIimageHandle\fR. The subimage of the data in the string is of
421dimensions \fIwidth\fR x \fIheight\fR and has its top-left corner at
422coordinates (\fIsrcX\fR,\fIsrcY\fR). It is to be stored in the photo
423image with its top-left corner at coordinates
424(\fIdestX\fR,\fIdestY\fR) using the \fBTk_PhotoPutBlock\fR procedure.
425The return value is a standard Tcl return value.
426
427.SH FILEWRITEPROC
428\fIformatPtr->fileWriteProc\fR provides the address of a procedure for
429Tk to call to write data from a photo image to a file.
430\fIformatPtr->fileWriteProc\fR must match the following prototype:
431.CS
432typedef int Tk_ImageFileWriteProc(
433 Tcl_Interp *\fIinterp\fR,
434 CONST char *\fIfileName\fR,
435 Tcl_Obj *\fIformat\fR,
436 Tk_PhotoImageBlock *\fIblockPtr\fR);
437.CE
438The \fIinterp\fR argument is the interpreter in which the command was
439invoked to write the image; it should be used for reporting errors.
440The image data to be written are in memory and are described by the
441Tk_PhotoImageBlock structure pointed to by \fIblockPtr\fR; see the
442manual page FindPhoto(3) for details. The \fIfileName\fR argument
443points to the string giving the name of the file in which to write the
444image data. The \fIformat\fR argument contains the
445value given for the \fB\-format\fR option, or NULL if the option was
446not specified. The format string can contain extra characters
447after the name of the format. If appropriate, the
448\fIformatPtr->fileWriteProc\fR procedure may interpret these
449characters to specify further details about the image file.
450The return value is a standard Tcl return value.
451
452.SH STRINGWRITEPROC
453\fIformatPtr->stringWriteProc\fR provides the address of a procedure for
454Tk to call to translate image data from a photo image into a string.
455\fIformatPtr->stringWriteProc\fR must match the following prototype:
456.CS
457typedef int Tk_ImageStringWriteProc(
458 Tcl_Interp *\fIinterp\fR,
459 Tcl_Obj *\fIformat\fR,
460 Tk_PhotoImageBlock *\fIblockPtr\fR);
461.CE
462The \fIinterp\fR argument is the interpreter in which the command was
463invoked to convert the image; it should be used for reporting errors.
464The image data to be converted are in memory and are described by the
465Tk_PhotoImageBlock structure pointed to by \fIblockPtr\fR; see the
466manual page FindPhoto(3) for details. The data for the string
467should be put in the interpreter \fIinterp\fR result.
468The \fIformat\fR argument contains the
469value given for the \fB\-format\fR option, or NULL if the option was
470not specified. The format string can contain extra characters
471after the name of the format. If appropriate, the
472\fIformatPtr->stringWriteProc\fR procedure may interpret these
473characters to specify further details about the image file.
474The return value is a standard Tcl return value.
475
476.SH "SEE ALSO"
477Tk_FindPhoto, Tk_PhotoPutBlock
478
479.SH KEYWORDS
480photo image, image file