⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 crtphimgfmt.3

📁 linux系统下的音频通信
💻 3
字号:
'\"'\" Copyright (c) 1994 The Australian National University'\" Copyright (c) 1994-1997 Sun Microsystems, Inc.'\"'\" See the file "license.terms" for information on usage and redistribution'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.'\" '\" Author: Paul Mackerras (paulus@cs.anu.edu.au),'\"	    Department of Computer Science,'\"	    Australian National University.'\"'\" SCCS: @(#) CrtPhImgFmt.3 1.10 97/10/31 12:58:54'\".so man.macros.TH Tk_CreatePhotoImageFormat 3 4.0 Tk "Tk Library Procedures".BS.SH NAMETk_CreatePhotoImageFormat \- define new file format for photo images.SH SYNOPSIS.nf\fB#include <tk.h>\fR\fB#include <tkPhoto.h>\fR.sp\fBTk_CreatePhotoImageFormat\fR(\fIformatPtr\fR).SH ARGUMENTS.AS Tk_PhotoImageFormat *formatPtr.AP Tk_PhotoImageFormat *formatPtr inStructure that defines the new file format..BE.SH DESCRIPTION.PP\fBTk_CreatePhotoImageFormat\fR is invoked to define a new file formatfor image data for use with photo images.  The code that implements animage file format is called an image file format handler, orhandler for short.  The photo image codemaintains a list of handlers that can be used to read andwrite data to or from a file.  Some handlers may alsosupport reading image data from a string or converting image data to astring format.The user can specify which handler to use with the \fB\-format\fRimage configuration option or the \fB\-format\fR option to the\fBread\fR and \fBwrite\fR photo image subcommands..PPAn image file format handler consists of a collection of proceduresplus a Tk_PhotoImageFormat structure, which contains the name of theimage file format and pointers to six procedures provided by thehandler to deal with files and strings in this format.  TheTk_PhotoImageFormat structure contains the following fields:.CStypedef struct Tk_PhotoImageFormat {	char *\fIname\fR;	Tk_ImageFileMatchProc *\fIfileMatchProc\fR;	Tk_ImageStringMatchProc *\fIstringMatchProc\fR;	Tk_ImageFileReadProc *\fIfileReadProc\fR;	Tk_ImageStringReadProc *\fIstringReadProc\fR;	Tk_ImageFileWriteProc *\fIfileWriteProc\fR;	Tk_ImageStringWriteProc *\fIstringWriteProc\fR;} Tk_PhotoImageFormat;.CE.PPThe handler need not provide implementations of all six procedures.For example, the procedures that handle string data would not beprovided for a format in which the image data are stored in binary,and could therefore contain null characters.  If any procedure is notimplemented, the corresponding pointer in the Tk_PhotoImageFormatstructure should be set to NULL.  The handler must provide the\fIfileMatchProc\fR procedure if it provides the \fIfileReadProc\fRprocedure, and the \fIstringMatchProc\fR procedure if it provides the\fIstringReadProc\fR procedure..SH NAME.PP\fIformatPtr->name\fR provides a name for the image type.Once \fBTk_CreatePhotoImageFormat\fR returns, this name may be usedin the \fB\-format\fR photo image configuration and subcommand option.The manual page for the photo image (photo(n)) describes how imagefile formats are chosen based on their names and the value given tothe \fB\-format\fR option..SH FILEMATCHPROC\fIformatPtr->fileMatchProc\fR provides the address of a procedure forTk to call when it is searching for an image file format handlersuitable for reading data in a given file.\fIformatPtr->fileMatchProc\fR must match the following prototype:.CStypedef int Tk_ImageFileMatchProc(	Tcl_Channel \fIchan\fR,	char *\fIfileName\fR,	char *\fIformatString\fR,	int *\fIwidthPtr\fR,	int *\fIheightPtr\fR);.CEThe \fIfileName\fR argument is the name of the file containing theimage data, which is open for reading as \fIchan\fR.  The\fIformatString\fR argument contains the value given for the\fB\-format\fR option, or NULL if the option was not specified.If the data in the file appears to be in the format supported by thishandler, the \fIformatPtr->fileMatchProc\fR procedure should store thewidth and height of the image in *\fIwidthPtr\fR and *\fIheightPtr\fRrespectively, and return 1.  Otherwise it should return 0..SH STRINGMATCHPROC\fIformatPtr->stringMatchProc\fR provides the address of a procedure forTk to call when it is searching for an image file format handler forsuitable for reading data from a given string.\fIformatPtr->stringMatchProc\fR must match the following prototype:.CStypedef int Tk_ImageStringMatchProc(	char *\fIstring\fR,	char *\fIformatString\fR,	int *\fIwidthPtr\fR,	int *\fIheightPtr\fR);.CEThe \fIstring\fR argument points to the string containing the imagedata.  The \fIformatString\fR argument contains the value given forthe \fB\-format\fR option, or NULL if the option was not specified.If the data in the string appears to be in the format supported bythis handler, the \fIformatPtr->stringMatchProc\fR procedure shouldstore the width and height of the image in *\fIwidthPtr\fR and*\fIheightPtr\fR respectively, and return 1.  Otherwise it shouldreturn 0..SH FILEREADPROC\fIformatPtr->fileReadProc\fR provides the address of a procedure forTk to call to read data from an image file into a photo image.\fIformatPtr->fileReadProc\fR must match the following prototype:.CStypedef int Tk_ImageFileReadProc(	Tcl_Interp *\fIinterp\fR,	Tcl_Channel \fIchan\fR,	char *\fIfileName\fR,	char *\fIformatString\fR,	PhotoHandle \fIimageHandle\fR,	int \fIdestX\fR, int \fIdestY\fR,	int \fIwidth\fR, int \fIheight\fR,	int \fIsrcX\fR, int \fIsrcY\fR);.CEThe \fIinterp\fR argument is the interpreter in which the command wasinvoked to read the image; it should be used for reporting errors.The image data is in the file named \fIfileName\fR, which is open forreading as \fIchan\fR.  The \fIformatString\fR argument contains thevalue given for the \fB\-format\fR option, or NULL if the option wasnot specified.  The image data in the file, or a subimage of it, is tobe read into the photo image identified by the handle\fIimageHandle\fR.  The subimage of the data in the file is ofdimensions \fIwidth\fR x \fIheight\fR and has its top-left corner atcoordinates (\fIsrcX\fR,\fIsrcY\fR).  It is to be stored in the photoimage with its top-left corner at coordinates(\fIdestX\fR,\fIdestY\fR) using the \fBTk_PhotoPutBlock\fR procedure.The return value is a standard Tcl return value..SH STRINGREADPROC\fIformatPtr->stringReadProc\fR provides the address of a procedure forTk to call to read data from a string into a photo image.\fIformatPtr->stringReadProc\fR must match the following prototype:.CStypedef int Tk_ImageStringReadProc(	Tcl_Interp *\fIinterp\fR,	char *\fIstring\fR,	char *\fIformatString\fR,	PhotoHandle \fIimageHandle\fR,	int \fIdestX\fR, int \fIdestY\fR,	int \fIwidth\fR, int \fIheight\fR,	int \fIsrcX\fR, int \fIsrcY\fR);.CEThe \fIinterp\fR argument is the interpreter in which the command wasinvoked to read the image; it should be used for reporting errors.The \fIstring\fR argument points to the image data in string form.The \fIformatString\fR argument contains thevalue given for the \fB\-format\fR option, or NULL if the option wasnot specified.  The image data in the string, or a subimage of it, is tobe read into the photo image identified by the handle\fIimageHandle\fR.  The subimage of the data in the string is ofdimensions \fIwidth\fR x \fIheight\fR and has its top-left corner atcoordinates (\fIsrcX\fR,\fIsrcY\fR).  It is to be stored in the photoimage with its top-left corner at coordinates(\fIdestX\fR,\fIdestY\fR) using the \fBTk_PhotoPutBlock\fR procedure.The return value is a standard Tcl return value..SH FILEWRITEPROC\fIformatPtr->fileWriteProc\fR provides the address of a procedure forTk to call to write data from a photo image to a file.\fIformatPtr->fileWriteProc\fR must match the following prototype:.CStypedef int Tk_ImageFileWriteProc(	Tcl_Interp *\fIinterp\fR,	char *\fIfileName\fR,	char *\fIformatString\fR,	Tk_PhotoImageBlock *\fIblockPtr\fR);.CEThe \fIinterp\fR argument is the interpreter in which the command wasinvoked to write the image; it should be used for reporting errors.The image data to be written are in memory and are described by theTk_PhotoImageBlock structure pointed to by \fIblockPtr\fR; see themanual page FindPhoto(3) for details.  The \fIfileName\fR argumentpoints to the string giving the name of the file in which to write theimage data.  The \fIformatString\fR argument contains thevalue given for the \fB\-format\fR option, or NULL if the option wasnot specified.  The format string can contain extra charactersafter the name of the format.  If appropriate, the\fIformatPtr->fileWriteProc\fR procedure may interpret thesecharacters to specify further details about the image file.The return value is a standard Tcl return value..SH STRINGWRITEPROC\fIformatPtr->stringWriteProc\fR provides the address of a procedure forTk to call to translate image data from a photo image into a string.\fIformatPtr->stringWriteProc\fR must match the following prototype:.CStypedef int Tk_ImageStringWriteProc(	Tcl_Interp *\fIinterp\fR,	Tcl_DString *\fIdataPtr\fR,	char *\fIformatString\fR,	Tk_PhotoImageBlock *\fIblockPtr\fR);.CEThe \fIinterp\fR argument is the interpreter in which the command wasinvoked to convert the image; it should be used for reporting errors.The image data to be converted are in memory and are described by theTk_PhotoImageBlock structure pointed to by \fIblockPtr\fR; see themanual page FindPhoto(3) for details.  The data for the stringshould be appended to the dynamic string given by \fIdataPtr\fR.The \fIformatString\fR argument contains thevalue given for the \fB\-format\fR option, or NULL if the option wasnot specified.  The format string can contain extra charactersafter the name of the format.  If appropriate, the\fIformatPtr->stringWriteProc\fR procedure may interpret thesecharacters to specify further details about the image file.The return value is a standard Tcl return value..SH "SEE ALSO"Tk_FindPhoto, Tk_PhotoPutBlock.SH KEYWORDSphoto image, image file

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -