1
/* Copyright 1990,91 GROUPE BULL -- See licence conditions in file COPYRIGHT */
2
/*****************************************************************************\
6
* Parse an XPM file and create the pixmap and possibly its mask *
8
* Developed by Arnaud Le Hors *
11
\*****************************************************************************/
16
XpmReadFileToPixmap(display, d, filename, pixmap_return,
17
shapemask_return, attributes)
21
Pixmap *pixmap_return;
22
Pixmap *shapemask_return;
23
XpmAttributes *attributes;
25
XImage *image, **imageptr = NULL;
26
XImage *shapeimage, **shapeimageptr = NULL;
32
* initialize return values
35
*pixmap_return = 0; /* was: pixmap_return = NULL; */
38
if (shapemask_return) {
39
*shapemask_return = 0; /* was: *shapemask_return = NULL */
40
shapeimageptr = &shapeimage;
46
ErrorStatus = XpmReadFileToImage(display, filename, imageptr,
47
shapeimageptr, attributes);
54
if (imageptr && image) {
55
*pixmap_return = XCreatePixmap(display, d, image->width,
56
image->height, image->depth);
57
gcv.function = GXcopy;
58
gc = XCreateGC(display, *pixmap_return, GCFunction, &gcv);
60
XPutImage(display, *pixmap_return, gc, image, 0, 0, 0, 0,
61
image->width, image->height);
66
if (shapeimageptr && shapeimage) {
67
*shapemask_return = XCreatePixmap(display, d, shapeimage->width,
70
gcv.function = GXcopy;
71
gc = XCreateGC(display, *shapemask_return, GCFunction, &gcv);
73
XPutImage(display, *shapemask_return, gc, shapeimage, 0, 0, 0, 0,
74
shapeimage->width, shapeimage->height);
76
XDestroyImage(shapeimage);