Tk_GetImage, Tk_RedrawImage, Tk_SizeOfImage, Tk_FreeImage − use an image in a widget


#include <tk.h>

(interp, tkwin, name, changeProc, clientData)

Tk_RedrawImage(image, imageX, imageY, width, height, drawable, drawableX, drawableY)

Tk_SizeOfImage(image, widthPtr, heightPtr)



Tcl_Interp *interp (in)

Place to leave error message.

Tk_Window tkwin (in)

Window in which image will be used.

const char *name (in)

Name of image.

Tk_ImageChangedProc *changeProc (in)

Procedure for Tk to invoke whenever image content or size changes.

ClientData clientData (in)

One-word value for Tk to pass to changeProc.

Tk_Image image (in)

Token for image instance; must have been returned by a previous call to Tk_GetImage.

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).

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).

int width ((in))

Width of region of image to redisplay.

int height ((in))

Height of region of image to redisplay.

Drawable drawable (in)

Where to display image. Must either be window specified to Tk_GetImage or a pixmap compatible with that window.

int drawableX (in)

Where to display image in drawable: this is the x-coordinate in drawable where x-coordinate imageX of the image should be displayed.

int drawableY (in)

Where to display image in drawable: this is the y-coordinate in drawable where y-coordinate imageY of the image should be displayed.

int widthPtr (out)

Store width of image (in pixels) here.

int heightPtr (out)

Store height of image (in pixels) here.



These procedures are invoked by widgets that wish to display images. Tk_GetImage is invoked by a widget when it first decides to display an image. name gives the name of the desired image and tkwin identifies the window where the image will be displayed. Tk_GetImage looks up the image in the table of existing images and returns a token for a new instance of the image. If the image does not exist then Tk_GetImage returns NULL and leaves an error message in interp->result.

When a widget wishes to actually display an image it must call Tk_RedrawImage, identifying the image (image), a region within the image to redisplay (imageX, imageY, width, and height), and a place to display the image (drawable, drawableX, and drawableY). Tk will then invoke the appropriate image manager, which will display the requested portion of the image before returning.

A widget can find out the dimensions of an image by calling Tk_SizeOfImage: the width and height will be stored in the locations given by widthPtr and heightPtr, respectively.

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 Tk_FreeImage to release the image instance. The widget should never again use the image token after passing it to Tk_FreeImage. There must be exactly one call to Tk_FreeImage for each call to Tk_GetImage.

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 changeProc and clientData arguments to Tk_GetImage are used for this purpose. changeProc will be called by Tk whenever a change occurs in the image; it must match the following prototype:

typedef void Tk_ImageChangedProc(
ClientData clientData,
int x,
int y,
int width,
int height,
int imageWidth,
int imageHeight);

The clientData argument to changeProc is the same as the clientData argument to Tk_GetImage. It is usually a pointer to the widget record for the widget or some other data structure managed by the widget. The arguments x, y, width, and height 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 imageWidth and imageHeight give the image’s (new) size.




images, redisplay

More Linux Commands

gnutls_x509_crt_check_revocation(3) - API function (ManPage)
This function will return check if the given certificate is revoked. It is assumed that the CRLs have been verified before. RETURNS 0 if the certificate is NOT

XmbTextPropertyToTextList(3) - convert text lists and text p
The XmbTextListToTextProperty, XwcTextListToTextProperty and Xutf8TextListToTextProperty functions set the specified XTextProperty value to a set of null-separa

XtGrabButton(3) - manage grabs (Library - Linux man page)...
XtGrabKey calls XGrabKey specifying the widgets window as the grab window if the widget is realized. The remaining arguments are exactly as for XGrabKey. If the

radeonhd(4) - AMD GPG (ATI) R5xx/R6xx/R7xx video driver.....
radeonhd is an Xorg driver for AMD GPG (ATI) R5xx/R6xx/R7xx based video cards. At the time of this writing, radeonhd has the following limitations: * Support fo

ifservices(5) - control network services with ifup/down.....
The directory /etc/sysconfig/network/ifservices-&lt;configuration_name&gt;/ is read by the script /etc/sysconfig/network/scripts/ifup-services which starts and stops

glLightfv(3gl) - set light source parameters (Man Page).....
glLight sets the values of individual light source parameters. light names the light and is a symbolic name of the form GL_LIGHT$i$, where 0 &lt;= i &lt; GL_MAX_LIGHT

kate(1) - Advanced text editor for KDE - Linux manual page
Kate is the KDE Advanced Text Editor. Kate also provides the editor part for various applications, under the name KWrite. Some of Kates many features include co

putw(3) - input and output of words (ints) - Linux man page
getw() reads a word (that is, an int) from stream. Its provided for compatibility with SVr4. We recommend you use fread(3) instead. putw() writes the word w (th

vwscanw(3ncurses) - convert formatted input from a curses wi
The scanw, wscanw and mvscanw routines are analogous to scanf [see scanf(3)]. The effect of these routines is as though wgetstr were called on the window, and t

hypotf(3) - Euclidean distance function - Linux manual page
The hypot() function returns sqrt(x*x+y*y). This is the length of the hypotenuse of a right-angled triangle with sides of length x and y, or the distance of the

xsetpointer(1x) - set an X Input device as the main pointer
Xsetpointer sets an XInput device as the main pointer. When called with the -l flag it lists the available devices. When called with the -c/+c flag, it toggles

Storable(3pm) - persistence for Perl data structures........
The Storable package brings persistence to your Perl data structures containing SCALAR, ARRAY, HASH or REF objects, i.e. anything that can be conveniently store

We can't live, work or learn in freedom unless the software we use is free.