1 /*
2  * tkimg.h --
3  *
4  *  Interface to tkimg Base package.
5  *
6  * Copyright (c) 2002 Andreas Kupries <andreas_kupries@users.sourceforge.net>
7  *
8  * Zveno Pty Ltd makes this software and associated documentation
9  * available free of charge for any purpose.  You may make copies
10  * of the software but you must include all of this notice on any copy.
11  *
12  * Zveno Pty Ltd does not warrant that this software is error free
13  * or fit for any purpose.  Zveno Pty Ltd disclaims any liability for
14  * all claims, expenses, losses, damages and costs any user may incur
15  * as a result of using, copying or modifying the software.
16  */
17 
18 #ifndef __TKIMG_H__
19 #define __TKIMG_H__
20 
21 #ifdef _MSC_VER
22 #pragma warning(disable:4244) /* '=' : conversion from '__int64' to 'int', possible loss of data */
23 #pragma warning(disable:4761) /* integral size mismatch in argument; conversion supplied */
24 #endif
25 
26 #include <stdio.h> /* stdout, and other definitions */
27 #include <string.h>
28 #include <stdlib.h>
29 #include <ctype.h>
30 #include <tk.h>
31 
32 /*
33  * On a few systems, type boolean and/or its values FALSE, TRUE may appear
34  * in standard header files.  Or you may have conflicts with application-
35  * specific header files that you want to include together with these files.
36  * Defining HAVE_BOOLEAN before including tkimg.h should make it work.
37  */
38 
39 /* On windows use the boolean definition from its headers to prevent
40  * any conflicts should a user of this header use "windows.h". Without
41  * this we will have/get conflicting definitions of 'boolean' ('int'
42  * here, 'unsigned' char for windows)
43  */
44 
45 #ifndef HAVE_BOOLEAN
46 #define HAVE_BOOLEAN
47 #   ifndef __RPCNDR_H__     /* don't conflict if rpcndr.h already read */
48 #if defined(_WINDOWS) || defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(_Windows)
49 typedef unsigned char boolean;
50 #else
51 typedef int boolean;
52 #endif
53 #endif
54 #endif
55 
56 /*
57  * Used to block the rest of this header file from resource compilers so
58  * we can just get the version info.
59  */
60 #ifndef RC_INVOKED
61 
62 #ifndef CONST86
63 #   define CONST86
64 #endif
65 
66 #ifndef TK_PHOTO_COMPOSITE_OVERLAY
67 #   define TK_PHOTO_COMPOSITE_OVERLAY 0
68 #endif
69 #ifndef TK_PHOTO_COMPOSITE_SET
70 #   define TK_PHOTO_COMPOSITE_SET 1
71 #endif
72 
73 #include "tkimgDecls.h"
74 
75 #ifdef __cplusplus
76 extern "C" {
77 #endif /* __cplusplus */
78 
79 /*
80  *----------------------------------------------------------------------------
81  * C API for Tkimg generic layer
82  *----------------------------------------------------------------------------
83  */
84 
85 #define IMG_SPECIAL (1<<8)
86 #define IMG_PAD     (IMG_SPECIAL+1)
87 #define IMG_SPACE   (IMG_SPECIAL+2)
88 #define IMG_BAD     (IMG_SPECIAL+3)
89 #define IMG_DONE    (IMG_SPECIAL+4)
90 #define IMG_CHAN    (IMG_SPECIAL+5)
91 #define IMG_STRING  (IMG_SPECIAL+6)
92 
93 /*
94  * The variable "tkimg_initialized" contains flags indicating which
95  * version of Tcl or Perl we are running:
96  *
97  *  IMG_TCL    Tcl
98  *  IMG_PERL   perl
99  *  IMG_COMPOSITE Tcl 8.4 or higher
100  *  IMG_NOPANIC Tcl 8.5 or higher
101  *
102  * These flags will be determined at runtime (except the IMG_PERL
103  * flag, for now), so we can use the same dynamic library for all
104  * Tcl/Tk versions (and for Perl/Tk in the future).
105  */
106 
107 MODULE_SCOPE int tkimg_initialized;
108 
109 #define IMG_TCL (1<<9)
110 #define IMG_PERL (1<<11)
111 #define IMG_COMPOSITE (1<<14)
112 #define IMG_NOPANIC (1<<15)
113 
114 /* Maximum number of channels storable in a photo image. */
115 #define IMG_MAX_CHANNELS     4
116 
117 /* Definitions for mapping short or float images into unsigned char
118  * photo images. See tkimgMap.c for corresponding functions.
119  */
120 
121 /* Size of gamma correction table. */
122 #define IMG_GAMMA_TABLE_SIZE 257
123 
124 /* Mapping modes. */
125 #define IMG_MAP_NONE   0
126 #define IMG_MAP_MINMAX 1
127 #define IMG_MAP_AGC    2
128 #define IMG_MAP_NONE_STR   "none"
129 #define IMG_MAP_MINMAX_STR "minmax"
130 #define IMG_MAP_AGC_STR    "agc"
131 
132 MODULE_SCOPE int TkimgInitUtilities(Tcl_Interp* interp);
133 
134 /*
135  *----------------------------------------------------------------------------
136  * Function prototypes for stub initialization.
137  *----------------------------------------------------------------------------
138  */
139 
140 const char *
141 Tkimg_InitStubs(Tcl_Interp *interp, const char *version, int exact);
142 
143 #endif /* RC_INVOKED */
144 
145 #ifdef __cplusplus
146 }
147 #endif /* __cplusplus */
148 
149 #endif /* __TKIMG_H__ */
150