-
Notifications
You must be signed in to change notification settings - Fork 3
/
SimbaExt_Core.pas
161 lines (131 loc) · 4.24 KB
/
SimbaExt_Core.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
//Define types used in SimbaExt
type
PInt8 = ^Int8;
PInt16 = ^Int16;
PInt32 = ^Int32;
PInt64 = ^Int64;
PUInt8 = ^UInt8;
PUInt16 = ^UInt16;
PUInt32 = ^UInt32;
PUInt64 = ^UInt64;
Float32 = Single;
Float64 = Double;
Float80 = Extended;
PFloat32 = ^Single;
PFloat64 = ^Double;
PFloat80 = ^Extended;
//Arr
TIntArray = TIntegerArray; //arg...
TFloatArray = Array of Float32;
TDoubleArray = Array of Float64;
TExtArray = Array of Float80;
//Spesific names
TInt8Array = Array of Int8;
TInt16Array = Array of Int16;
TInt32Array = Array of Int32;
TInt64Array = Array of Int64;
TFloat32Array = Array of Float32;
TFloat64Array = Array of Float64;
TFloat80Array = Array of Float80;
//Array of Array ..
//T2DIntArray = Array of TIntArray; //arg...
T2DExtArray = Array of TExtArray;
T2DFloatArray = Array of TFloatArray;
T2DDoubleArray = Array of TDoubleArray;
T2DBoxArray = Array of TBoxArray;
T2DBoolArray = Array of TBoolArray;
//Matrix ..
TByteMatrix = Array of TByteArray;
TIntMatrix = Array of TIntArray;
TExtMatrix = Array of TExtArray;
TFloatMatrix = Array of TFloatArray;
TDoubleMatrix = Array of TDoubleArray;
//Other ..
TColorSpace = (_LAB_, _LCH_, _XYZ_, _RGB_);
TWarningType = (ERR_DEPRECATED, ERR_WARNING, ERR_NOTICE);
TSortKey = (sort_Default, sort_Magnitude, sort_ByColumn, sort_ByRow, sort_ByX,
sort_ByY, sort_Length, sort_First, sort_Index, sort_Mean, sort_Lex, sort_Logical);
TSize2D = packed record W,H:Int32; end;
TSize3D = packed record W,H,D:Int32; end;
{|=====| Prefixes for SimbaExt modules |=====}
type
SimbaExt = type Pointer; //SE.***
TObjMath = type Pointer; //Math.***
TObjRandom = type Pointer; //Rand.***
TObjTime = type Pointer; //Time.***
TObjOSPath = type Pointer; //OS.*** & OS.Path.***
TObjOS = record path: TObjOSPath; end;
var
SE: SimbaExt;
Math: TObjMath;
{$IFDEF SRL6}Randm{$ELSE}Rand{$ENDIF}: TObjRandom;
TimeUtils: TObjTime;
OS: TObjOS;
//LoadLibrary from current folder
{$IFNDEF CODEINSIGHT}
{$loadlib \..\includes\simbaext\simbaext.dll}
{$loadlib \..\includes\simbaext\seextra.dll}
{$loadlib \..\includes\simbaext\matchTempl.dll}
{$ELSE}
//Types are exported from SimbaExt.dll, we should show am in codeinsight:
type TAlignAlgo = (AA_BOUNDS, AA_CHULL, AA_BBOX);
type TThreshAlgo = (TA_MEAN, TA_MINMAX);
type TCenterAlgo = (CA_BOUNDS, CA_BBOX, CA_MEAN, CA_MEDIAN);
type TResizeAlgo = (RA_NEAREST, RA_BILINEAR, RA_BICUBIC);
type TCCorrMode = (CC_EUCLID, CC_EUCLID_NORMED, CC_EUCLID_SQUARED, CC_CHEB, CC_CHEB_NORMED);
type TComparator = (__LT__, __GT__, __EQ__, __NE__, __GE__, __LE__);
{$ENDIF}
// IntToBox is to long, and [x1,y1,x2,y2] fails whenever used with a overloaded method..
{$IFNDEF AeroLib}
function ToBox(x1,y1,x2,y2: Integer): TBox;
{$ELSE}
function ToBox(x1,y1,x2,y2: Integer): TBox; override;
{$ENDIF}
begin
Result := [x1,y1,x2,y2];
end;
function ToBox(TopLeft, BtmRight:TPoint): TBox; overload;
begin
Result := [TopLeft.x, TopLeft.y, BtmRight.x, BtmRight.y];
end;
{!DOCREF} {
@method: procedure RaiseWarning(WarningMessage:String; Warn: TWarningType);
@desc: Used internally to raise a warning-message
}
procedure RaiseWarning(WarningMessage:String; Warn: TWarningType);
begin
{$IFNDEF ERR_HIDE_ALL}
case Warn of
ERR_DEPRECATED:
begin
{$IFNDEF ERR_HIDE_DEPRECATED}
WriteLn('DEPRECATED: ' + WarningMessage);
{$ENDIF}
end;
ERR_WARNING:
begin
{$IFNDEF ERR_HIDE_WARNINGS}
{$IFDEF ERR_REAL_EXCEPTION}
RaiseException(erException, 'WARNING: '+WarningMessage);
{$ELSE}
WriteLn('WARNING: ' + WarningMessage);
{$ENDIF}
{$ENDIF}
end;
ERR_NOTICE:
begin
{$IFNDEF ERR_HIDE_NOTICE}
WriteLn('NOTICE: ' + WarningMessage);
{$ENDIF}
end;
end;
{$ENDIF}
end;
function SimbaExt.GetException(): String;
begin
exp_GetException(Result);
end;
function SimbaExt.GetException(out Msg:String): Boolean; overload;
begin
Result := exp_GetException(Msg);
end;