Back to index

plt-scheme  4.2.1
RdFToP.c
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 1989-95 GROUPE BULL
00003  *
00004  * Permission is hereby granted, free of charge, to any person obtaining a copy
00005  * of this software and associated documentation files (the "Software"), to
00006  * deal in the Software without restriction, including without limitation the
00007  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
00008  * sell copies of the Software, and to permit persons to whom the Software is
00009  * furnished to do so, subject to the following conditions:
00010  *
00011  * The above copyright notice and this permission notice shall be included in
00012  * all copies or substantial portions of the Software.
00013  *
00014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00015  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
00017  * GROUPE BULL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
00018  * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
00019  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00020  *
00021  * Except as contained in this notice, the name of GROUPE BULL shall not be
00022  * used in advertising or otherwise to promote the sale, use or other dealings
00023  * in this Software without prior written authorization from GROUPE BULL.
00024  */
00025 
00026 /*****************************************************************************\
00027 *  RdFToP.c:                                                                  *
00028 *                                                                             *
00029 *  XPM library                                                                *
00030 *  Parse an XPM file and create the pixmap and possibly its mask              *
00031 *                                                                             *
00032 *  Developed by Arnaud Le Hors                                                *
00033 \*****************************************************************************/
00034 
00035 #include "xpmP.h"
00036 
00037 int
00038 XpmReadFileToPixmap(display, d, filename, pixmap_return,
00039                   shapemask_return, attributes)
00040     Display *display;
00041     Drawable d;
00042     char *filename;
00043     Pixmap *pixmap_return;
00044     Pixmap *shapemask_return;
00045     XpmAttributes *attributes;
00046 {
00047     XImage *ximage, *shapeimage;
00048     int ErrorStatus;
00049 
00050     /* initialize return values */
00051     if (pixmap_return)
00052        *pixmap_return = 0;
00053     if (shapemask_return)
00054        *shapemask_return = 0;
00055 
00056     /* create the images */
00057     ErrorStatus = XpmReadFileToImage(display, filename,
00058                                  (pixmap_return ? &ximage : NULL),
00059                                  (shapemask_return ? &shapeimage : NULL),
00060                                  attributes);
00061 
00062     if (ErrorStatus < 0)           /* fatal error */
00063        return (ErrorStatus);
00064 
00065     /* create the pixmaps and destroy images */
00066     if (pixmap_return && ximage) {
00067        xpmCreatePixmapFromImage(display, d, ximage, pixmap_return);
00068        XDestroyImage(ximage);
00069     }
00070     if (shapemask_return && shapeimage) {
00071        xpmCreatePixmapFromImage(display, d, shapeimage, shapemask_return);
00072        XDestroyImage(shapeimage);
00073     }
00074     return (ErrorStatus);
00075 }