File: XmGetPixmapByDepth.3

package info (click to toggle)
motif 2.3.8-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 36,432 kB
  • sloc: ansic: 452,643; sh: 4,613; makefile: 2,030; yacc: 1,604; lex: 352; cpp: 348
file content (304 lines) | stat: -rw-r--r-- 9,742 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
'\" t
...\" GetPixB.sgm /main/10 1996/10/29 16:10:37 cdedoc $
.de P!
.fl
\!!1 setgray
.fl
\\&.\"
.fl
\!!0 setgray
.fl			\" force out current output buffer
\!!save /psv exch def currentpoint translate 0 0 moveto
\!!/showpage{}def
.fl			\" prolog
.sy sed -e 's/^/!/' \\$1\" bring in postscript file
\!!psv restore
.
.de pF
.ie     \\*(f1 .ds f1 \\n(.f
.el .ie \\*(f2 .ds f2 \\n(.f
.el .ie \\*(f3 .ds f3 \\n(.f
.el .ie \\*(f4 .ds f4 \\n(.f
.el .tm ? font overflow
.ft \\$1
..
.de fP
.ie     !\\*(f4 \{\
.	ft \\*(f4
.	ds f4\"
'	br \}
.el .ie !\\*(f3 \{\
.	ft \\*(f3
.	ds f3\"
'	br \}
.el .ie !\\*(f2 \{\
.	ft \\*(f2
.	ds f2\"
'	br \}
.el .ie !\\*(f1 \{\
.	ft \\*(f1
.	ds f1\"
'	br \}
.el .tm ? font underflow
..
.ds f1\"
.ds f2\"
.ds f3\"
.ds f4\"
.ta 8n 16n 24n 32n 40n 48n 56n 64n 72n 
.TH "XmGetPixmapByDepth" "library call"
.SH "NAME"
\fBXmGetPixmapByDepth\fP \(em A pixmap caching function that generates a pixmap, stores it in a pixmap cache, and returns the pixmap
.iX "XmGetPixmapByDepth"
.iX "pixmaps"
.SH "SYNOPSIS"
.PP
.nf
#include <Xm/Xm\&.h>
\fBPixmap \fBXmGetPixmapByDepth\fP\fR(
\fBScreen *\fBscreen\fR\fR,
\fBchar *\fBimage_name\fR\fR,
\fBPixel \fBforeground\fR\fR,
\fBPixel \fBbackground\fR\fR,
\fBint \fBdepth\fR\fR);
.fi
.SH "DESCRIPTION"
.PP
\fBXmGetPixmapByDepth\fP uses the parameter data to perform a lookup in the
pixmap cache to see if a pixmap has already been generated that
matches the data\&. If one is found, a reference count is incremented
and the pixmap is returned\&. Applications should use \fBXmDestroyPixmap\fP
when the pixmap is no longer needed\&.
.IP "\fIscreen\fP" 10
Specifies the display screen on which the pixmap is to
be drawn
.IP "\fIimage_name\fP" 10
Specifies the name of the image to be used to
generate the pixmap
.IP "\fIforeground\fP" 10
Combines the image with the \fIforeground\fP color to create the pixmap
if the image referenced is a bit-per-pixel image
.IP "\fIbackground\fP" 10
Combines the image with the \fIbackground\fP color to create the pixmap
if the image referenced is a bit-per-pixel image
.IP "\fIdepth\fP" 10
Specifies the depth of the pixmap
.PP
If a matching pixmap is not found,
\fIimage_name\fP is used to perform a lookup in
the image cache\&. If an image is found, it is used to generate the pixmap,
which is then cached and returned\&.
.PP
If an image is not found,
\fIimage_name\fP is used as a filename, and a search is made for
an \fBX10\fP or \fBX11\fP bitmap file\&. If it is found, the file is
read, converted into an image, and cached in the image cache\&. The image
is then used to generate a pixmap, which is cached and returned\&.
.PP
If \fIimage_name\fP has a leading / (slash), it specifies a full
pathname, and \fBXmGetPixmapByDepth\fP opens the file as specified\&.
Otherwise, \fIimage_name\fP specifies a filename\&.
In this case, \fBXmGetPixmapByDepth\fP looks for the file along a search
path specified by the \fBXBMLANGPATH\fP environment variable or by a
default search path, which varies depending on whether or not the
\fBXAPPLRESDIR\fP environment variable is set\&.
The default search path contains a lot of directories\&.
Therefore, \fBXmGetPixmapByDepth\fP will need a relatively
long time to search through all these directories for pixmaps
and bitmaps\&. Applications that use a lot of pixmaps and bitmaps
will probably run more quickly if
\fBXBMLANGPATH\fP is set to a short list of directories\&.
In addition to X bitmap files (XBM), Motif also supports XPM (X
Pixmap) file formats, and, from version 2.3, JPEG and PNG image formats\&.
(Note that support of JPEG and PNG image format is an optional feature
of Motif, in order to check if current version supports PNG and JPEG
image formats the PNG_SUPPORT and JPEG_SUPPORT macros should be checked
correspondingly.)
The \fBXBMLANGPATH\fP specifies the path for
both XBM, XPM, PNG and JPEG files\&. XPM files are described in more detail later
in this reference page\&.
.PP
The \fBXBMLANGPATH\fP environment variable specifies a search path
for X bitmap files\&.
It can contain the substitution field \fB%B\fP, where the \fIimage_name\fP
argument to \fBXmGetPixmapByDepth\fP is substituted for \fB%B\fP\&.
It can also contain the substitution fields accepted by
\fBXtResolvePathname\fP\&.
The substitution field \fB%T\fP is always mapped to \fIbitmaps\fP, and \fB%S\fP is
always mapped to NULL\&.
.PP
If \fBXBMLANGPATH\fP is not set, but the environment variable
\fBXAPPLRESDIR\fP is set, the following pathnames are searched:
.IP "   \(bu" 6
\fB%B\fP
.IP "   \(bu" 6
\fB$XAPPLRESDIR/%L/bitmaps/%N/%B\fP
.IP "   \(bu" 6
\fB$XAPPLRESDIR/%l_%t/bitmaps/%N/%B\fP
.IP "   \(bu" 6
\fB$XAPPLRESDIR/%l/bitmaps/%N/%B\fP
.IP "   \(bu" 6
\fB$XAPPLRESDIR/bitmaps/%N/%B\fP
.IP "   \(bu" 6
\fB$XAPPLRESDIR/%L/bitmaps/%B\fP
.IP "   \(bu" 6
\fB$XAPPLRESDIR/%l_%t/bitmaps/%B\fP
.IP "   \(bu" 6
\fB$XAPPLRESDIR/%l/bitmaps/%B\fP
.IP "   \(bu" 6
\fB$XAPPLRESDIR/bitmaps/%B\fP
.IP "   \(bu" 6
\fB$HOME/bitmaps/%B\fP
.IP "   \(bu" 6
\fB$HOME/%B\fP
.IP "   \(bu" 6
\fB/usr/lib/X11/%L/bitmaps/%N/%B\fP
.IP "   \(bu" 6
\fB/usr/lib/X11/%l_%t/bitmaps/%N/%B\fP
.IP "   \(bu" 6
\fB/usr/lib/X11/%l/bitmaps/%N/%B\fP
.IP "   \(bu" 6
\fB/usr/lib/X11/bitmaps/%N/%B\fP
.IP "   \(bu" 6
\fB/usr/lib/X11/%L/bitmaps/%B\fP
.IP "   \(bu" 6
\fB/usr/lib/X11/%l_%t/bitmaps/%B\fP
.IP "   \(bu" 6
\fB/usr/lib/X11/%l/bitmaps/%B\fP
.IP "   \(bu" 6
\fB/usr/lib/X11/bitmaps/%B\fP
.IP "   \(bu" 6
\fB/usr/include/X11/bitmaps/%B\fP
.PP
If neither \fBXBMLANGPATH\fP nor \fBXAPPLRESDIR\fP is set, the
following pathnames are searched:
.IP "   \(bu" 6
\fB%B\fP
.IP "   \(bu" 6
\fB$HOME/%L/bitmaps/%N/%B\fP
.IP "   \(bu" 6
\fB$HOME/%l_%t/bitmaps/%N/%B\fP
.IP "   \(bu" 6
\fB$HOME/%l/bitmaps/%N/%B\fP
.IP "   \(bu" 6
\fB$HOME/bitmaps/%N/%B\fP
.IP "   \(bu" 6
\fB$HOME/%L/bitmaps/%B\fP
.IP "   \(bu" 6
\fB$HOME/%l_%t/bitmaps/%B\fP
.IP "   \(bu" 6
\fB$HOME/%l/bitmaps/%B\fP
.IP "   \(bu" 6
\fB$HOME/bitmaps/%B\fP
.IP "   \(bu" 6
\fB$HOME/%B\fP
.IP "   \(bu" 6
\fB/usr/lib/X11/%L/bitmaps/%N/%B\fP
.IP "   \(bu" 6
\fB/usr/lib/X11/%l_%t/bitmaps/%N/%B\fP
.IP "   \(bu" 6
\fB/usr/lib/X11/%l/bitmaps/%N/%B\fP
.IP "   \(bu" 6
\fB/usr/lib/X11/bitmaps/%N/%B\fP
.IP "   \(bu" 6
\fB/usr/lib/X11/%L/bitmaps/%B\fP
.IP "   \(bu" 6
\fB/usr/lib/X11/%l_%t/bitmaps/%B\fP
.IP "   \(bu" 6
\fB/usr/lib/X11/%l/bitmaps/%B\fP
.IP "   \(bu" 6
\fB/usr/lib/X11/bitmaps/%B\fP
.IP "   \(bu" 6
\fB/usr/include/X11/bitmaps/%B\fP
.PP
These paths are defaults that vendors may change\&.
For example, a vendor may use different directories for
\fB/usr/lib/X11\fP and \fB/usr/include/X11\fP\&.
.PP
The following substitutions are used in these paths:
.IP "\fB%B\fP" 10
The image name, from the \fIimage_name\fP argument
.IP "\fB%N\fP" 10
The class name of the application
.IP "\fB%L\fP" 10
The display\&'s language string\&.
This string is influenced by \fBXtSetLanguageProc\fP\&.
The default string is determined by
calling setlocale(\fBLC_ALL, NULL\fP)\&.
.IP "\fB%l_%t\fP" 10
The language and territory component of the display\&'s language string
.IP "\fB%l\fP" 10
The language component of the display\&'s language string
.PP
The contents of the file must conform to the rules for
X11 bitmap files\&. In other words, Motif can read any X11
conformant bitmap file\&.
.PP
The XPM file format is used for
storing or getting back colored X pixmaps from files\&. The XPM library
is provided as unsupported with Motif\&. To build applications without
XPM, use the \fBNO_XPM\fP macro\&.
The following shows both XBM and XPM files, respectively,
for a plaid pattern\&.
.PP
.nf
\f(CW/* XBM file */
#define plaid_width 22
#define plaid_height 22
#define plaid_x_hot \-1
#define plaid_y_hot \-1
static char plaid_bits[] = {
   0x75, 0xfd, 0x3f, 0xaa, 0xfa, 0x3e, 0x75, 0xfd, 0x3f, 0xaa, 0xfa, 0x3e,
   0x75, 0xfd, 0x3f, 0xff, 0x57, 0x15, 0x75, 0xfd, 0x3f, 0xaa, 0xfa, 0x3e,
   0x75, 0xfd, 0x3f, 0xaa, 0xfa, 0x3e, 0x75, 0xfd, 0x3f, 0x20, 0xa8, 0x2b,
   0x20, 0x50, 0x15, 0x20, 0xa8, 0x2b, 0x20, 0x50, 0x15, 0x20, 0xa8, 0x2b,
   0xff, 0xff, 0x3f, 0x20, 0xa8, 0x2b, 0x20, 0x50, 0x15, 0x20, 0xa8, 0x2b,
   0x20, 0x50, 0x15, 0x20, 0xa8, 0x2b};\fR
.fi
.PP
.PP
.nf
\f(CW/* XPM file */
static char * plaid[] = {
/* plaid pixmap
 * width height ncolors chars_per_pixel */
"22 22 4 2 ",
/* colors */
"   c red       m white  s light_color ",
"Y  c green     m black  s lines_in_mix ",
"+  c yellow    m white  s lines_in_dark ",
"x              m black  s dark_color ",
/* pixels */
"x   x   x x x   x   x x x x x x + x x x x x ",
"  x   x   x   x   x   x x x x x x x x x x x ",
"x   x   x x x   x   x x x x x x + x x x x x ",
"  x   x   x   x   x   x x x x x x x x x x x ",
"x   x   x x x   x   x x x x x x + x x x x x ",
"Y Y Y Y Y x Y Y Y Y Y + x + x + x + x + x + ",
"x   x   x x x   x   x x x x x x + x x x x x ",
"  x   x   x   x   x   x x x x x x x x x x x ",
"x   x   x x x   x   x x x x x x + x x x x x ",
"  x   x   x   x   x   x x x x x x x x x x x ",
"x   x   x x x   x   x x x x x x + x x x x x ",
"          x           x   x   x Y x   x   x ",
"          x             x   x   Y   x   x   ",
"          x           x   x   x Y x   x   x ",
"x x x x x x x x x x x x x x x x x x x x x x ",
"          x           x   x   x Y x   x   x ",
"          x             x   x   Y   x   x   ",
"          x           x   x   x Y x   x   x ",
"          x             x   x   Y   x   x   ",
"          x           x   x   x Y x   x   x "
};\fR
.fi
.PP
.SH "RETURN"
.PP
Returns a pixmap when successful; returns \fBXmUNSPECIFIED_PIXMAP\fP
if the image corresponding to \fIimage_name\fP cannot be found\&.
.SH "RELATED"
.PP
\fBXmDestroyPixmap\fP(3),
\fBXmInstallImage\fP(3), and
\fBXmUninstallImage\fP(3)\&.
...\" created by instant / docbook-to-man, Sun 22 Dec 1996, 20:24