Add GNU LGPL headers to all .c .C and .h files
[oweals/cde.git] / cde / lib / DtHelp / il / ilfile.h
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these librararies and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /* $XConsortium: ilfile.h /main/4 1995/12/19 16:54:40 cde-dec $ */
24 /**---------------------------------------------------------------------
25 ***     
26 ***    file:           ilfile.h
27 ***
28 ***    description:    Public declarations and functions for accessing 
29 ***                    TIFF files with the Image Library (IL).
30 ***     
31 ***
32 ***    (c)Copyright 1991, 1993 Hewlett-Packard Co.
33 ***    
34 ***                             RESTRICTED RIGHTS LEGEND
35 ***    Use, duplication, or disclosure by the U.S. Government is subject to
36 ***    restrictions as set forth in sub-paragraph (c)(1)(ii) of the Rights in
37 ***    Technical Data and Computer Software clause in DFARS 252.227-7013.
38 ***                             Hewlett-Packard Company
39 ***                             3000 Hanover Street
40 ***                             Palo Alto, CA 94304 U.S.A.
41 ***    Rights for non-DOD U.S. Government Departments and Agencies are as set
42 ***    forth in FAR 52.227-19(c)(1,2).
43 ***
44 ***-------------------------------------------------------------------*/
45
46
47
48 #ifndef ILFILE_H
49 #define ILFILE_H
50
51 #include <stdio.h>
52
53 #ifndef IL_H
54 #include "il.h"
55 #endif
56
57 #ifdef DTLIB
58 /* Used when this header is compiled into the DtHelp library */
59 #include "GraphicsP.h"
60 #endif /* DTLIB */
61
62 #ifndef NeedFunctionPrototypes
63 #if defined(FUNCPROTO) || defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus)
64 #define NeedFunctionPrototypes 1
65 #else
66 #define NeedFunctionPrototypes 0
67 #endif /* __STDC__ */
68 #endif /* NeedFunctionPrototypes */
69
70 #ifndef NeedWidePrototypes
71 #if defined(NARROWPROTO)
72 #define NeedWidePrototypes 0
73 #else
74 #define NeedWidePrototypes 1      /* default to make interropt. easier */
75 #endif
76 #endif
77
78 #ifdef __cplusplus               /* do not leave open across includes */
79 extern "C" {                                    /* for C++ V2.0 */
80 #endif
81
82
83         /*  ilFileTag.type */
84 #define IL_TAG_BYTE         1
85 #define IL_TAG_ASCII        2
86 #define IL_TAG_SHORT        3
87 #define IL_TAG_LONG         4
88 #define IL_TAG_RATIONAL     5
89 #define IL_MAX_TAG_TYPE     5
90
91         /*  Tags not read or written by the IL - caller
92             may read them with ilReadFileTags() or write them
93             using ilWriteFileImage().
94         */
95 #define IL_TAG_DOCUMENT_NAME        269
96 #define IL_TAG_IMAGE_DESCRIPTION    270
97 #define IL_TAG_MAKE                 271
98 #define IL_TAG_MODEL                272
99 #define IL_TAG_PAGE_NAME            285
100 #define IL_TAG_X_POSITION           286
101 #define IL_TAG_Y_POSITION           287
102 #define IL_TAG_TRANSFER_FUNCTION    301
103 #define IL_TAG_DATE_TIME            306
104 #define IL_TAG_ARTIST               315
105 #define IL_TAG_HOST_COMPUTER        316
106 #define IL_TAG_WHITE_POINT          318
107 #define IL_TAG_PRIMARY_CHROMATICITIES 319
108 #define IL_TAG_TRANSFER_RANGE       342
109
110         /*  Tags explicitly read and written (when appropriate)
111             by the IL.  These tags cannot be written by the caller
112             using ilWriteFileImage(), because the IL-defined values
113             will override those specified by the caller.
114         */
115 #define IL_TAG_NEW_SUBFILE_TYPE     254
116 #define IL_TAG_IMAGE_WIDTH          256
117 #define IL_TAG_IMAGE_LENGTH         257
118 #define IL_TAG_BITS_PER_SAMPLE      258
119 #define IL_TAG_COMPRESSION          259
120 #define IL_TAG_PHOTOMETRIC_INTERPRETATION 262
121 #define IL_TAG_FILL_ORDER           266     /* TIFF class F only */
122 #define IL_TAG_STRIP_OFFSETS        273
123 #define IL_TAG_SAMPLES_PER_PIXEL    277
124 #define IL_TAG_ROWS_PER_STRIP       278
125 #define IL_TAG_STRIP_BYTE_COUNTS    279
126 #define IL_TAG_X_RESOLUTION         282
127 #define IL_TAG_Y_RESOLUTION         283
128 #define IL_TAG_PLANAR_CONFIGURATION 284
129 #define IL_TAG_GROUP_3_OPTIONS      292
130 #define IL_TAG_GROUP_4_OPTIONS      293
131 #define IL_TAG_RESOLUTION_UNIT      296
132 #define IL_TAG_PAGE_NUMBER          297
133 #define IL_TAG_PREDICTOR            317
134 #define IL_TAG_SOFTWARE             305
135 #define IL_TAG_COLOR_MAP            320
136 #define IL_TAG_JPEG_PROC            512
137 #define IL_TAG_JPEG_INTERCHANGE_FORMAT 513
138 #define IL_TAG_JPEG_INTERCHANGE_FORMAT_LENGTH 514
139 #define IL_TAG_JPEG_RESTART_INTERVAL 515
140 #define IL_TAG_JPEG_Q_TABLES        519
141 #define IL_TAG_JPEG_DC_TABLES       520
142 #define IL_TAG_JPEG_AC_TABLES       521
143 #define IL_TAG_YCBCR_COEFFICIENTS   529
144 #define IL_TAG_YCBCR_SUBSAMPLING    530
145 #define IL_TAG_YCBCR_POSITIONING    531
146 #define IL_TAG_REFERENCE_BLACK_WHITE 532
147 #define IL_TAG_PRIVATE_0          34209
148
149         /*  ilWriteFileImage (method) */
150 #define IL_WRITE_MAIN       0
151 #define IL_WRITE_MASK       1
152 #define IL_WRITE_CHILD      2
153
154         /*  ilWriteFileImage (compression) */
155 #define IL_WRITE_CURRENT_COMPRESSION    (~0)
156
157 typedef ilObject ilFile;
158
159 typedef struct _ilFileImage {
160     ilFile              file;
161     struct _ilFileImage *pNext, *pPrev,
162                         *pMask,
163                         *pChild;
164     long                width, height;
165     long                xRes, yRes;
166     short               page, nPages;
167     ilImageDes          des;
168     ilImageFormat       format;
169     long                stripHeight;
170     } ilFileImagePublicRec;
171 typedef ilFileImagePublicRec *ilFileImage;
172
173         /*  TIFF file access types */
174 typedef struct {
175     unsigned short      number;
176     unsigned short      type;
177     unsigned long       nItems;
178     ilPtr               pItems;
179     } ilFileTag;
180
181 extern ilBool ilInitFile (
182 #if NeedFunctionPrototypes
183     ilContext           context,
184     FILE               *stream,
185     long                offset,
186     ilBool              MSBIsFirst,
187     unsigned long       mustBeZero
188 #endif
189     );
190
191 extern ilFile ilConnectFile (
192 #if NeedFunctionPrototypes
193     ilContext           context,
194 #ifdef DTLIB
195     /* Used when this header is compiled into the DtHelp library */
196     _DtGrStream         *stream,
197 #else
198     FILE                *stream,
199 #endif /* DTLIB */
200     long                offset,
201     unsigned long       mustBeZero
202 #endif
203     );
204
205 extern ilFileImage ilListFileImages (
206 #if NeedFunctionPrototypes
207     ilFile              file,
208     unsigned long       mustBeZero
209 #endif
210     );
211
212 extern ilPtr ilReadFileTags (
213 #if NeedFunctionPrototypes
214     ilFileImage         fileImage,
215     int                 nTags,
216     unsigned short     *pTagNumbers,
217     ilFileTag         **ppTags,
218     unsigned long       mustBeZero
219 #endif
220     );
221
222 extern ilBool ilReadFileImage (
223 #if NeedFunctionPrototypes
224     ilPipe              pipe,
225     ilFileImage         fileImage,
226     ilRect             *pSrcRect,
227     unsigned long       mustBeZero
228 #endif
229     );
230
231 extern ilBool ilWriteFileImage (
232 #if NeedFunctionPrototypes
233     ilPipe              pipe,
234     ilFile              file,
235     unsigned int        method,
236     ilFileImage         fileImage,
237     unsigned int        compression,
238     ilPtr               pCompressionData,
239     long                stripHeight,
240     long                xRes,
241     long                yRes,
242     short               page,
243     short               nPages,
244     int                 nTags,
245     ilFileTag          *pTags,
246     unsigned long       mustBeZero
247 #endif
248     );
249
250 #ifdef __cplusplus
251 }                                /* for C++ V2.0 */
252 #endif
253
254 #endif