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), OpenMotif also supports XPM (X Pixmap) file formats, and, from
63 version 2.3, JPEG and PNG image formats. (Note that support of JPEG
64 and PNG image format is an optional feature of OpenMotif, in order to
65 check if current version supports PNG ang JPEG image formats the
66 PNG_SUPPORT and JPEG_SUPPORT macros should be checked correspondingly.)
67 The XBMLANGPATH specifies the path for both XBM, XPM, PNG and JPEG
68 files. XPM files are described in more detail later in this reference
69 page.
70
71 The XBMLANGPATH environment variable specifies a search path for X bit‐
72 map files. It can contain the substitution field %B, where the
73 image_name argument to XmGetPixmapByDepth is substituted for %B. It
74 can also contain the substitution fields accepted by XtResolvePathname.
75 The substitution field %T is always mapped to bitmaps, and %S is always
76 mapped to NULL.
77
78 If XBMLANGPATH is not set, but the environment variable XAPPLRESDIR is
79 set, the following pathnames are searched:
80
81 · %B
82
83 · $XAPPLRESDIR/%L/bitmaps/%N/%B
84
85 · $XAPPLRESDIR/%l_%t/bitmaps/%N/%B
86
87 · $XAPPLRESDIR/%l/bitmaps/%N/%B
88
89 · $XAPPLRESDIR/bitmaps/%N/%B
90
91 · $XAPPLRESDIR/%L/bitmaps/%B
92
93 · $XAPPLRESDIR/%l_%t/bitmaps/%B
94
95 · $XAPPLRESDIR/%l/bitmaps/%B
96
97 · $XAPPLRESDIR/bitmaps/%B
98
99 · $HOME/bitmaps/%B
100
101 · $HOME/%B
102
103 · /usr/lib/X11/%L/bitmaps/%N/%B
104
105 · /usr/lib/X11/%l_%t/bitmaps/%N/%B
106
107 · /usr/lib/X11/%l/bitmaps/%N/%B
108
109 · /usr/lib/X11/bitmaps/%N/%B
110
111 · /usr/lib/X11/%L/bitmaps/%B
112
113 · /usr/lib/X11/%l_%t/bitmaps/%B
114
115 · /usr/lib/X11/%l/bitmaps/%B
116
117 · /usr/lib/X11/bitmaps/%B
118
119 · /usr/include/X11/bitmaps/%B
120
121 If neither XBMLANGPATH nor XAPPLRESDIR is set, the following pathnames
122 are searched:
123
124 · %B
125
126 · $HOME/%L/bitmaps/%N/%B
127
128 · $HOME/%l_%t/bitmaps/%N/%B
129
130 · $HOME/%l/bitmaps/%N/%B
131
132 · $HOME/bitmaps/%N/%B
133
134 · $HOME/%L/bitmaps/%B
135
136 · $HOME/%l_%t/bitmaps/%B
137
138 · $HOME/%l/bitmaps/%B
139
140 · $HOME/bitmaps/%B
141
142 · $HOME/%B
143
144 · /usr/lib/X11/%L/bitmaps/%N/%B
145
146 · /usr/lib/X11/%l_%t/bitmaps/%N/%B
147
148 · /usr/lib/X11/%l/bitmaps/%N/%B
149
150 · /usr/lib/X11/bitmaps/%N/%B
151
152 · /usr/lib/X11/%L/bitmaps/%B
153
154 · /usr/lib/X11/%l_%t/bitmaps/%B
155
156 · /usr/lib/X11/%l/bitmaps/%B
157
158 · /usr/lib/X11/bitmaps/%B
159
160 · /usr/include/X11/bitmaps/%B
161
162 These paths are defaults that vendors may change. For example, a ven‐
163 dor may use different directories for /usr/lib/X11 and
164 /usr/include/X11.
165
166 The following substitutions are used in these paths:
167
168 %B The image name, from the image_name argument
169
170 %N The class name of the application
171
172 %L The display's language string. This string is influenced by
173 XtSetLanguageProc. The default string is determined by call‐
174 ing setlocale(LC_ALL, NULL).
175
176 %l_%t The language and territory component of the display's lan‐
177 guage string
178
179 %l The language component of the display's language string
180
181 The contents of the file must conform to the rules for X11 bitmap
182 files. In other words, Motif can read any X11 conformant bitmap file.
183
184 The XPM file format is used for storing or getting back colored X
185 pixmaps from files. The XPM library is provided as unsupported with
186 Motif. To build applications without XPM, use the NO_XPM macro. The
187 following shows both XBM and XPM files, respectively, for a plaid pat‐
188 tern.
189
190 /* XBM file */
191 #define plaid_width 22
192 #define plaid_height 22
193 #define plaid_x_hot -1
194 #define plaid_y_hot -1
195 static char plaid_bits[] = {
196 0x75, 0xfd, 0x3f, 0xaa, 0xfa, 0x3e, 0x75, 0xfd, 0x3f, 0xaa, 0xfa, 0x3e,
197 0x75, 0xfd, 0x3f, 0xff, 0x57, 0x15, 0x75, 0xfd, 0x3f, 0xaa, 0xfa, 0x3e,
198 0x75, 0xfd, 0x3f, 0xaa, 0xfa, 0x3e, 0x75, 0xfd, 0x3f, 0x20, 0xa8, 0x2b,
199 0x20, 0x50, 0x15, 0x20, 0xa8, 0x2b, 0x20, 0x50, 0x15, 0x20, 0xa8, 0x2b,
200 0xff, 0xff, 0x3f, 0x20, 0xa8, 0x2b, 0x20, 0x50, 0x15, 0x20, 0xa8, 0x2b,
201 0x20, 0x50, 0x15, 0x20, 0xa8, 0x2b};
202
203 /* XPM file */
204 static char * plaid[] = {
205 /* plaid pixmap
206 * width height ncolors chars_per_pixel */
207 "22 22 4 2 ",
208 /* colors */
209 " c red m white s light_color ",
210 "Y c green m black s lines_in_mix ",
211 "+ c yellow m white s lines_in_dark ",
212 "x m black s dark_color ",
213 /* pixels */
214 "x 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 ",
216 "x 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 ",
218 "x x x x x x x x x x x x + x x x x x ",
219 "Y Y Y Y Y x Y Y Y Y Y + x + x + x + x + x + ",
220 "x 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 ",
222 "x 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 ",
224 "x x x x x x x x x x x x + x x x x x ",
225 " x x x x Y x x x ",
226 " x x x Y x x ",
227 " x x x x Y x x x ",
228 "x x x x x x x x x x x x x x x x x x x x x x ",
229 " x x x x Y x x x ",
230 " x x x Y x x ",
231 " x x x x Y x x x ",
232 " x x x Y x x ",
233 " x x x x Y x x x "
234 };
235
237 Returns a pixmap when successful; returns XmUNSPECIFIED_PIXMAP if the
238 image corresponding to image_name cannot be found.
239
241 XmDestroyPixmap(3), XmInstallImage(3), and XmUninstallImage(3).
242
243
244
245 XmGetPixmapByDepth(library call)