1/*
2
3Copyright 1985, 1986, 1998  The Open Group
4
5Permission to use, copy, modify, distribute, and sell this software and its
6documentation for any purpose is hereby granted without fee, provided that
7the above copyright notice appear in all copies and that both that
8copyright notice and this permission notice appear in supporting
9documentation.
10
11The above copyright notice and this permission notice shall be included in
12all copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
17OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
21Except as contained in this notice, the name of The Open Group shall not be
22used in advertising or otherwise to promote the sale, use or other dealings
23in this Software without prior written authorization from The Open Group.
24
25*/
26
27/*
28 * XWDFile.h	MIT Project Athena, X Window system window raster
29 *		image dumper, dump file format header file.
30 *
31 *  Author:	Tony Della Fera, DEC
32 *		27-Jun-85
33 *
34 * Modifier:    William F. Wyatt, SAO
35 *              18-Nov-86  - version 6 for saving/restoring color maps
36 */
37
38#ifndef XWDFILE_H
39#define XWDFILE_H
40
41#include <X11/Xmd.h>
42
43#define XWD_FILE_VERSION 7
44#define sz_XWDheader 100
45#define sz_XWDColor 12
46
47typedef CARD32 xwdval;		/* for old broken programs */
48
49/* Values in the file are most significant byte first. */
50
51typedef struct _xwd_file_header {
52	/* header_size = SIZEOF(XWDheader) + length of null-terminated
53	 * window name. */
54	CARD32 header_size;
55
56	CARD32 file_version;		/* = XWD_FILE_VERSION above */
57	CARD32 pixmap_format;		/* ZPixmap or XYPixmap */
58	CARD32 pixmap_depth;		/* Pixmap depth */
59	CARD32 pixmap_width;		/* Pixmap width */
60	CARD32 pixmap_height;		/* Pixmap height */
61	CARD32 xoffset;			/* Bitmap x offset, normally 0 */
62	CARD32 byte_order;		/* of image data: MSBFirst, LSBFirst */
63
64	/* bitmap_unit applies to bitmaps (depth 1 format XY) only.
65	 * It is the number of bits that each scanline is padded to. */
66	CARD32 bitmap_unit;
67
68	CARD32 bitmap_bit_order;	/* bitmaps only: MSBFirst, LSBFirst */
69
70	/* bitmap_pad applies to pixmaps (non-bitmaps) only.
71	 * It is the number of bits that each scanline is padded to. */
72	CARD32 bitmap_pad;
73
74	CARD32 bits_per_pixel;		/* Bits per pixel */
75
76	/* bytes_per_line is pixmap_width padded to bitmap_unit (bitmaps)
77	 * or bitmap_pad (pixmaps).  It is the delta (in bytes) to get
78	 * to the same x position on an adjacent row. */
79	CARD32 bytes_per_line;
80	CARD32 visual_class;		/* Class of colormap */
81	CARD32 red_mask;		/* Z red mask */
82	CARD32 green_mask;		/* Z green mask */
83	CARD32 blue_mask;		/* Z blue mask */
84	CARD32 bits_per_rgb;		/* Log2 of distinct color values */
85	CARD32 colormap_entries;	/* Number of entries in colormap; not used? */
86	CARD32 ncolors;			/* Number of XWDColor structures */
87	CARD32 window_width;		/* Window width */
88	CARD32 window_height;		/* Window height */
89	CARD32 window_x;		/* Window upper left X coordinate */
90	CARD32 window_y;		/* Window upper left Y coordinate */
91	CARD32 window_bdrwidth;		/* Window border width */
92} XWDFileHeader;
93
94/* Null-terminated window name follows the above structure. */
95
96/* Next comes XWDColor structures, at offset XWDFileHeader.header_size in
97 * the file.  XWDFileHeader.ncolors tells how many XWDColor structures
98 * there are.
99 */
100
101typedef struct {
102        CARD32	pixel;
103        CARD16	red;
104        CARD16	green;
105        CARD16	blue;
106        CARD8	flags;
107        CARD8	pad;
108} XWDColor;
109
110/* Last comes the image data in the format described by XWDFileHeader. */
111
112#endif /* XWDFILE_H */
113
114