00001 #ifndef __AITypes__
00002 #define __AITypes__
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "./config/AIConfig.h"
00026
00027 #ifdef __cplusplus
00028 #include <exception>
00029 #endif
00030
00031 #include "AIBasicTypes.h"
00032 #include "AIErrorCodes.h"
00033
00034 #ifndef __ASTypes__
00035 #include "ASTypes.h"
00036 #endif
00037
00038 #include "ADMStdTypes.h"
00039
00040
00041 #ifdef WIN_ENV
00042 #include "AIWinDef.h"
00043 #endif
00044
00045 #ifndef __SPFiles__
00046 #include "SPFiles.h"
00047 #endif
00048
00049 #ifndef __SPPlugs__
00050 #include "SPPlugs.h"
00051 #endif
00052
00053 #include "AIHeaderBegin.h"
00054
00059
00060
00061
00062
00063
00064
00065 #define kPluginInterfaceVersion6001 0x06000001 // 6.0x1
00066 #define kPluginInterfaceVersion6002 0x06000020
00067
00068 #define kPluginInterfaceVersion7001 0x07000001 // AI 7.0
00069
00070 #define kPluginInterfaceVersion6021 0x06000021 // Joe's AI6-based prototype (only needed to run his plugins)
00071 #define kPluginInterfaceVersion8001 0x08000001 // AI 8.0
00072 #define kPluginInterfaceVersion9001 0x09000001 // AI 9.0
00073 #define kPluginInterfaceVersion10001 0x10000001 // AI 10.0
00074 #define kPluginInterfaceVersion11001 0x11000001 // AI 11.0
00075 #define kPluginInterfaceVersion12001 0x12000001 // AI 12.0
00076 #define kPluginInterfaceVersion13001 0x13000001 // AI 13.0
00077 #define kPluginInterfaceVersion14001 0x14000001 // AI 14.0
00078 #define kPluginInterfaceVersion15001 0x15000001 // AI 15.0
00079 #define kPluginInterfaceVersion16001 0x16000001 // AI 16.0
00080 #define kPluginInterfaceVersion17001 0x17000001 // AI 17.0
00081 #define kPluginInterfaceVersion17011 0x17000011 // AI 17.1
00082 #define kPluginInterfaceVersion18001 0x18000001 // AI 18.0
00083 #define kPluginInterfaceVersion18011 0x18000011 // AI 18.1
00084 #define kPluginInterfaceVersion19001 0x19000001 // AI 19.0
00085 #define kPluginInterfaceVersion19021 0x19000021 // AI 19.2
00086 #define kPluginInterfaceVersion20001 0x20000001 // AI 20.0
00087 #define kPluginInterfaceVersion20011 0x20000011 // AI 20.1
00088 #define kPluginInterfaceVersion21001 0x21000001 // AI 21.0
00089 #define kPluginInterfaceVersion21011 0x21000011 // AI 21.1
00090 #define kPluginInterfaceVersion22001 0x22000001 // AI 22.0
00091 #define kPluginInterfaceVersion22011 0x22000011 // AI 22.1
00092 #define kPluginInterfaceVersion23001 0x23000001 // AI 23.0
00093 #define kPluginInterfaceVersion23011 0x23000011 // AI 23.1
00094 #define kPluginInterfaceVersion24001 0x24000001 // AI 24.0
00095 #define kPluginInterfaceVersion24011 0x24000011 // AI 24.1
00096 #define kPluginInterfaceVersion24021 0x24000021 // AI 24.2
00097 #define kPluginInterfaceVersion24031 0x24000031 // AI 24.3
00098 #define kPluginInterfaceVersion25001 0x25000001 // AI 25.0
00099
00100 #define kPluginInterfaceVersion kPluginInterfaceVersion25001
00101
00102 #ifdef LINUX_ENV
00103 #define AIAPI_VERSION(x) (x + 2000)
00104 #endif
00105
00106 #ifdef MAC_ENV
00107 #define AIAPI_VERSION(x) (x + 1000)
00108 #endif
00109
00110 #ifdef WIN_ENV
00111 #define AIAPI_VERSION(x) (x)
00112 #endif
00113
00114 #define kPlatformUnloadedSuiteProc nullptr
00115
00116 #if !defined(__BUILD_PLUGIN__)
00117 #if defined(ILLUSTRATOR_H)
00118 #define __BUILD_PLUGIN__ 0
00119 #else
00120 #define __BUILD_PLUGIN__ 1
00121 #endif
00122 #endif
00123
00124
00126 #define PUSH_GLOBALS
00127
00128 #define POP_GLOBALS
00129
00130
00131 #if !defined(Macintosh)
00132 #if defined(MAC_ENV)
00133 #define Macintosh 1
00134 #endif
00135 #endif
00136
00137 #if !defined(MSWindows)
00138 #if defined(WIN_ENV)
00139 #define MSWindows 1
00140 #endif
00141 #endif
00142
00143
00146 #define kCanceledErr 'STOP'
00147
00149 #define kNoDocumentErr 'DOC?'
00150
00152 #define kSelectorClashErr 'CLSH'
00153
00155 #define kNameNotFoundErr 'NAM?'
00156
00158 #define kNameInUseErr 'NAM2'
00159
00161 #define kInvalidNameErr 'NA*!'
00162
00164 #define kNameTooLongErr 'NAL!'
00165
00167 #define kUndoRedoErr 'UND!'
00168
00170 #define kAIInvalidArtBoundsErr 'IABD'
00171
00175 #define kAIResourcePermissionErr '!PRM'
00176
00177 #define kImageTooBigError '!I2B'
00178
00179
00180
00181
00182
00183
00184
00185
00186 #define AI_THREAD_SAFE_API
00187 #define AI_MAIN_THREAD_API
00188
00189 #define AIAPI AI_MAIN_THREAD_API
00190
00191
00193 typedef struct ArtObject *AIArtHandle;
00194 typedef const struct ArtObject *ConstAIArtHandle;
00195
00197 typedef struct _t_AISafeArtOpaque *AISafeArtHandle;
00198
00200 typedef struct _t_AILayerOpaque *AILayerHandle;
00201
00203 typedef struct _t_AIDocument *AIDocumentHandle;
00204
00206 typedef ASFixed AIFixed;
00208 typedef ASFract AIFract;
00210 typedef ai::uint32 AIUFract;
00211
00212 typedef AIReal* AIRealPtr;
00213
00215 typedef struct _t_AIStreamOpaque *AIStream;
00217 typedef ASFixedRect AIFixedRect;
00219 typedef ASFixedPoint AIFixedPoint;
00221 typedef ASFixedMatrix AIFixedMatrix;
00222
00223 typedef ASRealMatrix AIFloatMatrix;
00224
00225
00226
00227
00228 typedef ASRealPoint AIFloatPoint;
00229
00232
00234 typedef ASByte AIBool8;
00235
00237 typedef struct _t_AIPlatformViewOpaque *AIPlatformViewRef;
00238
00239 #ifdef MAC_ENV
00240
00241 typedef struct MacPort_t* AIPortRef;
00242
00244 typedef struct MacWindow_t* AIWindowRef;
00245
00247 typedef struct MacDialog_t* AIDialogRef;
00248 #endif
00249
00250 #ifdef WIN_ENV
00251
00252 typedef HDC AIPortRef;
00253
00255 typedef HWND AIWindowRef;
00256
00258 typedef HWND AIDialogRef;
00259 #endif
00260
00261 #ifdef LINUX_ENV
00262
00263 typedef void* AIPortRef;
00264
00266 typedef void* AIWindowRef;
00267
00269 typedef void* AIDialogRef;
00270
00271 typedef void *HMENU;
00272 #endif
00273
00275
00277 struct AIRGBColor {
00279 ai::uint16 red, green, blue;
00280 };
00281
00285 typedef struct _t_AIEvent {
00287 unsigned short what;
00289 unsigned long message;
00291 unsigned long when;
00293 AIPoint where;
00296 unsigned short modifiers;
00297 } AIEvent;
00298
00300 typedef ASErr AIErr;
00301
00303 class ACEProfile;
00305 typedef ACEProfile *AIColorProfile;
00306
00308 typedef ai::uint32 AICommandID;
00309
00316 typedef const struct ZREFStruct *ZRef;
00317
00318 inline ZRef ZREF(const char* str)
00319 {
00320 return reinterpret_cast<ZRef>(str);
00321 }
00322
00341 typedef enum AIPaintOrder {
00343 kPlaceDefault = 0,
00345 kPlaceAbove = 1,
00347 kPlaceBelow,
00349 kPlaceInsideOnTop,
00351 kPlaceInsideOnBottom,
00353 kPlaceAboveAll,
00355 kPlaceBelowAll
00356 } AIPaintOrder;
00357
00359 typedef enum AIPaintUsage {
00360 kAINotUsed = 0x0000,
00362 kAIUsedOnFill = 0x0001,
00364 kAIUsedOnStroke = 0x0002,
00366 kAIUsedOnBoth = 0x0003
00367 } AIPaintUsage;
00368
00376 namespace ai
00377 {
00378 typedef enum Quadrant {
00379 kFirstQuadrant = 1,
00380 kSecondQuadrant,
00381 kThirdQuadrant,
00382 kFourthQuadrant
00383 } Quadrant;
00384
00388 enum class IconType: ai::uint8 {
00389 kInvalid = 0,
00390 kSVG,
00391 kPNG
00392 };
00393
00394 }
00395
00397 typedef enum AIVersion {
00398 kAIVersion1 = 1,
00399 kAIVersion88,
00400 kAIVersion3,
00401 kAIVersion4,
00402 kAIVersion5,
00403 kAIVersion6,
00404 kAIVersion7,
00405 kAIVersion8,
00406 kAIVersion9,
00407 kAIVersion10,
00408 kAIVersion11,
00409 kAIVersion12,
00410 kAIVersion13,
00411 kAIVersion14,
00412 kAIVersion15,
00413 kAIVersion16,
00414 kAIVersion17,
00415 kAIVersion18,
00416 kAIVersion19,
00417 kAIVersion20,
00418 kAIVersion21,
00419 kAIVersion22,
00420 kAIVersion23,
00421 kAIVersion24,
00422 kAIVersion25,
00423 kAIVersionLatest = kAIVersion25
00424 } AIVersion;
00425
00427 typedef enum AIUnits {
00429 kAINoUnits = 0,
00431 kAIPointUnits = 1,
00433 kAIInchUnits = 2,
00435 kAIMillimeterUnits = 3,
00437 kAICentimeterUnits = 4,
00439 kAIPicaUnits = 5,
00441 kAIPercentUnits = 6,
00443 kAIDegreeUnits = 7,
00445 kAIQUnits = 8,
00447 kAIBase16Units = 9,
00449 kAIPixelUnits = 10,
00451 kAITimeUnits = 11,
00453 kAIFeetUnits = 12,
00455 kAIHaUnits = 13,
00457 kAIFeetInchUnits = 14,
00459 kAIMeterUnits = 15,
00461 kAIYardUnits = 16,
00462
00464 kAIMinNormalUnits = kAIPointUnits,
00466 kAIMaxNormalUnits = kAIYardUnits,
00467
00469 kAIAppUnits1 = 101,
00471 kAIAppUnits2 = 102,
00473 kAIAppUnits3 = 103,
00475 kAIAppUnits4 = 104,
00477 kAIAppUnits5 = 105,
00479 kAIAppUnits6 = 106,
00481 kAIAppUnits7 = 107,
00483 kAIAppUnits8 = 108,
00485 kAIAppUnits9 = 109,
00487 kAIAppUnits10 = 110,
00489 kAIMaxAppUnits = kAIAppUnits10,
00490
00492 kAIDummyUnits = 0xFFFFFFFF
00493 } AIUnits;
00494
00495 struct AISize
00496 {
00497 AISize(AIReal w = 0, AIReal h = 0):width(w),height(h)
00498 {}
00499 AIReal width = 0;
00500 AIReal height = 0;
00501 };
00502
00503 #ifdef __cplusplus
00504 namespace ai {
00505
00506 #ifdef AI_HAS_NOEXCEPT
00507 #define AINOEXCEPT noexcept
00508 #else
00509 #define AINOEXCEPT
00510 #endif
00511
00515 #define AINOTHROW
00516
00517
00519 class Error : public std::exception
00520 {
00521 public:
00522 Error (AIErr err) : mErr(err) {}
00523
00524 const char* what() const AINOEXCEPT override { return "AI Exception"; }
00525
00526 operator AIErr () const AINOEXCEPT { return mErr; }
00527
00528 protected:
00529 AIErr mErr;
00530 };
00531
00532 class LogicError : public Error
00533 {
00534 public:
00535 LogicError(AIErr err, const char* msg) : Error(err), mMsg(msg) {}
00536
00537 const char* what() const AINOEXCEPT override { return mMsg; }
00538
00539 protected:
00540 const char* mMsg;
00541 };
00542
00543 }
00544 #endif
00545
00546
00547 #include "AIHeaderEnd.h"
00548
00549
00550
00551
00552
00553
00554
00555
00556 #ifdef __cplusplus
00557
00558
00559 inline bool operator==(const AIPoint& l, const AIPoint& r)
00560 {
00561 return l.h == r.h && l.v == r.v;
00562 }
00563 inline bool operator!=(const AIPoint& l, const AIPoint& r)
00564 {
00565 return !(l == r);
00566 }
00567 inline bool operator==(const AIRect& l, const AIRect& r)
00568 {
00569 return l.left == r.left && l.top == r.top && l.right == r.right && l.bottom == r.bottom;
00570 }
00571 inline bool operator!=(const AIRect& l, const AIRect& r)
00572 {
00573 return !(l == r);
00574 }
00575
00576 namespace ai {
00577
00582 inline void check_ai_error(AIErr err)
00583 {
00584 if (err != kNoErr)
00585 throw ai::Error(err);
00586 }
00587
00595 template <typename T>
00596 inline void check_precondition(T condition, AIErr err = kBadParameterErr)
00597 {
00598 if (!condition)
00599 throw ai::Error(err);
00600 }
00601
00610 template <class T> inline void NOTUSED(const T& result)
00611 {
00612 static_cast<void>(result);
00613 }
00614
00625 #ifdef AI_HAS_STATIC_ASSERT
00626 #define AI_STATIC_CHECK(expr, msg) static_assert(expr, #msg);
00627 #else
00628 template<bool> struct CompileTimeChecker
00629 {
00630 CompileTimeChecker(...);
00631 };
00633 template<> struct CompileTimeChecker<false> {};
00634
00641 #define AI_STATIC_CHECK(expr, msg) \
00642 {\
00643 class ERROR_##msg {};\
00644 (void)sizeof(ai::CompileTimeChecker<(expr) != 0>((new ERROR_##msg())));\
00645 }
00646 #endif // AI_HAS_STATIC_ASSERT
00647
00648 }
00649 #endif // __cplusplus
00650
00651 #endif