Package version up
[platform/upstream/xproto.git] / XWDFile.h
1 /*
2
3 Copyright 1985, 1986, 1998  The Open Group
4
5 Permission to use, copy, modify, distribute, and sell this software and its
6 documentation for any purpose is hereby granted without fee, provided that
7 the above copyright notice appear in all copies and that both that
8 copyright notice and this permission notice appear in supporting
9 documentation.
10
11 The above copyright notice and this permission notice shall be included in
12 all copies or substantial portions of the Software.
13
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
17 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
21 Except as contained in this notice, the name of The Open Group shall not be
22 used in advertising or otherwise to promote the sale, use or other dealings
23 in 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
47 typedef CARD32 xwdval;          /* for old broken programs */
48
49 /* Values in the file are most significant byte first. */
50
51 typedef struct _xwd_file_header {
52         /* header_size = SIZEOF(XWDheader) + length of null-terminated
53          * window name. */
54         CARD32 header_size B32;         
55
56         CARD32 file_version B32;        /* = XWD_FILE_VERSION above */
57         CARD32 pixmap_format B32;       /* ZPixmap or XYPixmap */
58         CARD32 pixmap_depth B32;        /* Pixmap depth */
59         CARD32 pixmap_width B32;        /* Pixmap width */
60         CARD32 pixmap_height B32;       /* Pixmap height */
61         CARD32 xoffset B32;             /* Bitmap x offset, normally 0 */
62         CARD32 byte_order B32;          /* 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 B32;         
67
68         CARD32 bitmap_bit_order B32;    /* 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 B32;          
73
74         CARD32 bits_per_pixel B32;      /* 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 B32;
80         CARD32 visual_class B32;        /* Class of colormap */
81         CARD32 red_mask B32;            /* Z red mask */
82         CARD32 green_mask B32;          /* Z green mask */
83         CARD32 blue_mask B32;           /* Z blue mask */
84         CARD32 bits_per_rgb B32;        /* Log2 of distinct color values */
85         CARD32 colormap_entries B32;    /* Number of entries in colormap; not used? */
86         CARD32 ncolors B32;             /* Number of XWDColor structures */
87         CARD32 window_width B32;        /* Window width */
88         CARD32 window_height B32;       /* Window height */
89         CARD32 window_x B32;            /* Window upper left X coordinate */
90         CARD32 window_y B32;            /* Window upper left Y coordinate */
91         CARD32 window_bdrwidth B32;     /* 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
101 typedef struct {
102         CARD32  pixel B32;
103         CARD16  red B16;
104         CARD16  green B16;
105         CARD16  blue B16;
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