1XmGetPixmapByDepth(library call) XmGetPixmapByDepth(library call)
2
3
4
6 XmGetPixmapByDepth — A pixmap caching function that generates a pixmap,
7 stores it in a pixmap cache, and returns the pixmap
8
10 #include <Xm/Xm.h>
11 Pixmap XmGetPixmapByDepth(
12 Screen *screen,
13 char *image_name,
14 Pixel foreground,
15 Pixel background,
16 int depth);
17
19 XmGetPixmapByDepth uses the parameter data to perform a lookup in the
20 pixmap cache to see if a pixmap has already been generated that matches
21 the data. If one is found, a reference count is incremented and the
22 pixmap is returned. Applications should use XmDestroyPixmap when the
23 pixmap is no longer needed.
24
25 screen Specifies the display screen on which the pixmap is to be
26 drawn
27
28 image_name
29 Specifies the name of the image to be used to generate the
30 pixmap
31
32 foreground
33 Combines the image with the foreground color to create the
34 pixmap if the image referenced is a bit-per-pixel image
35
36 background
37 Combines the image with the background color to create the
38 pixmap if the image referenced is a bit-per-pixel image
39
40 depth Specifies the depth of the pixmap
41
42 If a matching pixmap is not found, image_name is used to perform a
43 lookup in the image cache. If an image is found, it is used to generate
44 the pixmap, which is then cached and returned.
45
46 If an image is not found, image_name is used as a filename, and a
47 search is made for an X10 or X11 bitmap file. If it is found, the file
48 is read, converted into an image, and cached in the image cache. The
49 image is then used to generate a pixmap, which is cached and returned.
50
51 If image_name has a leading / (slash), it specifies a full pathname,
52 and XmGetPixmapByDepth opens the file as specified. Otherwise,
53 image_name specifies a filename. In this case, XmGetPixmapByDepth
54 looks for the file along a search path specified by the XBMLANGPATH
55 environment variable or by a default search path, which varies depend‐
56 ing on whether or not the XAPPLRESDIR environment variable is set. The
57 default search path contains a lot of directories. Therefore, XmGet‐
58 PixmapByDepth will need a relatively long time to search through all
59 these directories for pixmaps and bitmaps. Applications that use a lot
60 of pixmaps and bitmaps will probably run more quickly if XBMLANGPATH is
61 set to a short list of directories. In addition to X bitmap files
62 (XBM), Motif also supports XPM (X Pixmap) file formats, and, from ver‐
63 sion 2.3, JPEG and PNG image formats. (Note that support of JPEG and
64 PNG image format is an optional feature of Motif, in order to check if
65 current version supports PNG ang JPEG image formats the PNG_SUPPORT and
66 JPEG_SUPPORT macros should be checked correspondingly.) The XBMLANG‐
67 PATH specifies the path for both XBM, XPM, PNG and JPEG files. XPM
68 files are described in more detail later in this reference page.
69
70 The XBMLANGPATH environment variable specifies a search path for X bit‐
71 map files. It can contain the substitution field %B, where the
72 image_name argument to XmGetPixmapByDepth is substituted for %B. It
73 can also contain the substitution fields accepted by XtResolvePathname.
74 The substitution field %T is always mapped to bitmaps, and %S is always
75 mapped to NULL.
76
77 If XBMLANGPATH is not set, but the environment variable XAPPLRESDIR is
78 set, the following pathnames are searched:
79
80 · %B
81
82 · $XAPPLRESDIR/%L/bitmaps/%N/%B
83
84 · $XAPPLRESDIR/%l_%t/bitmaps/%N/%B
85
86 · $XAPPLRESDIR/%l/bitmaps/%N/%B
87
88 · $XAPPLRESDIR/bitmaps/%N/%B
89
90 · $XAPPLRESDIR/%L/bitmaps/%B
91
92 · $XAPPLRESDIR/%l_%t/bitmaps/%B
93
94 · $XAPPLRESDIR/%l/bitmaps/%B
95
96 · $XAPPLRESDIR/bitmaps/%B
97
98 · $HOME/bitmaps/%B
99
100 · $HOME/%B
101
102 · /usr/lib/X11/%L/bitmaps/%N/%B
103
104 · /usr/lib/X11/%l_%t/bitmaps/%N/%B
105
106 · /usr/lib/X11/%l/bitmaps/%N/%B
107
108 · /usr/lib/X11/bitmaps/%N/%B
109
110 · /usr/lib/X11/%L/bitmaps/%B
111
112 · /usr/lib/X11/%l_%t/bitmaps/%B
113
114 · /usr/lib/X11/%l/bitmaps/%B
115
116 · /usr/lib/X11/bitmaps/%B
117
118 · /usr/include/X11/bitmaps/%B
119
120 If neither XBMLANGPATH nor XAPPLRESDIR is set, the following pathnames
121 are searched:
122
123 · %B
124
125 · $HOME/%L/bitmaps/%N/%B
126
127 · $HOME/%l_%t/bitmaps/%N/%B
128
129 · $HOME/%l/bitmaps/%N/%B
130
131 · $HOME/bitmaps/%N/%B
132
133 · $HOME/%L/bitmaps/%B
134
135 · $HOME/%l_%t/bitmaps/%B
136
137 · $HOME/%l/bitmaps/%B
138
139 · $HOME/bitmaps/%B
140
141 · $HOME/%B
142
143 · /usr/lib/X11/%L/bitmaps/%N/%B
144
145 · /usr/lib/X11/%l_%t/bitmaps/%N/%B
146
147 · /usr/lib/X11/%l/bitmaps/%N/%B
148
149 · /usr/lib/X11/bitmaps/%N/%B
150
151 · /usr/lib/X11/%L/bitmaps/%B
152
153 · /usr/lib/X11/%l_%t/bitmaps/%B
154
155 · /usr/lib/X11/%l/bitmaps/%B
156
157 · /usr/lib/X11/bitmaps/%B
158
159 · /usr/include/X11/bitmaps/%B
160
161 These paths are defaults that vendors may change. For example, a ven‐
162 dor may use different directories for /usr/lib/X11 and
163 /usr/include/X11.
164
165 The following substitutions are used in these paths:
166
167 %B The image name, from the image_name argument
168
169 %N The class name of the application
170
171 %L The display's language string. This string is influenced by
172 XtSetLanguageProc. The default string is determined by call‐
173 ing setlocale(LC_ALL, NULL).
174
175 %l_%t The language and territory component of the display's lan‐
176 guage string
177
178 %l The language component of the display's language string
179
180 The contents of the file must conform to the rules for X11 bitmap
181 files. In other words, Motif can read any X11 conformant bitmap file.
182
183 The XPM file format is used for storing or getting back colored X
184 pixmaps from files. The XPM library is provided as unsupported with
185 Motif. To build applications without XPM, use the NO_XPM macro. The
186 following shows both XBM and XPM files, respectively, for a plaid pat‐
187 tern.
188
189 /* XBM file */
190 #define plaid_width 22
191 #define plaid_height 22
192 #define plaid_x_hot -1
193 #define plaid_y_hot -1
194 static char plaid_bits[] = {
195 0x75, 0xfd, 0x3f, 0xaa, 0xfa, 0x3e, 0x75, 0xfd, 0x3f, 0xaa, 0xfa, 0x3e,
196 0x75, 0xfd, 0x3f, 0xff, 0x57, 0x15, 0x75, 0xfd, 0x3f, 0xaa, 0xfa, 0x3e,
197 0x75, 0xfd, 0x3f, 0xaa, 0xfa, 0x3e, 0x75, 0xfd, 0x3f, 0x20, 0xa8, 0x2b,
198 0x20, 0x50, 0x15, 0x20, 0xa8, 0x2b, 0x20, 0x50, 0x15, 0x20, 0xa8, 0x2b,
199 0xff, 0xff, 0x3f, 0x20, 0xa8, 0x2b, 0x20, 0x50, 0x15, 0x20, 0xa8, 0x2b,
200 0x20, 0x50, 0x15, 0x20, 0xa8, 0x2b};
201
202 /* XPM file */
203 static char * plaid[] = {
204 /* plaid pixmap
205 * width height ncolors chars_per_pixel */
206 "22 22 4 2 ",
207 /* colors */
208 " c red m white s light_color ",
209 "Y c green m black s lines_in_mix ",
210 "+ c yellow m white s lines_in_dark ",
211 "x m black s dark_color ",
212 /* pixels */
213 "x x x x x x x x x x x x + x x x x x ",
214 " x x x x x x x x x x x x x x x x ",
215 "x x x x x x x x x x x x + x x x x x ",
216 " x x x x x x x x x x x x x x x x ",
217 "x x x x x x x x x x x x + x x x x x ",
218 "Y Y Y Y Y x Y Y Y Y Y + x + x + x + x + x + ",
219 "x x x x x x x x x x x x + x x x x x ",
220 " x x x x x x x x x x x x x x x x ",
221 "x x x x x x x x x x x x + x x x x x ",
222 " x x x x x x x x x x x x x x x x ",
223 "x x x x x x x x x x x x + x x x x x ",
224 " x x x x Y x x x ",
225 " x x x Y x x ",
226 " x x x x Y x x x ",
227 "x x x x x x x x x x x x x x x x x x x x x x ",
228 " x x x x Y x x x ",
229 " x x x Y x x ",
230 " x x x x Y x x x ",
231 " x x x Y x x ",
232 " x x x x Y x x x "
233 };
234
236 Returns a pixmap when successful; returns XmUNSPECIFIED_PIXMAP if the
237 image corresponding to image_name cannot be found.
238
240 XmDestroyPixmap(3), XmInstallImage(3), and XmUninstallImage(3).
241
242
243
244 XmGetPixmapByDepth(library call)