f5b714ae7451887ce1b3ebfa8f17b6cfd916ee29
[xscreensaver] / hacks / ximage-loader.h
1 /* ximage-loader.h --- converts XPM data to Pixmaps.
2  * xscreensaver, Copyright (c) 1998-2018 Jamie Zawinski <jwz@jwz.org>
3  *
4  * Permission to use, copy, modify, distribute, and sell this software and its
5  * documentation for any purpose is hereby granted without fee, provided that
6  * the above copyright notice appear in all copies and that both that
7  * copyright notice and this permission notice appear in supporting
8  * documentation.  No representations are made about the suitability of this
9  * software for any purpose.  It is provided "as is" without express or 
10  * implied warranty.
11  */
12
13 #ifndef _XIMAGE_LOADER_H_
14 #define _XIMAGE_LOADER_H_
15
16 extern Pixmap file_to_pixmap (Display *, Window, const char *filename,
17                               int *width_ret, int *height_ret,
18                               Pixmap *mask_ret);
19
20 extern Pixmap image_data_to_pixmap (Display *, Window, 
21                                     const unsigned char *image_data,
22                                     unsigned long data_size,
23                                     int *width_ret, int *height_ret,
24                                     Pixmap *mask_ret);
25
26 extern XImage *image_data_to_ximage (Display *, Visual *,
27                                      const unsigned char *image_data,
28                                      unsigned long data_size);
29
30 /* This XImage has RGBA data, which is what OpenGL code typically expects.
31    X11 typically expects 0RGB as it has no notion of alpha, only 1-bit masks.
32    With X11 code, you should probably use the _pixmap routines instead.
33  */
34 extern XImage *file_to_ximage (Display *, Visual *, const char *filename);
35
36 #endif /* _XIMAGE_LOADER_H_ */