]> Creatis software - clitk.git/blob - utilities/CxImage/ximadef.h
Debug RTStruct conversion with empty struc
[clitk.git] / utilities / CxImage / ximadef.h
1 #if !defined(__ximadefs_h)
2 #define __ximadefs_h
3
4 #include "ximacfg.h"
5
6 #if defined(_AFXDLL)||defined(_USRDLL)
7  #define DLL_EXP __declspec(dllexport)
8 #elif defined(_MSC_VER)&&(_MSC_VER<1200)
9  #define DLL_EXP __declspec(dllimport)
10 #else
11  #define DLL_EXP
12 #endif
13
14
15 #if CXIMAGE_SUPPORT_EXCEPTION_HANDLING
16   #define cx_try try
17   #define cx_throw(message) throw(message)
18   #define cx_catch catch (const char *message)
19 #else
20   #define cx_try bool cx_error=false;
21   #define cx_throw(message) {cx_error=true; if(strcmp(message,"")) strncpy(info.szLastError,message,255); goto cx_error_catch;}
22   #define cx_catch cx_error_catch: char message[]=""; if(cx_error)
23 #endif
24
25
26 #if CXIMAGE_SUPPORT_JP2 || CXIMAGE_SUPPORT_JPC || CXIMAGE_SUPPORT_PGX || CXIMAGE_SUPPORT_PNM || CXIMAGE_SUPPORT_RAS
27  #define CXIMAGE_SUPPORT_JASPER 1
28 #else
29  #define CXIMAGE_SUPPORT_JASPER 0
30 #endif
31
32 #if CXIMAGE_SUPPORT_DSP
33 #undef CXIMAGE_SUPPORT_TRANSFORMATION
34  #define CXIMAGE_SUPPORT_TRANSFORMATION 1
35 #endif
36
37 #if CXIMAGE_SUPPORT_TRANSFORMATION || CXIMAGE_SUPPORT_TIF || CXIMAGE_SUPPORT_TGA || CXIMAGE_SUPPORT_BMP || CXIMAGE_SUPPORT_WINDOWS
38  #define CXIMAGE_SUPPORT_BASICTRANSFORMATIONS 1
39 #endif
40
41 #if CXIMAGE_SUPPORT_DSP || CXIMAGE_SUPPORT_TRANSFORMATION
42 #undef CXIMAGE_SUPPORT_INTERPOLATION
43  #define CXIMAGE_SUPPORT_INTERPOLATION 1
44 #endif
45
46 #if defined (_WIN32_WCE)
47  #undef CXIMAGE_SUPPORT_WMF
48  #define CXIMAGE_SUPPORT_WMF 0
49 #endif
50
51 #if !defined(WIN32) && !defined(_WIN32_WCE)
52  #undef CXIMAGE_SUPPORT_WINDOWS
53  #define CXIMAGE_SUPPORT_WINDOWS 0
54 #endif
55
56 #ifndef __min
57 #define __min(a,b) (((a)<(b))?(a):(b))
58 #endif
59 #ifndef __max
60 #define __max(a,b) (((a)>(b))?(a):(b))
61 #endif
62
63 #ifndef PI
64  #define PI 3.141592653589793f
65 #endif
66
67
68 #if defined(WIN32) || defined(_WIN32_WCE)
69 #include <windows.h>
70 #include <tchar.h>
71 #endif
72
73 #include <stdio.h>
74 #include <math.h>
75
76 #ifdef __BORLANDC__
77
78 #ifndef _COMPLEX_DEFINED
79
80 typedef struct tagcomplex {
81         double x,y;
82 } _complex;
83
84 #endif
85
86 #define _cabs(c) sqrt(c.x*c.x+c.y*c.y)
87
88 #endif
89
90
91 #if !defined(WIN32) && !defined(_WIN32_WCE)
92
93 #include <stdlib.h>
94 #include <string.h>
95 #include <ctype.h>
96
97 typedef unsigned char  BYTE;
98 typedef unsigned short WORD;
99 typedef unsigned long  DWORD;
100 typedef unsigned int   UINT;
101
102 typedef DWORD          COLORREF;
103 typedef unsigned int   HANDLE;
104 typedef void*          HRGN;
105
106 #ifndef BOOL
107 #define BOOL bool
108 #endif
109
110 #ifndef TRUE
111 #define TRUE true
112 #endif
113
114 #ifndef FALSE
115 #define FALSE false
116 #endif
117
118 #ifndef TCHAR
119 #define TCHAR char
120 #define _T
121 #endif
122
123 typedef struct tagRECT
124 {
125         long    left;
126         long    top;
127         long    right;
128         long    bottom;
129 } RECT;
130
131 typedef struct tagPOINT
132 {
133         long  x;
134         long  y;
135 } POINT;
136
137 typedef struct tagRGBQUAD {
138         BYTE    rgbBlue;
139         BYTE    rgbGreen;
140         BYTE    rgbRed;
141         BYTE    rgbReserved;
142 } RGBQUAD;
143
144 #pragma pack(1)
145
146 typedef struct tagBITMAPINFOHEADER{
147         DWORD      biSize;
148         long       biWidth;
149         long       biHeight;
150         WORD       biPlanes;
151         WORD       biBitCount;
152         DWORD      biCompression;
153         DWORD      biSizeImage;
154         long       biXPelsPerMeter;
155         long       biYPelsPerMeter;
156         DWORD      biClrUsed;
157         DWORD      biClrImportant;
158 } BITMAPINFOHEADER;
159
160 typedef struct tagBITMAPFILEHEADER {
161         WORD    bfType;
162         DWORD   bfSize;
163         WORD    bfReserved1;
164         WORD    bfReserved2;
165         DWORD   bfOffBits;
166 } BITMAPFILEHEADER;
167
168 typedef struct tagBITMAPCOREHEADER {
169         DWORD   bcSize;
170         WORD    bcWidth;
171         WORD    bcHeight;
172         WORD    bcPlanes;
173         WORD    bcBitCount;
174 } BITMAPCOREHEADER;
175
176 typedef struct tagRGBTRIPLE {
177         BYTE    rgbtBlue;
178         BYTE    rgbtGreen;
179         BYTE    rgbtRed;
180 } RGBTRIPLE;
181
182 #pragma pack()
183
184 #define BI_RGB        0L
185 #define BI_RLE8       1L
186 #define BI_RLE4       2L
187 #define BI_BITFIELDS  3L
188
189 #define GetRValue(rgb)      ((BYTE)(rgb))
190 #define GetGValue(rgb)      ((BYTE)(((WORD)(rgb)) >> 8))
191 #define GetBValue(rgb)      ((BYTE)((rgb)>>16))
192 #define RGB(r,g,b)          ((COLORREF)(((BYTE)(r)|((WORD)((BYTE)(g))<<8))|(((DWORD)(BYTE)(b))<<16)))
193
194 #ifndef _COMPLEX_DEFINED
195
196 typedef struct tagcomplex {
197         double x,y;
198 } _complex;
199
200 #endif
201
202 #define _cabs(c) sqrt(c.x*c.x+c.y*c.y)
203
204 #endif
205
206 #endif //__ximadefs