Debian Codegraph @

pod/Image.pod

raw
1 # Copyright (c) 1994 The Regents of the University of California.
2 # Copyright (c) 1994-1996 Sun Microsystems, Inc.
3 # See the file "license.terms" for information on usage and redistribution
4 # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
5 #
6 #
7
8 =head1 NAME
9
10 Tk::Image - Create and manipulate images
11
12 =for category Tk Image Classes
13
14 =head1 SYNOPSIS
15
16 I<$image> = I<$widget>-E<gt>I<type>(?I<arg arg ...>?)
17
18 I<$image>-E<gt>I<method>(?I<arg arg ...>?)
19
20 =head1 DESCRIPTION
21
22 The B<image> constructors and methods are used to create, delete, and query images.
23 It can take several different forms, depending on the
24 I<type>.
25
26 The constructors require a I<$widget> to invoke them, this is used
27 to locate a B<MainWindow>. (This is because the underlying Tk code
28 registers the images in the data structure for the B<MainWindow>.)
29
30 The legal forms are:
31
32 =over 4
33
34 =item I<$widget>-E<gt>I<type>?(?I<name>?,?I<option>=E<gt>I<value ...>)?
35
36 Creates a new image and returns an object.
37 I<type> specifies the type of the image, which must be one of
38 the types currently defined (e.g., B<Bitmap>).
39 I<name> specifies the name for the image; if it is omitted then
40 Tk picks a name of the form B<image>I<x>, where I<x> is
41 an integer.
42 There may be any number of I<option>=E<gt>I<value> pairs,
43 which provide configuration options for the new image.
44 The legal set of options is defined separately for each image
45 type; see below for details on the options for built-in image types.
46 If an image already exists by the given name then it is replaced
47 with the new image and any instances of that image will redisplay
48 with the new contents.
49
50 =item I<$image>-E<gt>B<delete>
51
52 Deletes the image I<$image> and returns an empty string.
53 If there are instances of the image displayed in widgets,
54 the image won't actually be deleted until all of the instances
55 are released.
56 However, the association between the instances and the image
57 manager will be dropped.
58 Existing instances will retain their sizes but redisplay as
59 empty areas.
60 If a deleted image is recreated (with the same I<name>)
61 the existing instances will use the new image.
62
63 =item I<$image>-E<gt>B<height>
64
65 Returns a decimal string giving the height of image I<name>
66 in pixels.
67
68 =item I<$image>-E<gt>B<inuse>
69
70 Returns a boolean value indicating whether or not the image is in use
71 by any widgets.
72
73 =item I<$widget>-E<gt>B<imageNames>
74
75 Returns a list containing all existing images for I<$widget>'s
76 B<MainWindow>.
77
78 =item I<$image>-E<gt>B<type>
79
80 Returns the type of I<$image> (the value of the I<type>
81 method when the image was created).
82
83 =item I<$widget>-E<gt>B<imageTypes>
84
85 Returns a list whose elements are all of the valid image types
86 (i.e., all of the values that may be supplied for the I<type>
87 to create an image).
88
89 =item I<$image>-E<gt>B<width>
90
91 Returns a decimal string giving the width of image I<name>
92 in pixels.
93
94 =back
95
96 =head1 BUILT-IN IMAGE TYPES
97
98 The following image types are defined by Tk so they will be available
99 in any Tk application.
100 Individual applications or extensions may define additional types.
101
102 =over 4
103
104 =item B<Bitmap>
105
106 Each pixel in the image displays a foreground color, a background
107 color, or nothing.
108 See L<Tk::Bitmap> for more information.
109
110 =item B<Pixmap>
111
112 B<Pixmap> is slightly more general than B<Bitmap>, each pixel can
113 be any available color or "transparent" (rendered as background color of the
114 widget image is displayed in). B<Pixmap> is best used for icons and other
115 simple graphics with only a few colors.
116
117 B<Pixmap> is derived from Tix. See L<Tk::Pixmap> for more information.
118
119 =item B<Photo>
120
121 Displays a variety of full-color images, using dithering to
122 approximate colors on displays with limited color capabilities.
123 See L<Tk::Photo> documentation for more information.
124
125 =back
126
127 =head1 CAVEATS
128
129 It's necessary to use the L</delete> method to delete an image object
130 and free memory associated with it. Just using a lexical variable for
131 storing the image object and letting the variable to go out of scope
132 or setting to C<undef> is not sufficient.
133
134 =head1 SEE ALSO
135
136 L<Tk::Bitmap|Tk::Bitmap>
137 L<Tk::Pixmap|Tk::Pixmap>
138 L<Tk::Photo|Tk::Photo>
139
140 =head1 KEYWORDS
141
142 height, image, types of images, width
143
144 =cut
145