1Image(3)              User Contributed Perl Documentation             Image(3)
2
3
4

NAME

6       Tk::Image - Create and manipulate images
7

SYNOPSIS

9       $image = $widget->type(?arg arg ...?)
10
11       $image->method(?arg arg ...?)
12

DESCRIPTION

14       The image constructors and methods are used to create, delete, and
15       query images.  It can take several different forms, depending on the
16       type.
17
18       The constructors require a $widget to invoke them, this is used to
19       locate a MainWindow. (This is because the underlying Tk code registers
20       the images in the data structure for the MainWindow.)
21
22       The legal forms are:
23
24       $widget->type?(?name?,?option=>value ...)?
25           Creates a new image and returns an object.  type specifies the type
26           of the image, which must be one of the types currently defined
27           (e.g., Bitmap).  name specifies the name for the image;  if it is
28           omitted then Tk picks a name of the form imagex, where x is an
29           integer.  There may be any number of option=>value pairs, which
30           provide configuration options for the new image.  The legal set of
31           options is defined separately for each image type;  see below for
32           details on the options for built-in image types.  If an image
33           already exists by the given name then it is replaced with the new
34           image and any instances of that image will redisplay with the new
35           contents.
36
37       $image->delete
38           Deletes the image $image and returns an empty string.  If there are
39           instances of the image displayed in widgets, the image won't actu‐
40           ally be deleted until all of the instances are released.  However,
41           the association between the instances and the image manager will be
42           dropped.  Existing instances will retain their sizes but redisplay
43           as empty areas.  If a deleted image is recreated (with the same
44           name) the existing instances will use the new image.
45
46       $image->height
47           Returns a decimal string giving the height of image name in pixels.
48
49       $widget->imageInuse( 'name' );
50           Returns  a  boolean  value  indicating  whether or not the image
51           given by name is in use by any widgets.
52
53       $widget->imageNames
54           Returns a list containing all existing images for $widget's Main‐
55           Window.
56
57       $image->type
58           Returns the type of  $image (the value of the type method when the
59           image was created).
60
61       $widget->imageTypes
62           Returns a list whose elements are all of the valid image types
63           (i.e., all of the values that may be supplied for the type to cre‐
64           ate an image).
65
66       $image->width
67           Returns a decimal string giving the width of image name in pixels.
68

BUILT-IN IMAGE TYPES

70       The following image types are defined by Tk so they will be available
71       in any Tk application.  Individual applications or extensions may
72       define additional types.
73
74       Bitmap
75           Each pixel in the image displays a foreground color, a background
76           color, or nothing.  See Tk::Bitmap for more information.
77
78       Pixmap
79           Pixmap is slightly more general than Bitmap, each pixel can be any
80           available color or "transparent" (rendered as background color of
81           the widget image is displayed in). Pixmap is best used for icons
82           and other simple graphics with only a few colors.
83
84           Pixmap is derived from Tix. See Tk::Pixmap for more information.
85
86       Photo
87           Displays a variety of full-color images, using dithering to approx‐
88           imate colors on displays with limited color capabilities.  See
89           Tk::Photo documentation for more information.
90

CAVEATS

92       It's necessary to use the "delete" method to delete an image object and
93       free memory associated with it. Just using a lexical variable for stor‐
94       ing the image object and letting the variable to go out of scope or
95       setting to "undef" is not sufficient.
96

SEE ALSO

98       Tk::Bitmap Tk::Pixmap Tk::Photo
99

KEYWORDS

101       height, image, types of images, width
102
103
104
105perl v5.8.8                       2008-02-05                          Image(3)
Impressum