1bitmap(n) Tk Built-In Commands bitmap(n)
2
3
4
5______________________________________________________________________________
6
8 bitmap - Images that display two colors
9
11 image create bitmap ?name? ?options?
12
13 imageName cget option
14 imageName configure ?option? ?value option value ...?
15______________________________________________________________________________
16
18 A bitmap is an image whose pixels can display either of two colors or
19 be transparent. A bitmap image is defined by four things: a back‐
20 ground color, a foreground color, and two bitmaps, called the source
21 and the mask. Each of the bitmaps specifies 0/1 values for a rectangu‐
22 lar array of pixels, and the two bitmaps must have the same dimensions.
23 For pixels where the mask is zero, the image displays nothing, produc‐
24 ing a transparent effect. For other pixels, the image displays the
25 foreground color if the source data is one and the background color if
26 the source data is zero.
27
29 Like all images, bitmaps are created using the image create command.
30 Bitmaps support the following options:
31
32 -background color
33 Specifies a background color for the image in any of the stan‐
34 dard ways accepted by Tk. If this option is set to an empty
35 string then the background pixels will be transparent. This
36 effect is achieved by using the source bitmap as the mask bit‐
37 map, ignoring any -maskdata or -maskfile options.
38
39 -data string
40 Specifies the contents of the source bitmap as a string. The
41 string must adhere to X11 bitmap format (e.g., as generated by
42 the bitmap program). If both the -data and -file options are
43 specified, the -data option takes precedence.
44
45 -file name
46 name gives the name of a file whose contents define the source
47 bitmap. The file must adhere to X11 bitmap format (e.g., as
48 generated by the bitmap program).
49
50 -foreground color
51 Specifies a foreground color for the image in any of the stan‐
52 dard ways accepted by Tk.
53
54 -maskdata string
55 Specifies the contents of the mask as a string. The string must
56 adhere to X11 bitmap format (e.g., as generated by the bitmap
57 program). If both the -maskdata and -maskfile options are spec‐
58 ified, the -maskdata option takes precedence.
59
60 -maskfile name
61 name gives the name of a file whose contents define the mask.
62 The file must adhere to X11 bitmap format (e.g., as generated by
63 the bitmap program).
64
66 When a bitmap image is created, Tk also creates a new command whose
67 name is the same as the image. This command may be used to invoke var‐
68 ious operations on the image. It has the following general form:
69 imageName option ?arg arg ...?
70 Option and the args determine the exact behavior of the command. The
71 following commands are possible for bitmap images:
72
73 imageName cget option
74 Returns the current value of the configuration option given by
75 option. Option may have any of the values accepted by the image
76 create bitmap command.
77
78 imageName configure ?option? ?value option value ...?
79 Query or modify the configuration options for the image. If no
80 option is specified, returns a list describing all of the avail‐
81 able options for imageName (see Tk_ConfigureInfo for information
82 on the format of this list). If option is specified with no
83 value, then the command returns a list describing the one named
84 option (this list will be identical to the corresponding sublist
85 of the value returned if no option is specified). If one or
86 more option-value pairs are specified, then the command modifies
87 the given option(s) to have the given value(s); in this case
88 the command returns an empty string. Option may have any of the
89 values accepted by the image create bitmap command.
90
92 bitmap, image
93
94
95
96Tk 4.0 bitmap(n)