'\" 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" 3 .SH "NAME" \fBXmGetPixmapByDepth\fP \(em A pixmap caching function that generates a pixmap, stores it in a pixmap cache, and returns the pixmap "XmGetPixmapByDepth" "pixmaps" .SH "SYNOPSIS" .PP .nf #include \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