Commit | Line | Data |
---|---|---|
86530b38 AT |
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<$widget>-E<gt>B<imageNames> | |
69 | ||
70 | Returns a list containing all existing images for I<$widget>'s | |
71 | B<MainWindow>. | |
72 | ||
73 | =item I<$image>-E<gt>B<type> | |
74 | ||
75 | Returns the type of I<$image> (the value of the I<type> | |
76 | method when the image was created). | |
77 | ||
78 | =item I<$widget>-E<gt>B<imageTypes> | |
79 | ||
80 | Returns a list whose elements are all of the valid image types | |
81 | (i.e., all of the values that may be supplied for the I<type> | |
82 | to create an image). | |
83 | ||
84 | =item I<$image>-E<gt>B<width> | |
85 | ||
86 | Returns a decimal string giving the width of image I<name> | |
87 | in pixels. | |
88 | ||
89 | =back | |
90 | ||
91 | =head1 BUILT-IN IMAGE TYPES | |
92 | ||
93 | The following image types are defined by Tk so they will be available | |
94 | in any Tk application. | |
95 | Individual applications or extensions may define additional types. | |
96 | ||
97 | =over 4 | |
98 | ||
99 | =item B<Bitmap> | |
100 | ||
101 | Each pixel in the image displays a foreground color, a background | |
102 | color, or nothing. | |
103 | See L<Tk::Bitmap> for more information. | |
104 | ||
105 | =item B<Pixmap> | |
106 | ||
107 | B<Pixmap> is slightly more general than B<Bitmap>, each pixel can | |
108 | be any available color or "transparent" (rendered as background color of the | |
109 | widget image is displayed in). B<Pixmap> is best used for icons and other | |
110 | simple graphics with only a few colors. | |
111 | ||
112 | B<Pixmap> is derived from Tix. See L<Tk::Pixmap> for more information. | |
113 | ||
114 | =item B<Photo> | |
115 | ||
116 | Displays a variety of full-color images, using dithering to | |
117 | approximate colors on displays with limited color capabilities. | |
118 | See L<Tk::Photo> documentation for more information. | |
119 | ||
120 | =back | |
121 | ||
122 | =head1 SEE ALSO | |
123 | ||
124 | L<Tk::Bitmap|Tk::Bitmap> | |
125 | L<Tk::Pixmap|Tk::Pixmap> | |
126 | L<Tk::Photo|Tk::Photo> | |
127 | ||
128 | =head1 KEYWORDS | |
129 | ||
130 | height, image, types of images, width | |
131 | ||
132 | =cut | |
133 |