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