aboutsummaryrefslogtreecommitdiff
path: root/vendor/x11iraf/xpm/XpmCrIFrBuf.c
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
commitfa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch)
treebdda434976bc09c864f2e4fa6f16ba1952b1e555 /vendor/x11iraf/xpm/XpmCrIFrBuf.c
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'vendor/x11iraf/xpm/XpmCrIFrBuf.c')
-rw-r--r--vendor/x11iraf/xpm/XpmCrIFrBuf.c69
1 files changed, 69 insertions, 0 deletions
diff --git a/vendor/x11iraf/xpm/XpmCrIFrBuf.c b/vendor/x11iraf/xpm/XpmCrIFrBuf.c
new file mode 100644
index 00000000..569b2aa4
--- /dev/null
+++ b/vendor/x11iraf/xpm/XpmCrIFrBuf.c
@@ -0,0 +1,69 @@
+/* Copyright 1990-93 GROUPE BULL -- See license conditions in file COPYRIGHT */
+/*****************************************************************************\
+* XpmCrIFrBuf.c: *
+* *
+* XPM library *
+* Parse an Xpm buffer (file in memory) and create the image and possibly its *
+* mask *
+* Developed by Arnaud Le Hors *
+\*****************************************************************************/
+
+#include "xpmP.h"
+
+int
+XpmCreateImageFromBuffer(display, buffer, image_return,
+ shapeimage_return, attributes)
+ Display *display;
+ char *buffer;
+ XImage **image_return;
+ XImage **shapeimage_return;
+ XpmAttributes *attributes;
+{
+ XpmImage image;
+ int ErrorStatus;
+
+ /*
+ * create an XpmImage then the related XImages
+ */
+ ErrorStatus =
+ XpmCreateXpmImageFromBuffer(buffer, &image, attributes, NULL);
+
+ if (ErrorStatus == XpmSuccess)
+ ErrorStatus = XpmCreateImageFromXpmImage(display, &image,
+ image_return,
+ shapeimage_return,
+ attributes);
+ if (ErrorStatus < 0 && attributes)
+ XpmFreeAttributes(attributes);
+
+ XpmFreeXpmImage(&image);
+
+ return (ErrorStatus);
+}
+
+int
+XpmCreateXpmImageFromBuffer(buffer, image, attributes, infos)
+ char *buffer;
+ XpmImage *image;
+ XpmAttributes *attributes;
+ XpmInfos *infos;
+{
+ xpmData mdata;
+ int ErrorStatus;
+
+ /*
+ * init returned values
+ */
+ xpmInitAttributes(attributes);
+ xpmInitXpmImage(image);
+ xpmInitXpmInfos(infos);
+
+ xpmOpenBuffer(buffer, &mdata);
+ ErrorStatus = xpmParseData(&mdata, image, attributes, infos);
+ xpmDataClose(&mdata);
+
+ if (ErrorStatus != XpmSuccess)
+ XpmFreeXpmInfos(infos);
+
+ return (ErrorStatus);
+}