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
14
16 A bitmap is an image whose pixels can display either of two colors or
17 be transparent. A bitmap image is defined by four things: a back‐
18 ground color, a foreground color, and two bitmaps, called the source
19 and the mask. Each of the bitmaps specifies 0/1 values for a rectangu‐
20 lar array of pixels, and the two bitmaps must have the same dimensions.
21 For pixels where the mask is zero, the image displays nothing, produc‐
22 ing a transparent effect. For other pixels, the image displays the
23 foreground color if the source data is one and the background color if
24 the source data is zero.
25
26
28 Like all images, bitmaps are created using the image create command.
29 Bitmaps support the following options:
30
31 -background color
32 Specifies a background color for the image in any of the stan‐
33 dard ways accepted by Tk. If this option is set to an empty
34 string then the background pixels will be transparent. This
35 effect is achieved by using the source bitmap as the mask bit‐
36 map, ignoring any -maskdata or -maskfile options.
37
38 -data string
39 Specifies the contents of the source bitmap as a string. The
40 string must adhere to X11 bitmap format (e.g., as generated by
41 the bitmap program). If both the -data and -file options are
42 specified, the -data option takes precedence.
43
44 -file name
45 name gives the name of a file whose contents define the source
46 bitmap. The file must adhere to X11 bitmap format (e.g., as
47 generated by the bitmap program).
48
49 -foreground color
50 Specifies a foreground color for the image in any of the stan‐
51 dard ways accepted by Tk.
52
53 -maskdata string
54 Specifies the contents of the mask as a string. The string must
55 adhere to X11 bitmap format (e.g., as generated by the bitmap
56 program). If both the -maskdata and -maskfile options are spec‐
57 ified, the -maskdata option takes precedence.
58
59 -maskfile name
60 name gives the name of a file whose contents define the mask.
61 The file must adhere to X11 bitmap format (e.g., as generated by
62 the bitmap program).
63
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
91
93 bitmap, image
94
95
96
97Tk 4.0 bitmap(n)