aboutsummaryrefslogtreecommitdiff
path: root/vendor/x11iraf/xpm/XpmCrPFrBuf.c
blob: 0c765100277d52c41a7919a66dce2e6b7e464f20 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/* Copyright 1990-93 GROUPE BULL -- See license conditions in file COPYRIGHT */
/*****************************************************************************\
* XpmCrPFrBuf.c:                                                              *
*                                                                             *
*  XPM library                                                                *
*  Parse an Xpm buffer and create the pixmap and possibly its mask            *
*                                                                             *
*  Developed by Arnaud Le Hors                                                *
\*****************************************************************************/

#include "xpmP.h"

int
XpmCreatePixmapFromBuffer(display, d, buffer, pixmap_return,
			  shapemask_return, attributes)
    Display *display;
    Drawable d;
    char *buffer;
    Pixmap *pixmap_return;
    Pixmap *shapemask_return;
    XpmAttributes *attributes;
{
    XpmImage image;
    int ErrorStatus;

    /*
     * create an XpmImage
     */
    ErrorStatus =
	XpmCreateXpmImageFromBuffer(buffer, &image, attributes, NULL);

    if (ErrorStatus != XpmSuccess)
	return (ErrorStatus);

    /*
     * then create the pixmaps from it
     */
    ErrorStatus = XpmCreatePixmapFromXpmImage(display, d, &image,
					      pixmap_return, shapemask_return,
					      attributes);
    if (ErrorStatus != XpmSuccess)
	XpmFreeAttributes(attributes);

    XpmFreeXpmImage(&image);

    return (ErrorStatus);
}