Back to index

plt-scheme  4.2.1
CrDatFrP.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 *  CrDataFP.c:                                                                *
00028 *                                                                             *
00029 *  XPM library                                                                *
00030 *  Scan a pixmap and possibly its mask and create an XPM array                *
00031 *                                                                             *
00032 *  Developed by Arnaud Le Hors                                                *
00033 \*****************************************************************************/
00034 
00035 #include "xpmP.h"
00036 #if defined(SYSV) || defined(SVR4) || defined(VMS)
00037 #include <string.h>
00038 #else
00039 #include <strings.h>
00040 #endif
00041 
00042 int
00043 XpmCreateDataFromPixmap(display, data_return, pixmap, shapemask, attributes)
00044     Display *display;
00045     char ***data_return;
00046     Pixmap pixmap;
00047     Pixmap shapemask;
00048     XpmAttributes *attributes;
00049 {
00050     XImage *ximage = NULL;
00051     XImage *shapeimage = NULL;
00052     unsigned int width = 0;
00053     unsigned int height = 0;
00054     int ErrorStatus;
00055 
00056     /* get geometry */
00057     if (attributes && attributes->valuemask & XpmSize) {
00058        width = attributes->width;
00059        height = attributes->height;
00060     }
00061     /* get the ximages */
00062     if (pixmap)
00063        xpmCreateImageFromPixmap(display, pixmap, &ximage, &width, &height);
00064     if (shapemask)
00065        xpmCreateImageFromPixmap(display, shapemask, &shapeimage,
00066                              &width, &height);
00067 
00068     /* create the data */
00069     ErrorStatus = XpmCreateDataFromImage(display, data_return, ximage,
00070                                     shapeimage, attributes);
00071 
00072     /* destroy the ximages */
00073     if (ximage)
00074        XDestroyImage(ximage);
00075     if (shapeimage)
00076        XDestroyImage(shapeimage);
00077 
00078     return (ErrorStatus);
00079 }