2
* Copyright (C) 1989-95 GROUPE BULL
4
* Permission is hereby granted, free of charge, to any person obtaining a copy
5
* of this software and associated documentation files (the "Software"), to
6
* deal in the Software without restriction, including without limitation the
7
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8
* sell copies of the Software, and to permit persons to whom the Software is
9
* furnished to do so, subject to the following conditions:
11
* The above copyright notice and this permission notice shall be included in
12
* all copies or substantial portions of the Software.
14
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17
* GROUPE BULL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
* Except as contained in this notice, the name of GROUPE BULL shall not be
22
* used in advertising or otherwise to promote the sale, use or other dealings
23
* in this Software without prior written authorization from GROUPE BULL.
26
/*****************************************************************************\
30
* Scanning utility for XPM file format *
32
* Developed by Arnaud Le Hors *
33
\*****************************************************************************/
34
/* $XFree86: xc/extras/Xpm/lib/scan.c,v 1.2 2001/10/28 03:32:11 tsi Exp $ */
37
* The code related to FOR_MSW has been added by
38
* HeDu (hedu@cul-ipn.uni-kiel.de) 4/94
42
* The code related to AMIGA has been added by
43
* Lorens Younes (d93-hyo@nada.kth.se) 4/96
46
/* October 2004, source code review by Thomas Biege <thomas@suse.de> */
53
#define MAXPRINTABLE 92 /* number of printable ascii chars
54
* minus \ and " for string compat
55
* and ? to avoid ANSI trigraphs. */
57
static char *printable =
58
" .XoO+@#$%&*=-;:>,<1234567890qwertyuipasdfghjklzxcvbnmMNBVCZ\
59
ASDFGHJKLPIUYTREWQ!~^/()_`'][{}|";
62
* printable begin with a space, so in most case, due to my algorithm, when
63
* the number of different colors is less than MAXPRINTABLE, it will give a
64
* char follow by "nothing" (a space) in the readable xpm file
70
unsigned int *pixelindex;
73
unsigned int mask_pixel; /* whether there is or not */
76
LFUNC(storePixel, int, (Pixel pixel, PixelsMap *pmap,
77
unsigned int *index_return));
79
LFUNC(storeMaskPixel, int, (Pixel pixel, PixelsMap *pmap,
80
unsigned int *index_return));
82
typedef int (*storeFuncPtr)(Pixel pixel, PixelsMap *pmap,
83
unsigned int *index_return);
87
LFUNC(GetImagePixels, int, (XImage *image, unsigned int width,
88
unsigned int height, PixelsMap *pmap));
90
LFUNC(GetImagePixels32, int, (XImage *image, unsigned int width,
91
unsigned int height, PixelsMap *pmap));
93
LFUNC(GetImagePixels16, int, (XImage *image, unsigned int width,
94
unsigned int height, PixelsMap *pmap));
96
LFUNC(GetImagePixels8, int, (XImage *image, unsigned int width,
97
unsigned int height, PixelsMap *pmap));
99
LFUNC(GetImagePixels1, int, (XImage *image, unsigned int width,
100
unsigned int height, PixelsMap *pmap,
101
storeFuncPtr storeFunc));
103
LFUNC(AGetImagePixels, int, (XImage *image, unsigned int width,
104
unsigned int height, PixelsMap *pmap,
105
storeFuncPtr storeFunc));
107
#else /* ndef FOR_MSW */
108
LFUNC(MSWGetImagePixels, int, (Display *d, XImage *image, unsigned int width,
109
unsigned int height, PixelsMap *pmap,
110
storeFuncPtr storeFunc));
112
LFUNC(ScanTransparentColor, int, (XpmColor *color, unsigned int cpp,
113
XpmAttributes *attributes));
115
LFUNC(ScanOtherColors, int, (Display *display, XpmColor *colors,
116
unsigned int ncolors,
117
Pixel *pixels, unsigned int mask,
118
unsigned int cpp, XpmAttributes *attributes));
121
* This function stores the given pixel in the given arrays which are grown
122
* if not large enough.
125
storePixel(pixel, pmap, index_return)
128
unsigned int *index_return;
132
unsigned int ncolors;
134
if (*index_return) { /* this is a transparent pixel! */
138
ncolors = pmap->ncolors;
139
p = pmap->pixels + pmap->mask_pixel;
140
for (i = pmap->mask_pixel; i < ncolors; i++, p++)
144
if (ncolors >= pmap->size) {
146
p = (Pixel *) XpmRealloc(pmap->pixels, sizeof(Pixel) * pmap->size);
152
(pmap->pixels)[ncolors] = pixel;
160
storeMaskPixel(pixel, pmap, index_return)
163
unsigned int *index_return;
166
if (!pmap->ncolors) {
168
(pmap->pixels)[0] = 0;
169
pmap->mask_pixel = 1;
177
/* function call in case of error */
179
#define RETURN(status) \
181
ErrorStatus = status; \
186
* This function scans the given image and stores the found informations in
187
* the given XpmImage structure.
190
XpmCreateXpmImageFromImage(display, image, shapeimage,
191
xpmimage, attributes)
196
XpmAttributes *attributes;
198
/* variables stored in the XpmAttributes structure */
201
/* variables to return */
203
XpmColor *colorTable = NULL;
206
/* calculation variables */
207
unsigned int width = 0;
208
unsigned int height = 0;
209
unsigned int cppm; /* minimum chars per pixel */
212
/* initialize pmap */
214
pmap.pixelindex = NULL;
215
pmap.size = 256; /* should be enough most of the time */
223
width = image->width;
224
height = image->height;
225
} else if (shapeimage) {
226
width = shapeimage->width;
227
height = shapeimage->height;
231
* retrieve information from the XpmAttributes
233
if (attributes && (attributes->valuemask & XpmCharsPerPixel
234
/* 3.2 backward compatibility code */
235
|| attributes->valuemask & XpmInfos))
237
cpp = attributes->cpp;
241
if ((height > 0 && width >= UINT_MAX / height) ||
242
width * height >= UINT_MAX / sizeof(unsigned int))
245
(unsigned int *) XpmCalloc(width * height, sizeof(unsigned int));
246
if (!pmap.pixelindex)
249
if (pmap.size >= UINT_MAX / sizeof(Pixel))
252
pmap.pixels = (Pixel *) XpmMalloc(sizeof(Pixel) * pmap.size);
257
* scan shape mask if any
262
ErrorStatus = GetImagePixels1(shapeimage, width, height, &pmap,
265
ErrorStatus = AGetImagePixels(shapeimage, width, height, &pmap,
269
ErrorStatus = MSWGetImagePixels(display, shapeimage, width, height,
270
&pmap, storeMaskPixel);
272
if (ErrorStatus != XpmSuccess)
277
* scan the image data
279
* In case depth is 1 or bits_per_pixel is 4, 6, 8, 24 or 32 use optimized
280
* functions, otherwise use slower but sure general one.
287
if (((image->bits_per_pixel | image->depth) == 1) &&
288
(image->byte_order == image->bitmap_bit_order))
289
ErrorStatus = GetImagePixels1(image, width, height, &pmap,
291
else if (image->format == ZPixmap) {
292
if (image->bits_per_pixel == 8)
293
ErrorStatus = GetImagePixels8(image, width, height, &pmap);
294
else if (image->bits_per_pixel == 16)
295
ErrorStatus = GetImagePixels16(image, width, height, &pmap);
296
else if (image->bits_per_pixel == 32)
297
ErrorStatus = GetImagePixels32(image, width, height, &pmap);
299
ErrorStatus = GetImagePixels(image, width, height, &pmap);
301
ErrorStatus = AGetImagePixels(image, width, height, &pmap,
305
ErrorStatus = MSWGetImagePixels(display, image, width, height, &pmap,
308
if (ErrorStatus != XpmSuccess)
313
* get rgb values and a string of char, and possibly a name for each
316
if (pmap.ncolors >= UINT_MAX / sizeof(XpmColor))
318
colorTable = (XpmColor *) XpmCalloc(pmap.ncolors, sizeof(XpmColor));
322
/* compute the minimal cpp */
323
for (cppm = 1, c = MAXPRINTABLE; pmap.ncolors > c; cppm++)
328
if (pmap.mask_pixel) {
329
ErrorStatus = ScanTransparentColor(colorTable, cpp, attributes);
330
if (ErrorStatus != XpmSuccess)
334
ErrorStatus = ScanOtherColors(display, colorTable, pmap.ncolors,
335
pmap.pixels, pmap.mask_pixel, cpp,
337
if (ErrorStatus != XpmSuccess)
341
* store found informations in the XpmImage structure
343
xpmimage->width = width;
344
xpmimage->height = height;
346
xpmimage->ncolors = pmap.ncolors;
347
xpmimage->colorTable = colorTable;
348
xpmimage->data = pmap.pixelindex;
350
XpmFree(pmap.pixels);
353
/* exit point in case of error, free only locally allocated variables */
356
XpmFree(pmap.pixelindex);
358
XpmFree(pmap.pixels);
360
xpmFreeColorTable(colorTable, pmap.ncolors);
362
return (ErrorStatus);
366
ScanTransparentColor(color, cpp, attributes)
369
XpmAttributes *attributes;
372
unsigned int a, b, c;
374
/* first get a character string */
376
if (cpp >= UINT_MAX - 1)
377
return (XpmNoMemory);
378
if (!(s = color->string = (char *) XpmMalloc(cpp + 1)))
379
return (XpmNoMemory);
380
*s++ = printable[c = a % MAXPRINTABLE];
381
for (b = 1; b < cpp; b++, s++)
382
*s = printable[c = ((a - c) / MAXPRINTABLE) % MAXPRINTABLE];
385
/* then retreive related info from the attributes if any */
386
if (attributes && (attributes->valuemask & XpmColorTable
387
/* 3.2 backward compatibility code */
388
|| attributes->valuemask & XpmInfos)
390
&& attributes->mask_pixel != XpmUndefPixel) {
393
char **defaults = (char **) color;
394
char **mask_defaults;
396
/* 3.2 backward compatibility code */
397
if (attributes->valuemask & XpmColorTable)
399
mask_defaults = (char **) (
400
attributes->colorTable + attributes->mask_pixel);
401
/* 3.2 backward compatibility code */
403
mask_defaults = (char **)
404
((XpmColor **) attributes->colorTable)[attributes->mask_pixel];
406
for (key = 1; key <= NKEYS; key++) {
407
if ((s = mask_defaults[key])) {
408
defaults[key] = (char *) xpmstrdup(s);
410
return (XpmNoMemory);
414
color->c_color = (char *) xpmstrdup(TRANSPARENT_COLOR);
416
return (XpmNoMemory);
422
ScanOtherColors(display, colors, ncolors, pixels, mask, cpp, attributes)
425
unsigned int ncolors;
429
XpmAttributes *attributes;
431
/* variables stored in the XpmAttributes structure */
436
xpmRgbName rgbn[MAX_RGBNAMES];
438
xpmRgbName *rgbn = NULL;
441
unsigned int i, j, c, i2;
443
XColor *xcolors = NULL, *xcolor;
445
XpmColor *colorTable = NULL, **oldColorTable = NULL;
446
unsigned int ancolors = 0;
447
Pixel *apixels = NULL;
448
unsigned int mask_pixel = 0;
451
/* retrieve information from the XpmAttributes */
452
if (attributes && (attributes->valuemask & XpmColormap))
453
colormap = attributes->colormap;
455
colormap = XDefaultColormap(display, XDefaultScreen(display));
456
if (attributes && (attributes->valuemask & XpmRgbFilename))
457
rgb_fname = attributes->rgb_fname;
461
/* start from the right element */
468
/* first get character strings and rgb values */
469
if (ncolors >= UINT_MAX / sizeof(XColor) || cpp >= UINT_MAX - 1)
470
return (XpmNoMemory);
471
xcolors = (XColor *) XpmMalloc(sizeof(XColor) * ncolors);
473
return (XpmNoMemory);
475
for (i = 0, i2 = mask, color = colors, xcolor = xcolors;
476
i < ncolors; i++, i2++, color++, xcolor++, pixels++) {
478
if (!(s = color->string = (char *) XpmMalloc(cpp + 1))) {
480
return (XpmNoMemory);
482
*s++ = printable[c = i2 % MAXPRINTABLE];
483
for (j = 1; j < cpp; j++, s++)
484
*s = printable[c = ((i2 - c) / MAXPRINTABLE) % MAXPRINTABLE];
487
xcolor->pixel = *pixels;
489
XQueryColors(display, colormap, xcolors, ncolors);
492
/* read the rgb file if any was specified */
494
rgbn_max = xpmReadRgbNames(attributes->rgb_fname, rgbn);
496
/* FOR_MSW: rgb names and values are hardcoded in rgbtab.h */
497
rgbn_max = xpmReadRgbNames(NULL, NULL);
500
if (attributes && attributes->valuemask & XpmColorTable) {
501
colorTable = attributes->colorTable;
502
ancolors = attributes->ncolors;
503
apixels = attributes->pixels;
504
mask_pixel = attributes->mask_pixel;
506
/* 3.2 backward compatibility code */
507
else if (attributes && attributes->valuemask & XpmInfos) {
508
oldColorTable = (XpmColor **) attributes->colorTable;
509
ancolors = attributes->ncolors;
510
apixels = attributes->pixels;
511
mask_pixel = attributes->mask_pixel;
515
for (i = 0, color = colors, xcolor = xcolors; i < ncolors;
516
i++, color++, xcolor++) {
518
/* look for related info from the attributes if any */
521
unsigned int offset = 0;
523
for (j = 0; j < ancolors; j++) {
524
if (j == mask_pixel) {
528
if (apixels[j - offset] == xcolor->pixel)
533
char **defaults = (char **) color;
536
/* 3.2 backward compatibility code */
538
adefaults = (char **) oldColorTable[j];
541
adefaults = (char **) (colorTable + j);
544
for (key = 1; key <= NKEYS; key++) {
545
if ((s = adefaults[key]))
546
defaults[key] = (char *) xpmstrdup(s);
551
/* if nothing found look for a color name */
554
colorname = xpmGetRgbName(rgbn, rgbn_max, xcolor->red,
555
xcolor->green, xcolor->blue);
557
color->c_color = (char *) xpmstrdup(colorname);
559
/* at last store the rgb value */
562
sprintf(buf, "#%04X%04X%04X",
563
xcolor->red, xcolor->green, xcolor->blue);
565
sprintf(buf, "#%02x%02x%02x",
566
xcolor->red, xcolor->green, xcolor->blue);
568
color->c_color = (char *) xpmstrdup(buf);
570
if (!color->c_color) {
572
xpmFreeRgbNames(rgbn, rgbn_max);
573
return (XpmNoMemory);
579
xpmFreeRgbNames(rgbn, rgbn_max);
586
* The functions below are written from X11R5 MIT's code (XImUtil.c)
588
* The idea is to have faster functions than the standard XGetPixel function
589
* to scan the image data. Indeed we can speed up things by suppressing tests
590
* performed for each pixel. We do exactly the same tests but at the image
594
static unsigned long Const low_bits_table[] = {
595
0x00000000, 0x00000001, 0x00000003, 0x00000007,
596
0x0000000f, 0x0000001f, 0x0000003f, 0x0000007f,
597
0x000000ff, 0x000001ff, 0x000003ff, 0x000007ff,
598
0x00000fff, 0x00001fff, 0x00003fff, 0x00007fff,
599
0x0000ffff, 0x0001ffff, 0x0003ffff, 0x0007ffff,
600
0x000fffff, 0x001fffff, 0x003fffff, 0x007fffff,
601
0x00ffffff, 0x01ffffff, 0x03ffffff, 0x07ffffff,
602
0x0fffffff, 0x1fffffff, 0x3fffffff, 0x7fffffff,
607
* Default method to scan pixels of an image data structure.
608
* The algorithm used is:
610
* copy the source bitmap_unit or Zpixel into temp
611
* normalize temp if needed
612
* extract the pixel bits into return value
617
GetImagePixels(image, width, height, pmap)
628
int bits, depth, ibu, ibpp, offset, i;
633
iptr = pmap->pixelindex;
634
depth = image->depth;
635
lbt = low_bits_table[depth];
636
ibpp = image->bits_per_pixel;
637
offset = image->xoffset;
639
if (image->bitmap_unit < 0)
640
return (XpmNoMemory);
642
if ((image->bits_per_pixel | image->depth) == 1) {
643
ibu = image->bitmap_unit;
644
for (y = 0; y < height; y++)
645
for (x = 0; x < width; x++, iptr++) {
646
src = &data[XYINDEX(x, y, image)];
647
dst = (char *) &pixel;
649
for (i = ibu >> 3; --i >= 0;)
651
XYNORMALIZE(&pixel, image);
652
bits = (x + offset) % ibu;
653
pixel = ((((char *) &pixel)[bits >> 3]) >> (bits & 7)) & 1;
656
if (storePixel(pixel, pmap, iptr))
657
return (XpmNoMemory);
659
} else if (image->format == XYPixmap) {
662
ibu = image->bitmap_unit;
664
bpl = image->bytes_per_line;
665
for (y = 0; y < height; y++)
666
for (x = 0; x < width; x++, iptr++) {
669
for (i = depth; --i >= 0;) {
670
src = &data[XYINDEX(x, y, image) + plane];
673
for (j = nbytes; --j >= 0;)
675
XYNORMALIZE(&px, image);
676
bits = (x + offset) % ibu;
677
pixel = (pixel << 1) |
678
(((((char *) &px)[bits >> 3]) >> (bits & 7)) & 1);
679
plane = plane + (bpl * height);
683
if (storePixel(pixel, pmap, iptr))
684
return (XpmNoMemory);
686
} else if (image->format == ZPixmap) {
687
for (y = 0; y < height; y++)
688
for (x = 0; x < width; x++, iptr++) {
689
src = &data[ZINDEX(x, y, image)];
692
for (i = (ibpp + 7) >> 3; --i >= 0;)
694
ZNORMALIZE(&px, image);
696
for (i = sizeof(unsigned long); --i >= 0;)
697
pixel = (pixel << 8) | ((unsigned char *) &px)[i];
706
if (storePixel(pixel, pmap, iptr))
707
return (XpmNoMemory);
710
return (XpmColorError); /* actually a bad image */
715
* scan pixels of a 32-bits Z image data structure
718
#if !defined(WORD64) && !defined(LONG64)
719
static unsigned long byteorderpixel = MSBFirst << 24;
723
GetImagePixels32(image, width, height, pmap)
737
data = (unsigned char *) image->data;
738
iptr = pmap->pixelindex;
739
depth = image->depth;
740
lbt = low_bits_table[depth];
741
#if !defined(WORD64) && !defined(LONG64)
742
if (*((char *) &byteorderpixel) == image->byte_order) {
743
for (y = 0; y < height; y++)
744
for (x = 0; x < width; x++, iptr++) {
745
addr = &data[ZINDEX32(x, y, image)];
746
pixel = *((unsigned long *) addr);
749
if (storePixel(pixel, pmap, iptr))
750
return (XpmNoMemory);
754
if (image->byte_order == MSBFirst)
755
for (y = 0; y < height; y++)
756
for (x = 0; x < width; x++, iptr++) {
757
addr = &data[ZINDEX32(x, y, image)];
758
pixel = ((unsigned long) addr[0] << 24 |
759
(unsigned long) addr[1] << 16 |
760
(unsigned long) addr[2] << 8 |
764
if (storePixel(pixel, pmap, iptr))
765
return (XpmNoMemory);
768
for (y = 0; y < height; y++)
769
for (x = 0; x < width; x++, iptr++) {
770
addr = &data[ZINDEX32(x, y, image)];
772
(unsigned long) addr[1] << 8 |
773
(unsigned long) addr[2] << 16 |
774
(unsigned long) addr[3] << 24);
777
if (storePixel(pixel, pmap, iptr))
778
return (XpmNoMemory);
784
* scan pixels of a 16-bits Z image data structure
788
GetImagePixels16(image, width, height, pmap)
802
data = (unsigned char *) image->data;
803
iptr = pmap->pixelindex;
804
depth = image->depth;
805
lbt = low_bits_table[depth];
806
if (image->byte_order == MSBFirst)
807
for (y = 0; y < height; y++)
808
for (x = 0; x < width; x++, iptr++) {
809
addr = &data[ZINDEX16(x, y, image)];
810
pixel = addr[0] << 8 | addr[1];
813
if (storePixel(pixel, pmap, iptr))
814
return (XpmNoMemory);
817
for (y = 0; y < height; y++)
818
for (x = 0; x < width; x++, iptr++) {
819
addr = &data[ZINDEX16(x, y, image)];
820
pixel = addr[0] | addr[1] << 8;
823
if (storePixel(pixel, pmap, iptr))
824
return (XpmNoMemory);
830
* scan pixels of a 8-bits Z image data structure
834
GetImagePixels8(image, width, height, pmap)
847
data = (unsigned char *) image->data;
848
iptr = pmap->pixelindex;
849
depth = image->depth;
850
lbt = low_bits_table[depth];
851
for (y = 0; y < height; y++)
852
for (x = 0; x < width; x++, iptr++) {
853
pixel = data[ZINDEX8(x, y, image)];
856
if (storePixel(pixel, pmap, iptr))
857
return (XpmNoMemory);
863
* scan pixels of a 1-bit depth Z image data structure
867
GetImagePixels1(image, width, height, pmap, storeFunc)
872
storeFuncPtr storeFunc;
878
int xoff, yoff, offset, bpl;
881
iptr = pmap->pixelindex;
882
offset = image->xoffset;
883
bpl = image->bytes_per_line;
885
if (image->bitmap_bit_order == MSBFirst)
886
for (y = 0; y < height; y++)
887
for (x = 0; x < width; x++, iptr++) {
889
yoff = y * bpl + (xoff >> 3);
891
pixel = (data[yoff] & (0x80 >> xoff)) ? 1 : 0;
892
if ((*storeFunc) (pixel, pmap, iptr))
893
return (XpmNoMemory);
896
for (y = 0; y < height; y++)
897
for (x = 0; x < width; x++, iptr++) {
899
yoff = y * bpl + (xoff >> 3);
901
pixel = (data[yoff] & (1 << xoff)) ? 1 : 0;
902
if ((*storeFunc) (pixel, pmap, iptr))
903
return (XpmNoMemory);
910
#define CLEAN_UP(status) \
912
if (pixels) XpmFree (pixels);\
913
if (tmp_img) FreeXImage (tmp_img);\
927
unsigned char *pixels;
930
pixels = XpmMalloc ((((width+15)>>4)<<4)*sizeof (*pixels));
934
tmp_img = AllocXImage ((((width+15)>>4)<<4), 1, image->rp->BitMap->Depth);
936
CLEAN_UP (XpmNoMemory);
938
iptr = pmap->pixelindex;
939
for (y = 0; y < height; ++y)
941
ReadPixelLine8 (image->rp, 0, y, width, pixels, tmp_img->rp);
942
for (x = 0; x < width; ++x, ++iptr)
944
if ((*storeFunc) (pixels[x], pmap, iptr))
945
CLEAN_UP (XpmNoMemory);
949
CLEAN_UP (XpmSuccess);
955
#else /* ndef FOR_MSW */
957
MSWGetImagePixels(display, image, width, height, pmap, storeFunc)
969
iptr = pmap->pixelindex;
971
SelectObject(*display, image->bitmap);
972
for (y = 0; y < height; y++) {
973
for (x = 0; x < width; x++, iptr++) {
974
pixel = GetPixel(*display, x, y);
975
if ((*storeFunc) (pixel, pmap, iptr))
976
return (XpmNoMemory);
987
XpmCreateXpmImageFromPixmap(display, pixmap, shapemask,
988
xpmimage, attributes)
993
XpmAttributes *attributes;
995
XImage *ximage = NULL;
996
XImage *shapeimage = NULL;
997
unsigned int width = 0;
998
unsigned int height = 0;
1002
if (attributes && attributes->valuemask & XpmSize) {
1003
width = attributes->width;
1004
height = attributes->height;
1006
/* get the ximages */
1008
xpmCreateImageFromPixmap(display, pixmap, &ximage, &width, &height);
1010
xpmCreateImageFromPixmap(display, shapemask, &shapeimage,
1013
/* create the related XpmImage */
1014
ErrorStatus = XpmCreateXpmImageFromImage(display, ximage, shapeimage,
1015
xpmimage, attributes);
1017
/* destroy the ximages */
1019
XDestroyImage(ximage);
1021
XDestroyImage(shapeimage);
1023
return (ErrorStatus);
1026
# endif/* not AMIGA */
1027
#endif /* ndef FOR_MSW */