| 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 | /* This XImage has RGBA data, which is what OpenGL code typically expects. |
| 27 | Also it is upside down: the origin is at the bottom left of the image. |
| 28 | X11 typically expects 0RGB as it has no notion of alpha, only 1-bit masks. |
| 29 | With X11 code, you should probably use the _pixmap routines instead. |
| 30 | */ |
| 31 | extern XImage *image_data_to_ximage (Display *, Visual *, |
| 32 | const unsigned char *image_data, |
| 33 | unsigned long data_size); |
| 34 | |
| 35 | extern XImage *file_to_ximage (Display *, Visual *, const char *filename); |
| 36 | |
| 37 | #endif /* _XIMAGE_LOADER_H_ */ |