Aurelon Open API 8.1.1
Loading...
Searching...
No Matches
AOI_Types.h
1/*
2 * AOI_Types
3 * Copyright (c) 2007-2017 Aurelon BV. All rights reserved.
4 *
5 * Types for several utility classes
6 */
7#pragma once
8
9#include <math.h>
10#include <stdio.h>
11#include <stdlib.h>
12#include <stdint.h>
13
14#if defined(__GNUC__)
15
16 #define ACPL_MAC 1
17 #define ACPL_WIN 0
18
19 #define ARCH_PPC __BIG_ENDIAN__
20 #define ARCH_INTEL __LITTLE_ENDIAN__
21
22 #define AOIAPI __attribute__((visibility("default")))
23 #define CALLBACK
24
25 #define OS_BEEP ::AudioServicesPlayAlertSound( kUserPreferredAlert )
26
27 const float AOI_NegInf = -3.402823466e+38F;
28 const float AOI_PosInf = 3.402823466e+38F;
29 #define FABS fabs
30#else
31
32 #define ACPL_MAC 0
33 #define ACPL_WIN 1
34
35 #define ARCH_PPC 0
36 #define ARCH_INTEL 1
37
38 typedef char** PolyHandle;
39
40# define fixed1 Fixed16( 0x00010000L )// thus now exsist in Universal header...
41# define FixedToFloat(a) ( float(a) / fixed1 )
42# define FloatToFixed(a) Fixed16( float(a) * fixed1 )
43
44 #ifdef AOI_EXPORTS
45 #define AOIAPI __declspec(dllexport)
46 #else
47 #define AOIAPI __declspec(dllimport)
48 #endif
49
50 #define OS_BEEP ::MessageBeep(-1)
51
52 #include <float.h>
53
54 const float AOI_NegInf = -FLT_MAX;
55 const float AOI_PosInf = FLT_MAX;
56 #define FABS fabs
57#endif
58
59typedef char * Ptr;
60typedef unsigned char Uchar;
61typedef unsigned char * StringPtr;
62typedef const unsigned char *ConstStringPtr;
63typedef unsigned char Str31[32];
64typedef unsigned char Str63[64];
65typedef unsigned char Str255[256];
66
67typedef int32_t Fixed16;
68#if __APPLE__ && !__LP64__
69typedef long ExceptionCode;
70#else
71typedef int32_t ExceptionCode;
72#endif
73typedef int32_t Message;
74
75#define ENUM32( v ) *(int32_t*)&v
76
77#ifndef MAX
78 #define MAX(x,y) ((x)>(y) ? (x) : (y))
79#endif
80#ifndef MIN
81# define MIN(x,y) ((x)<(y) ? (x) : (y))
82#endif
83
84typedef struct AOI_ContourElement_Flags
85{
86 uint16_t handle : 1;
87 uint16_t selected : 1;
88 uint16_t start : 1;
89 uint16_t stop : 1;
90 uint16_t closed : 1;
91 uint16_t smooth : 1;
92 uint16_t automatic : 1;
93 uint16_t spline : 1;
94 uint16_t multipurpose: 1;
95 uint16_t reserved1 : 1;
96 uint16_t reserved2 : 1;
97 uint16_t reserved3 : 1;
98 uint16_t reserved4 : 1;
99 uint16_t reserved5 : 1;
100 uint16_t reserved6 : 1;
101 uint16_t reserved7 : 1;
102} AOI_ContourElement_Flags;
103
104typedef struct AOI_ContourElement
105{
106 float x;
107 float y;
108 AOI_ContourElement_Flags flag;
109} AOI_ContourElement;
110typedef AOI_ContourElement* AOI_ContourElementPtr;
111
112class AOIAPI AOI_Mapping
113{
114public:
115 float map[3][3];
116
117 AOI_Mapping();
118 AOI_Mapping( const AOI_Mapping& );
119 AOI_Mapping( const float* );
120 AOI_Mapping( const double* );
121
122 void Reset();
123 void Invert();
124 void Move( float, float );
125 void Rotate( float, float, float );
126 void Scale( float, float, float, float );
127 void Skew( float, float, float, float );
128 void Map( const AOI_Mapping& );
129 float Determinant() const;
130 bool IsUnity() const;
131 bool IsMove() const;
132 bool IsScale() const;
133 void Check();
134};
135
136class AOIAPI AOI_Point
137{
138public:
139 float x;
140 float y;
141
142 AOI_Point();
143 AOI_Point( float, float );
144 AOI_Point( const AOI_Point& );
145};
146
147class AOIAPI AOI_Rectangle
148{
149public:
150 float left;
151 float top;
152 float right;
153 float bottom;
154
156 AOI_Rectangle( float x1, float y1, float x2, float y2 );
158 void Union( const AOI_Rectangle& );
159 bool Intersect( const AOI_Rectangle& );
160 bool CoordInBounds( const AOI_Point& ) const;
161 bool Overlaps( const AOI_Rectangle& ) const;
162 void TLtoBR();
163};
164
165typedef enum AOI_ColorSpaceEnum
166{
167 AOI_NoSpace = 0,
168 AOI_RGBSpace = 1,
169 AOI_CMYKSpace = 2,
170 AOI_HLSSpace = 4,
171 AOI_XYZSpace = 6,
172 AOI_LABSpace = 8,
173 AOI_GraySpace = 10,
174
175 AOI_DeviceNSpace = 32,
176 AOI_DeviceNMask = 31,
177
178 AOI_IndexedSpaces = 64,
179 AOI_IndexedMask = 63,
180 AOI_IndexedRGBSpace = 65,
181 AOI_IndexedCMYKSpace = 66,
182 AOI_IndexedLABSpace = 72,
183 AOI_IndexedGraySpace = 74,
184
185 AOI_MaxSpace = 0xFFFFFFFF
186} AOI_ColorSpaceEnum;
187
188int32_t AOIAPI AOI_ColorSpaceComponents( AOI_ColorSpaceEnum );
189void AOIAPI AOI_ColorSpaceComponentLAB( AOI_ColorSpaceEnum space, int ch, uint16_t* lab );
190
191inline int32_t AOI_ColorSpaceBits( AOI_ColorSpaceEnum space )
192{
193 return AOI_ColorSpaceComponents( space ) << 3;
194}
195
196static const uint16_t AOI_ColorValue1 = 0xFFFF;
197
198#define AOI_INDEXED( s ) AOI_ColorSpaceEnum( (s) | AOI_IndexedSpaces )
199#define AOI_NONINDEXED( s ) AOI_ColorSpaceEnum( (s) & ~AOI_IndexedSpaces )
200#define AOI_DEVICEN( n ) AOI_ColorSpaceEnum( AOI_DeviceNSpace | (n) )
201#define AOI_NCOMPS( s ) int32_t( (s) & AOI_DeviceNMask )
202#define MAX_CHANNELS 64
203
204class AOI_ColorSpace;
205
206class AOI_Color
207{
208public:
209 AOI_ColorSpace* space;
210 uint16_t channel[ MAX_CHANNELS ];
211};
212typedef AOI_Color* AOI_ColorPtr;
213
214#define aurFontSansSerif (0)
215#define aurFontFixedWidth (1 << 0)
216#define aurFontSerif (1 << 1)
217#define aurFontSymbolic (1 << 2)
218#define aurFontItalic (1 << 6)
219#define aurFontBold (1 << 18)
220#define aurFontJapanese (1 << 7)
221#define aurFontKorean (1 << 8)
222#define aurFontChineseT (1 << 9)
223#define aurFontChineseS (1 << 10)
224#define aurFontCJKV ( aurFontJapanese | aurFontKorean | aurFontChineseT | aurFontChineseS )
225
226typedef enum AOI_EncodingType
227{
228 AOI_ETUnicode = 0,
229 AOI_ETMacRoman,
230 AOI_ETWinAnsi,
231 AOI_ETAdobeStandard,
232 AOI_ETAdobeExpert,
233 AOI_ETAdobeCustom,
234 AOI_ETSymbol,
235 AOI_ETZapfDingbats,
236 AOI_ETCustom_Obsolete,
237 AOI_ETCID,
238 AOI_ETNoEncoding,
239 AOI_ETMaxEnumEncodingType = 0xFFFFFFFFL
240} AOI_EncodingType;
3x3 matrix
Definition AOI_Types.h:113
Coordinate.
Definition AOI_Types.h:137
Rectangle.
Definition AOI_Types.h:148
int32_t AOIAPI AOI_ColorSpaceComponents(AOI_ColorSpaceEnum)
int32_t AOI_ColorSpaceBits(AOI_ColorSpaceEnum space)
Definition AOI_Types.h:191