1XpmWrite(3)                    libXpm functions                    XpmWrite(3)
2
3
4

NAME

6       XpmWrite - write an XPM file
7
8

SYNOPSIS

10       int XpmWriteFileFromPixmap(Display *display, char *filename,
11              Pixmap pixmap, Pixmap shapemask, XpmAttributes *attributes);
12
13       int XpmWriteFileFromImage(Display *display , char *filename,
14              XImage *image, XImage *shapeimage, XpmAttributes *attributes);
15
16       int XpmWriteFileFromData(char *filename, char **data);
17
18       int XpmWriteFileFromXpmImage(char *filename, XpmImage *image,
19              XImage *shapeimage, XpmInfo *info);
20
21       int XpmWriteFileFromBuffer(char *filename, char *buffer);
22
23

ARGUMENTS

25       display
26              Specifies the connection to the X server.
27
28       filename
29              Specifies the file name to use.
30
31       pixmap Specifies the pixmap.
32
33       shapemask
34              Specifies the shape mask pixmap.
35
36       attributes
37              Specifies the location of a structure containing information (or
38              NULL).
39
40       data   Specifies the data array to read.
41
42       image  Specifies the image.
43
44       info   Specifies the location of a structure to  get  information  from
45              (or NULL).
46
47       buffer Specifies the buffer to read.
48
49

DESCRIPTION

51   XpmWriteFileFromImage
52       The  XpmWriteFileFromImage()  function writes an image and its possible
53       shapeimage out to a file in the XPM format.   If  the  file  cannot  be
54       opened,  it  returns XpmOpenFailed.  If insufficient working storage is
55       allocated, it returns XpmNoMemory.  If no error occurs then it  returns
56       XpmSuccess.  If the passed XpmAttributes structure pointer is not NULL,
57       XpmWriteFileFromImage() looks for  the  following  attributes:  XpmCol‐
58       ormap, XpmHotspot, XpmCharsPerPixel, XpmRgbFilename, and XpmExtensions.
59       As a backward compatibility feature, XpmWriteFileFromImage() also looks
60       for  the  XpmInfos  attributes.   If the filename contains an extension
61       such as “.xpm”, in order to get a valid C variable name, the dot  char‐
62       acter is replaced by an underscore ’_’ when writing out.  As a backward
63       compatibility feature, if the XpmInfos attributes are defined it writes
64       out  possible  stored  information such as comments, color defaults and
65       symbol.  Finally, if the XpmRgbFilenameattribute is defined,  XpmWrite‐
66       FileFromImage()  searches  for  color  names  in this file and if found
67       writes them out instead of the rgb values.
68
69       In addition on systems which support such features if  the  given  file
70       name ends by ’.Z’ or ’.gz’ it is assumed to be a compressed file. Then,
71       XpmWriteFileFromImage() writes to a piped  compress  or  gzip  process.
72       And  if  instead  of a file name, NULL is passed to XpmWriteFileFromIm‐
73       age(), it writes to the standard output.
74
75
76   XpmWriteFileFromPixmap
77       To write out a Pixmap to an XPM file, use XpmWriteFileFromPixmap().
78
79       If the passed XpmAttributes structure pointer is  not  NULL,  XpmWrite‐
80       FileFromPixmap()  looks for the following attributes: XpmSize.  If they
81       are not defined it performs an XGetGeometry operation.   Then  it  uses
82       XGetImage  to get from the given pixmaps the related X images which are
83       passed to  XpmWriteFileFromImage().   Finally  XpmWriteFileFromPixmap()
84       destroys  the  created  images  using XDestroyImage.  The XpmWriteFile‐
85       FromPixmap() function returns the same  errors  as  XpmWriteFileFromIm‐
86       age().
87
88
89   XpmWriteFileFromData
90       XpmWriteFileFromData() writes an XPM data array to an XPM file.
91
92       XpmWriteFileToData()  returns XpmOpenFailed if it cannot open the file,
93       XpmFileInvalid if this is not a valid XPM data, and  XpmSuccess  other‐
94       wise.
95
96
97   XpmWriteFileFromXpmImage
98       To  write  out  an  XpmImage to an XPM file, use XpmWriteFileFromXpmIm‐
99       age().  The XpmWriteFileFromXpmImage() function writes an image out  to
100       a file in the XPM format.  If the file cannot be opened, it returns Xp‐
101       mOpenFailed.  If insufficient working storage is allocated, it  returns
102       XpmNoMemory.   If  no  error occurs then it returns XpmSuccess.  If the
103       passed XpmInfo structure pointer is  not  NULL,  XpmWriteFileFromXpmIm‐
104       age()  looks  for the following attributes: XpmComments, XpmExtensions,
105       and XpmHotspot, and writes the related information out as well.  In ad‐
106       dition  on  systems  which support such features if the given file name
107       ends by ’.Z’ or ’.gz’ it is assumed to  be  a  compressed  file.  Then,
108       XpmWriteFileFromXpmImage()  writes to a piped compress or gzip process.
109       And if instead of a file name, NULL is passed to XpmWriteFileFromXpmIm‐
110       age(), it writes to the standard output.
111
112
113   XpmWriteFileFromBuffer
114       XpmWriteFileFromBuffer()  writes a XPM buffer to a file.  XpmWriteFile‐
115       FromBuffer() returns XpmOpenFailed if it cannot open the file, and Xpm‐
116       Success otherwise.
117
118       As  a  convenience,  the  XpmReadFileToBuffer()  and  XpmWriteFileFrom‐
119       Buffer() functions are provided to copy a file to a buffer and to write
120       a  file from a buffer.  Thus for instance one may decide to use XpmCre‐
121       ateBufferFromPixmap(), XpmWriteFileFromBuffer(), and XpmFree()  instead
122       of  XpmWriteFileFromPixmap().   On some systems this may lead to a per‐
123       formance improvement, since the parsing will be  performed  in  memory,
124       but it uses more memory.
125
126
127

SEE ALSO

129       XpmRead(3)
130
131
132
133X Version 11                     libXpm 3.5.17                     XpmWrite(3)
Impressum