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