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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
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);
}
|