home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / historic / v941.tgz / icon.v941src.tar / icon.v941src / src / xpm / XpmCrIFData.c < prev    next >
C/C++ Source or Header  |  2000-07-29  |  2KB  |  53 lines

  1. /* Copyright 1990-92 GROUPE BULL -- See license conditions in file COPYRIGHT */
  2. /*****************************************************************************\
  3. * XpmCrIFData.c:                                                              *
  4. *                                                                             *
  5. *  XPM library                                                                *
  6. *  Parse an Xpm array and create the image and possibly its mask              *
  7. *                                                                             *
  8. *  Developed by Arnaud Le Hors                                                *
  9. \*****************************************************************************/
  10.  
  11. #include "xpmP.h"
  12.  
  13. int
  14. XpmCreateImageFromData(display, data, image_return,
  15.                shapeimage_return, attributes)
  16.     Display *display;
  17.     char **data;
  18.     XImage **image_return;
  19.     XImage **shapeimage_return;
  20.     XpmAttributes *attributes;
  21. {
  22.     xpmData mdata;
  23.     int ErrorStatus;
  24.     xpmInternAttrib attrib;
  25.  
  26.     /*
  27.      * initialize return values 
  28.      */
  29.     if (image_return)
  30.     *image_return = NULL;
  31.     if (shapeimage_return)
  32.     *shapeimage_return = NULL;
  33.  
  34.     xpmOpenArray(data, &mdata);
  35.     xpmInitInternAttrib(&attrib);
  36.  
  37.     ErrorStatus = xpmParseData(&mdata, &attrib, attributes);
  38.  
  39.     if (ErrorStatus == XpmSuccess)
  40.     ErrorStatus = xpmCreateImage(display, &attrib, image_return,
  41.                      shapeimage_return, attributes);
  42.  
  43.     if (ErrorStatus >= 0)
  44.     xpmSetAttributes(&attrib, attributes);
  45.     else if (attributes)
  46.     XpmFreeAttributes(attributes);
  47.  
  48.     xpmFreeInternAttrib(&attrib);
  49.     XpmDataClose(&mdata);
  50.  
  51.     return (ErrorStatus);
  52. }
  53.