GetImage.3
上传用户:rrhhcc
上传日期:2015-12-11
资源大小:54129k
文件大小:5k
- '"
- '" 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.
- '"
- '" RCS: @(#) $Id: GetImage.3,v 1.5 2002/08/05 04:30:38 dgp Exp $
- '"
- .so man.macros
- .TH Tk_GetImage 3 4.0 Tk "Tk Library Procedures"
- .BS
- .SH NAME
- Tk_GetImage, Tk_RedrawImage, Tk_SizeOfImage, Tk_FreeImage - use an image in a widget
- .SH SYNOPSIS
- .nf
- fB#include <tk.h>fR
- .sp
- Tk_Image
- fBTk_GetImagefR(fIinterp, tkwin, name, changeProc, clientDatafR)
- .sp
- fBTk_RedrawImagefR(fIimage, imageX, imageY, width, height, drawable, drawableX, drawableYfR)
- .sp
- fBTk_SizeOfImagefR(fIimage, widthPtr, heightPtrfR)
- .sp
- fBTk_FreeImagefR(fIimagefR)
- .SH ARGUMENTS
- .AS Tk_ImageChangedProc *changeProc
- .AP Tcl_Interp *interp in
- Place to leave error message.
- .AP Tk_Window tkwin in
- Window in which image will be used.
- .AP "CONST char" *name in
- Name of image.
- .AP Tk_ImageChangedProc *changeProc in
- Procedure for Tk to invoke whenever image content or size changes.
- .AP ClientData clientData in
- One-word value for Tk to pass to fIchangeProcfR.
- .AP Tk_Image image in
- Token for image instance; must have been returned by a previous
- call to fBTk_GetImagefR.
- .AP int imageX in
- X-coordinate of upper-left corner of region of image to redisplay
- (measured in pixels from the image's upper-left corner).
- .AP int imageY in
- Y-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 in
- Where to display image. Must either be window specified to
- fBTk_GetImagefR or a pixmap compatible with that window.
- .AP int drawableX in
- Where to display image in fIdrawablefR: this is the x-coordinate
- in fIdrawablefR where x-coordinate fIimageXfR of the image
- should be displayed.
- .AP int drawableY in
- Where to display image in fIdrawablefR: this is the y-coordinate
- in fIdrawablefR where y-coordinate fIimageYfR of the image
- should be displayed.
- .AP "int" widthPtr out
- Store width of fIimagefR (in pixels) here.
- .AP "int" heightPtr out
- Store height of fIimagefR (in pixels) here.
- .BE
- .SH DESCRIPTION
- .PP
- These procedures are invoked by widgets that wish to display images.
- fBTk_GetImagefR is invoked by a widget when it first decides to
- display an image.
- fInamefR gives the name of the desired image and fItkwinfR
- identifies the window where the image will be displayed.
- fBTk_GetImagefR looks up the image in the table of existing
- images and returns a token for a new instance of the image.
- If the image doesn't exist then fBTk_GetImagefR returns NULL
- and leaves an error message in fIinterp->resultfR.
- .PP
- When a widget wishes to actually display an image it must
- call fBTk_RedrawImagefR, identifying the image (fIimagefR),
- a region within the image to redisplay (fIimageXfR, fIimageYfR,
- fIwidthfR, and fIheightfR), and a place to display the
- image (fIdrawablefR, fIdrawableXfR, and fIdrawableYfR).
- Tk will then invoke the appropriate image manager, which will
- display the requested portion of the image before returning.
- .PP
- A widget can find out the dimensions of an image by calling
- fBTk_SizeOfImagefR: the width and height will be stored
- in the locations given by fIwidthPtrfR and fIheightPtrfR,
- respectively.
- .PP
- When a widget is finished with an image (e.g., the widget is
- being deleted or it is going to use a different image instead
- of the current one), it must call fBTk_FreeImagefR to
- release the image instance.
- The widget should never again use the image token after passing
- it to fBTk_FreeImagefR.
- There must be exactly one call to fBTk_FreeImagefR for each
- call to fBTk_GetImagefR.
- .PP
- If the contents or size of an image changes, then any widgets
- using the image will need to find out about the changes so that
- they can redisplay themselves.
- The fIchangeProcfR and fIclientDatafR arguments to
- fBTk_GetImagefR are used for this purpose.
- fIchangeProcfR will be called by Tk whenever a change occurs
- in the image; it must match the following prototype:
- .CS
- typedef void Tk_ImageChangedProc(
- ClientData fIclientDatafR,
- int fIxfR,
- int fIyfR,
- int fIwidthfR,
- int fIheightfR,
- int fIimageWidthfR,
- int fIimageHeightfR);
- .CE
- The fIclientDatafR argument to fIchangeProcfR is the same as the
- fIclientDatafR argument to fBTk_GetImagefR.
- It is usually a pointer to the widget record for the widget or
- some other data structure managed by the widget.
- The arguments fIxfR, fIyfR, fIwidthfR, and fIheightfR
- identify a region within the image that must be redisplayed;
- they are specified in pixels measured from the upper-left
- corner of the image.
- The arguments fIimageWidthfR and fIimageHeightfR give
- the image's (new) size.
- .SH "SEE ALSO"
- Tk_CreateImageType
- .SH KEYWORDS
- images, redisplay