📄 getimage.3
字号:
'\"'\" Copyright (c) 1994 The Regents of the University of California.'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.'\"'\" See the file "license.terms" for information on usage and redistribution'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.'\" '\" SCCS: @(#) GetImage.3 1.8 96/03/26 18:10:29'\" .so man.macros.TH Tk_GetImage 3 4.0 Tk "Tk Library Procedures".BS.SH NAMETk_GetImage, Tk_RedrawImage, Tk_SizeOfImage, Tk_FreeImage \- use an image in a widget.SH SYNOPSIS.nf\fB#include <tk.h>\fR.spTk_Image\fBTk_GetImage\fR(\fIinterp, tkwin, name, changeProc, clientData\fR).sp\fBTk_RedrawImage\fR(\fIimage, imageX, imageY, width, height, drawable, drawableX, drawableY\fR).sp\fBTk_SizeOfImage\fR(\fIimage, widthPtr, heightPtr\fR).sp\fBTk_FreeImage\fR(\fIimage\fR).SH ARGUMENTS.AS Tk_ImageChangedProc *changeProc.AP Tcl_Interp *interp inPlace to leave error message..AP Tk_Window tkwin inWindow in which image will be used..AP char *name inName of image..AP Tk_ImageChangedProc *changeProc inProcedure for Tk to invoke whenever image content or size changes..AP ClientData clientData inOne-word value for Tk to pass to \fIchangeProc\fR..AP Tk_Image image inToken for image instance; must have been returned by a previouscall to \fBTk_GetImage\fR..AP int imageX inX-coordinate of upper-left corner of region of image to redisplay(measured in pixels from the image's upper-left corner)..AP int imageY inY-coordinate of upper-left corner of region of image to redisplay(measured in pixels from the image's upper-left corner)..AP "int" width (in)Width of region of image to redisplay..AP "int" height (in)Height of region of image to redisplay..AP Drawable drawable inWhere to display image. Must either be window specified to\fBTk_GetImage\fR or a pixmap compatible with that window..AP int drawableX inWhere to display image in \fIdrawable\fR: this is the x-coordinatein \fIdrawable\fR where x-coordinate \fIimageX\fR of the imageshould be displayed..AP int drawableY inWhere to display image in \fIdrawable\fR: this is the y-coordinatein \fIdrawable\fR where y-coordinate \fIimageY\fR of the imageshould be displayed..AP "int" widthPtr outStore width of \fIimage\fR (in pixels) here..AP "int" heightPtr outStore height of \fIimage\fR (in pixels) here..BE.SH DESCRIPTION.PPThese procedures are invoked by widgets that wish to display images.\fBTk_GetImage\fR is invoked by a widget when it first decides todisplay an image.\fIname\fR gives the name of the desired image and \fItkwin\fRidentifies the window where the image will be displayed.\fBTk_GetImage\fR looks up the image in the table of existingimages and returns a token for a new instance of the image.If the image doesn't exist then \fBTk_GetImage\fR returns NULLand leaves an error message in \fIinterp->result\fR..PPWhen a widget wishes to actually display an image it mustcall \fBTk_RedrawWidget\fR, identifying the image (\fIimage\fR),a region within the image to redisplay (\fIimageX\fR, \fIimageY\fR,\fIwidth\fR, and \fIheight\fR), and a place to display theimage (\fIdrawable\fR, \fIdrawableX\fR, and \fIdrawableY\fR).Tk will then invoke the appropriate image manager, which willdisplay the requested portion of the image before returning..PPA widget can find out the dimensions of an image by calling\fBTk_SizeOfImage\fR: the width and height will be storedin the locations given by \fIwidthPtr\fR and \fIheightPtr\fR,respectively..PPWhen a widget is finished with an image (e.g., the widget isbeing deleted or it is going to use a different image insteadof the current one), it must call \fBTk_FreeImage\fR torelease the image instance.The widget should never again use the image token after passingit to \fBTk_FreeImage\fR.There must be exactly one call to \fBTk_FreeImage\fR for eachcall to \fBTk_GetImage\fR..PPIf the contents or size of an image changes, then any widgetsusing the image will need to find out about the changes so thatthey can redisplay themselves.The \fIchangeProc\fR and \fIclientData\fR arguments to\fBTk_GetImage\fR are used for this purpose.\fIchangeProc\fR will be called by Tk whenever a change occursin the image; it must match the following prototype:.CStypedef void Tk_ImageChangedProc( ClientData \fIclientData\fR, int \fIx\fR, int \fIy\fR, int \fIwidth\fR, int \fIheight\fR, int \fIimageWidth\fR, int \fIimageHeight\fR);.CEThe \fIclientData\fR argument to \fIchangeProc\fR is the same as the\fIclientData\fR argument to \fBTk_GetImage\fR.It is usually a pointer to the widget record for the widget orsome other data structure managed by the widget.The arguments \fIx\fR, \fIy\fR, \fIwidth\fR, and \fIheight\fRidentify a region within the image that must be redisplayed;they are specified in pixels measured from the upper-leftcorner of the image.The arguments \fIimageWidth\fR and \fIimageHeight\fR givethe image's (new) size..SH "SEE ALSO"Tk_CreateImageType.SH KEYWORDSimages, redisplay
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -