1 /*
2    nsimage-tiff.h
3 
4    Functions for dealing with tiff images
5 
6    Copyright (C) 1996 Free Software Foundation, Inc.
7 
8    Written by:  Adam Fedor <fedor@colorado.edu>
9    Date: Feb 1996
10 
11    This file is part of the GNUstep GUI Library.
12 
13    This library is free software; you can redistribute it and/or
14    modify it under the terms of the GNU Lesser General Public
15    License as published by the Free Software Foundation; either
16    version 2 of the License, or (at your option) any later version.
17 
18    This library is distributed in the hope that it will be useful,
19    but WITHOUT ANY WARRANTY; without even the implied warranty of
20    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
21    Lesser General Public License for more details.
22 
23    You should have received a copy of the GNU Lesser General Public
24    License along with this library; see the file COPYING.LIB.
25    If not, see <http://www.gnu.org/licenses/> or write to the
26    Free Software Foundation, 51 Franklin Street, Fifth Floor,
27    Boston, MA 02110-1301, USA.
28 */
29 
30 /*
31     Warning:  This header file should not be used for reading and
32     writing tiff files.  You should use the NSImage and NSBitmapImageRep
33     classes for general reading/writing of tiff files.
34 */
35 
36 #ifndef _GNUstep_H_tiff
37 #define _GNUstep_H_tiff
38 
39 #include <tiffio.h>
40 #include <sys/types.h>
41 
42 /* Structure to store common information about a tiff. */
43 typedef struct {
44     uint16  numImages;	      /* number of images in tiff */
45     uint16  imageNumber;      /* number of current image */
46     uint32  subfileType;
47     uint32  width;
48     uint32  height;
49     uint16 bitsPerSample;    /* number of bits per data channel */
50     uint16 samplesPerPixel;  /* number of channels per pixel */
51     uint16 planarConfig;     /* meshed or separate */
52     uint16 photoInterp;      /* photometric interpretation of bitmap data, */
53     uint16 compression;
54     uint16 extraSamples;     /* Alpha */
55     int     assocAlpha;
56     int     quality;	      /* compression quality (for jpeg) 1 to 255 */
57     int     error;
58     float   xdpi;
59     float   ydpi;
60 } NSTiffInfo;
61 
62 typedef struct {
63     uint32 size;
64     uint16 *red;
65     uint16 *green;
66     uint16 *blue;
67 } NSTiffColormap;
68 
69 typedef char* realloc_data_callback(char* data, long size);
70 
71 extern TIFF* NSTiffOpenDataRead(const char* data, long size);
72 extern TIFF* NSTiffOpenDataWrite(char **data, long *size);
73 extern int   NSTiffClose(TIFF* image);
74 
75 extern int   NSTiffGetImageCount(TIFF* image);
76 extern int   NSTiffWrite(TIFF *image, NSTiffInfo *info, unsigned char *data);
77 extern int   NSTiffRead(TIFF *image, NSTiffInfo *info, unsigned char *data);
78 extern NSTiffInfo* NSTiffGetInfo(int imageNumber, TIFF* image);
79 
80 extern NSTiffColormap* NSTiffGetColormap(TIFF* image);
81 
82 extern int NSTiffIsCodecConfigured(unsigned int codec);
83 
84 #endif // _GNUstep_H_tiff
85 
86