ilxpm.h 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. /*
  2. * CDE - Common Desktop Environment
  3. *
  4. * Copyright (c) 1993-2012, The Open Group. All rights reserved.
  5. *
  6. * These libraries and programs are free software; you can
  7. * redistribute them and/or modify them under the terms of the GNU
  8. * Lesser General Public License as published by the Free Software
  9. * Foundation; either version 2 of the License, or (at your option)
  10. * any later version.
  11. *
  12. * These libraries and programs are distributed in the hope that
  13. * they will be useful, but WITHOUT ANY WARRANTY; without even the
  14. * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  15. * PURPOSE. See the GNU Lesser General Public License for more
  16. * details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with these libraries and programs; if not, write
  20. * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
  21. * Floor, Boston, MA 02110-1301 USA
  22. */
  23. /* $XConsortium: ilxpm.h /main/4 1995/10/23 16:03:21 rswiston $ */
  24. /* Copyright 1990,91 GROUPE BULL -- See licence conditions in file COPYRIGHT */
  25. /*****************************************************************************\
  26. * xpm.h: *
  27. * *
  28. * XPM library *
  29. * Include file *
  30. * *
  31. * Developed by Arnaud Le Hors *
  32. \*****************************************************************************/
  33. #ifndef XPM_h
  34. #define XPM_h
  35. #ifdef VMS
  36. /*
  37. #include "decw$include:Xlib.h"
  38. #include "decw$include:Intrinsic.h"
  39. */
  40. #include "sys$library:stdio.h"
  41. #else
  42. /*
  43. #include <X11/Xlib.h>
  44. #include <X11/Intrinsic.h>
  45. */
  46. #include <stdio.h>
  47. #endif
  48. /* we keep the same codes as for Bitmap management */
  49. /*
  50. #ifndef _XUTIL_H_
  51. #ifdef VMS
  52. #include "decw$include:Xutil.h"
  53. #else
  54. #include <X11/Xutil.h>
  55. #endif
  56. #endif
  57. */
  58. /* Return ErrorStatus codes:
  59. * null if full success
  60. * positive if partial success
  61. * negative if failure
  62. */
  63. #define XpmColorError 1
  64. #define XpmSuccess 0
  65. #define XpmOpenFailed -1
  66. #define XpmFileInvalid -2
  67. #define XpmNoMemory -3
  68. #define XpmColorFailed -4
  69. typedef struct {
  70. char *name; /* Symbolic color name */
  71. char *value; /* Color value */
  72. /* Pixel pixel; /* Color pixel */
  73. } XpmColorSymbol;
  74. typedef struct {
  75. unsigned long valuemask; /* Specifies which attributes are
  76. * defined */
  77. /* Visual *visual; /* Specifies the visual to use */
  78. /* Colormap colormap; /* Specifies the colormap to use */
  79. unsigned int depth; /* Specifies the depth */
  80. unsigned int width; /* Returns the width of the created
  81. * pixmap */
  82. unsigned int height; /* Returns the height of the created
  83. * pixmap */
  84. unsigned int x_hotspot; /* Returns the x hotspot's
  85. * coordinate */
  86. unsigned int y_hotspot; /* Returns the y hotspot's
  87. * coordinate */
  88. unsigned int cpp; /* Specifies the number of char per
  89. * pixel */
  90. /* Pixel *pixels; /* List of used color pixels */
  91. unsigned int npixels; /* Number of pixels */
  92. XpmColorSymbol *colorsymbols; /* Array of color symbols to
  93. * override */
  94. unsigned int numsymbols; /* Number of symbols */
  95. char *rgb_fname; /* RGB text file name */
  96. /* Infos */
  97. unsigned int ncolors; /* Number of colors */
  98. char ***colorTable; /* Color table pointer */
  99. char *hints_cmt; /* Comment of the hints section */
  100. char *colors_cmt; /* Comment of the colors section */
  101. char *pixels_cmt; /* Comment of the pixels section */
  102. unsigned int mask_pixel; /* Transparent pixel's color table
  103. * index */
  104. } XpmAttributes;
  105. /* Xpm attribute value masks bits */
  106. #define XpmVisual (1L<<0)
  107. #define XpmColormap (1L<<1)
  108. #define XpmDepth (1L<<2)
  109. #define XpmSize (1L<<3) /* width & height */
  110. #define XpmHotspot (1L<<4) /* x_hotspot & y_hotspot */
  111. #define XpmCharsPerPixel (1L<<5)
  112. #define XpmColorSymbols (1L<<6)
  113. #define XpmRgbFilename (1L<<7)
  114. #define XpmInfos (1L<<8) /* all infos members */
  115. #define XpmReturnPixels (1L<<9)
  116. #define XpmReturnInfos XpmInfos
  117. /*
  118. * minimal portability layer between ansi and KR C
  119. */
  120. /* forward declaration of functions with prototypes */
  121. #if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus)
  122. /* ANSI || C++ */
  123. #define FUNC(f, t, p) extern t f p
  124. #define LFUNC(f, t, p) static t f p
  125. #else /* K&R */
  126. #define FUNC(f, t, p) extern t f()
  127. #define LFUNC(f, t, p) static t f()
  128. #endif /* end of K&R */
  129. /*
  130. * functions declarations
  131. */
  132. #ifdef __cplusplus
  133. extern "C" {
  134. #endif
  135. /*
  136. FUNC(XpmCreatePixmapFromData, int, (Display * display,
  137. Drawable d,
  138. char **data,
  139. Pixmap * pixmap_return,
  140. Pixmap * shapemask_return,
  141. XpmAttributes * attributes));
  142. FUNC(XpmCreateDataFromPixmap, int, (Display * display,
  143. char ***data_return,
  144. Pixmap pixmap,
  145. Pixmap shapemask,
  146. XpmAttributes * attributes));
  147. FUNC(XpmReadFileToPixmap, int, (Display * display,
  148. Drawable d,
  149. char *filename,
  150. Pixmap * pixmap_return,
  151. Pixmap * shapemask_return,
  152. XpmAttributes * attributes));
  153. FUNC(XpmWriteFileFromPixmap, int, (Display * display,
  154. char *filename,
  155. Pixmap pixmap,
  156. Pixmap shapemask,
  157. XpmAttributes * attributes));
  158. FUNC(XpmCreateImageFromData, int, (Display * display,
  159. char **data,
  160. XImage ** image_return,
  161. XImage ** shapemask_return,
  162. XpmAttributes * attributes));
  163. FUNC(XpmCreateDataFromImage, int, (Display * display,
  164. char ***data_return,
  165. XImage * image,
  166. XImage * shapeimage,
  167. XpmAttributes * attributes));
  168. FUNC(XpmReadFileToImage, int, (Display * display,
  169. char *filename,
  170. XImage ** image_return,
  171. XImage ** shapeimage_return,
  172. XpmAttributes * attributes));
  173. FUNC(XpmWriteFileFromImage, int, (Display * display,
  174. char *filename,
  175. XImage * image,
  176. XImage * shapeimage,
  177. XpmAttributes * attributes));
  178. */
  179. FUNC(XpmAttributesSize, int, ());
  180. FUNC(XpmFreeAttributes, int, (XpmAttributes * attributes));
  181. #ifdef __cplusplus
  182. } /* for C++ V2.0 */
  183. #endif
  184. /* bakward compatibility */
  185. /* for version 3.0c */
  186. #define XpmPixmapColorError XpmColorError
  187. #define XpmPixmapSuccess XpmSuccess
  188. #define XpmPixmapOpenFailed XpmOpenFailed
  189. #define XpmPixmapFileInvalid XpmFileInvalid
  190. #define XpmPixmapNoMemory XpmNoMemory
  191. #define XpmPixmapColorFailed XpmColorFailed
  192. #define XpmReadPixmapFile(dpy, d, file, pix, mask, att) \
  193. XpmReadFileToPixmap(dpy, d, file, pix, mask, att)
  194. #define XpmWritePixmapFile(dpy, file, pix, mask, att) \
  195. XpmWriteFileFromPixmap(dpy, file, pix, mask, att)
  196. /* for version 3.0b */
  197. #define PixmapColorError XpmColorError
  198. #define PixmapSuccess XpmSuccess
  199. #define PixmapOpenFailed XpmOpenFailed
  200. #define PixmapFileInvalid XpmFileInvalid
  201. #define PixmapNoMemory XpmNoMemory
  202. #define PixmapColorFailed XpmColorFailed
  203. #define ColorSymbol XpmColorSymbol
  204. #define XReadPixmapFile(dpy, d, file, pix, mask, att) \
  205. XpmReadFileToPixmap(dpy, d, file, pix, mask, att)
  206. #define XWritePixmapFile(dpy, file, pix, mask, att) \
  207. XpmWriteFileFromPixmap(dpy, file, pix, mask, att)
  208. #define XCreatePixmapFromData(dpy, d, data, pix, mask, att) \
  209. XpmCreatePixmapFromData(dpy, d, data, pix, mask, att)
  210. #define XCreateDataFromPixmap(dpy, data, pix, mask, att) \
  211. XpmCreateDataFromPixmap(dpy, data, pix, mask, att)
  212. #endif