TkImage is a base class for a class defining a new Tk image type. The image type defined here differs slightly from standard Tk image types, such as photo or bitmap in that it is only allowed to display a given image in a single widget and you can optionally specify what type of widget that should be.
The intent here is that you specify that the image can only be in, say, a canvas window. Since a given image "instance" can only be displayed in one canvas window (as far as Tk is concerned), you can use the scrolling offsets of the canvas to implement intelligent scrolling. It is still possible to display an image in multiple widgets, but this must be handled in the derived class (see RtdImage(3) for an example). The restriction comes about, because of the way Tk handles images in multiple widgets. Normally, if one changes size, the others do as well. This is not necessarily what you always want in an image processing application. You may want to have the same image at different sizes sharing the same data.
This class does some of the abstract work for dealing with Tk images. It declares some of the static member functions that Tk calls for image handling ( GetImage , DisplayImage , FreeImage and DeleteImage ) and calls virtual member functions where necessary to handle the actual display of the image.
This class also defines and implements the " configure " and " cget " image commands. The derived class passes the TkImage constructor information about the configuration options ( optionsPtr_ and configSpecsPtr_ ) for use in these subcommands. The derived class may still need to redefine the " configureImage " method in order to handle certain options, but most of the work is done in this base class. See TkWidget(3) for more details.
Please send questions or comments to abrighto@eso.org.
Copyright © 1998 ESO - European Southern Observatory