PITypes.h

Go to the documentation of this file.
00001 // ADOBE SYSTEMS INCORPORATED
00002 // (c) Copyright  1993 - 2005 Adobe Systems Incorporated
00003 // All Rights Reserved
00004 //
00005 // NOTICE:  Adobe permits you to use, modify, and distribute this 
00006 // file in accordance with the terms of the Adobe license agreement
00007 // accompanying it.  If you have received this file from a source
00008 // other than Adobe, then your use, modification, or distribution
00009 // of it requires the prior written permission of Adobe.
00010 //-------------------------------------------------------------------
00023 #ifndef __PITypes__
00024 #define __PITypes__
00025 
00026 #pragma once
00027 
00028 #include "SPTypes.h"
00029 
00030 /******************************************************************************/
00031 
00032 /* Set up the preprocessor flags to indicate the target platform.   */
00033 
00034 #ifndef MSWindows
00035 #define MSWindows   (MSDOS || WIN32)
00036 #endif
00037 
00038 #if defined(__APPLE_CC__)
00039 #define Macintosh 1
00040 #endif
00041 
00042 #ifndef Macintosh
00043 #if (defined(macintosh) || defined(__powerc) || defined(__MC68K__) || defined(__MACH__) || defined (__POWERPC__) || defined(THINK_C)) && !MSWindows
00044 #define Macintosh 1
00045 #else
00046 #define Macintosh 0
00047 #endif
00048 #endif /* #ifndef Macintosh */
00049 
00050 #ifndef MacintoshOS
00051 #define MacintoshOS (Macintosh)
00052 #endif
00053 
00054 #ifndef Macintosh68K
00055 #define Macintosh68K    (MacintoshOS && m68k)
00056 #endif
00057 
00058 #ifndef MacintoshPPC
00059 #define MacintoshPPC    (MacintoshOS && defined(__POWERPC__)) // DRSWAT
00060 #endif
00061 
00062 #if defined (__BORLANDC__)
00063 #pragma option -a-
00064 #endif
00065 
00066 /******************************************************************************/
00067 
00068 /* Set up the flags for the Adobe Graphics Manager. */
00069 
00070 #ifdef MAC_ENV
00071 #undef MAC_ENV
00072 #endif
00073 
00074 #ifdef WIN_ENV
00075 #undef WIN_ENV
00076 #endif
00077 
00078 #if Macintosh
00079 #define MAC_ENV 1
00080 #endif
00081 
00082 #if MSWindows
00083 #define WIN_ENV 1
00084 #if WIN32
00085 #define WINNT_ENV   1
00086 #endif
00087 #endif
00088 
00089 /******************************************************************************/
00090 
00091 /* Some utility defines for C/C++ compatiblity. */
00092 
00093 #ifndef START_C_INCLUDE
00094 #ifdef __cplusplus
00095 #define START_C_INCLUDE extern "C" {
00096 #define END_C_INCLUDE }
00097 #else
00098 #define START_C_INCLUDE
00099 #define END_C_INCLUDE
00100 #endif
00101 #endif
00102 
00103 #ifndef START_C_CODE
00104 #ifdef __cplusplus
00105 #define START_C_CODE extern "C" {
00106 #define END_C_CODE }
00107 #else
00108 #define START_C_CODE
00109 #define END_C_CODE
00110 #endif
00111 #endif
00112 
00113 /******************************************************************************/
00114 
00115 #if Macintosh
00116 
00117 #ifndef __PSWorld__
00118 
00119 #ifdef __MACH__
00120 #include <Carbon.h>
00121 #else
00122 #include <MacTypes.h>
00123 #include <MacMemory.h>
00124 #include <Resources.h>
00125 #include <Quickdraw.h>
00126 #include <Dialogs.h>
00127 #include <OSUtils.h>
00128 #include <ToolUtils.h>
00129 
00130 #ifndef __MACH__
00131 #include <Packages.h>
00132 #endif
00133 
00134 #include <MacErrors.h>
00135 #include <Files.h>
00136 #include <Aliases.h>
00137 #include <AppleEvents.h>
00138 #endif // __MACH__
00139 
00140 #endif
00141 
00142 #ifndef TRUE
00143 #define TRUE    true
00144 #endif
00145 
00146 #ifndef FALSE
00147 #define FALSE   false
00148 #endif
00149 
00150 #ifndef MACPASCAL
00151 #define MACPASCAL pascal
00152 #endif
00153 
00154 #ifndef __MWERKS__
00155 #ifndef far
00156 #define far
00157 #endif
00158 #endif
00159 
00160 #ifndef huge
00161 #define huge
00162 #endif
00163 
00164 #ifndef __PSWorld__
00165 
00166 #if defined(_MSC_VER)
00167     // MSVC++ is weird!
00168     typedef __int64 int64;
00169     typedef __int64 int64_t;
00170     typedef unsigned __int64 uint64;
00171     typedef unsigned __int64 unsigned64;
00172 #else
00173     typedef long long int64;
00174     
00175 #ifndef _MACHTYPES_H_
00176     // Apple defines this in types.h
00177     typedef long long int64_t;
00178 #endif
00179 
00180     typedef unsigned long long uint64;
00181     typedef unsigned long long unsigned64;
00182 #endif
00183 
00184 typedef signed long  int32;
00185 typedef signed short int16;
00186 typedef signed char  int8;
00187 
00188 
00189 typedef unsigned long  unsigned32;
00190 typedef unsigned short unsigned16;
00191 typedef unsigned char  unsigned8;
00192 
00193 #ifndef PSHALFFLOAT
00194 #define PSHALFFLOAT 1
00195 typedef unsigned short PSHalfFloat;
00196 #endif
00197 
00198 /* The following types are used by AGM and we arrange to define them so that */
00199 /* we won't have conflicts when working with AGM. */
00200 
00201 typedef unsigned8   uint8;
00202 typedef unsigned16  uint16;
00203 typedef unsigned32  uint32;
00204 
00205 typedef unsigned char   Bool8;
00206 typedef unsigned long   Bool32;
00207 
00208 #ifndef OTHER_AGM_BASIC_H
00209 #define OTHER_AGM_BASIC_H "PITypes.h"
00210 #endif
00211 
00212 #endif /* __PSWorld__ */
00213 
00214 typedef struct PlatformData {
00215 
00216     short dummy;                    /* dummy variable required for some compilers. */
00217 
00218     } PlatformData;
00219 
00220 #endif /* Macintosh */
00221 
00222 /******************************************************************************/
00223 
00224 /* Native floating point type. */
00225 
00226 #if Macintosh && TARGET_CPU_68K
00227 
00228 #define nativeFloat extended
00229 
00230 #else
00231 
00232 #ifndef nativeFloat     // DRSWAT - get rid of redefined warning in GCC
00233 #define nativeFloat double
00234 #endif
00235 
00236 #endif
00237 
00238 /******************************************************************************/
00239 
00240 #if MSWindows
00241 
00242 #define MACPASCAL
00243 
00244 #ifndef __PSWorld__
00245 #include <windows.h>
00246 
00247 /* Error codes. */
00248 #define noErr 0
00249 
00250 #define userCanceledErr (-128)
00251 #define coercedParamErr 2
00252 
00253 #define readErr         (-19)
00254 #define writErr         (-20)
00255 #define openErr         (-23)
00256 #define dskFulErr           (-34)
00257 #define ioErr               (-36)
00258 #define eofErr              (-39)       // Also - end of descriptor error.
00259 #define fnfErr              (-43)
00260 #define vLckdErr            (-46)
00261 #define fLckdErr            (-45)
00262 #define paramErr            (-50)
00263 #define memFullErr      (-108)
00264 #define nilHandleErr        (-109)
00265 #define memWZErr            (-111)
00266 
00267 
00268 #define nil        NULL
00269 
00270 #ifndef TRUE
00271 #define TRUE 1
00272 #endif
00273 
00274 #ifndef FALSE
00275 #define FALSE 0
00276 #endif
00277 
00278 #ifndef true
00279 #define true       TRUE
00280 #endif
00281 
00282 #ifndef false
00283 #define false      FALSE
00284 #endif
00285 
00286 #if _MSC_VER
00287 typedef __int64 int64;
00288 typedef unsigned __int64 unsigned64;
00289 #else
00290 typedef signed long long int64;
00291 typedef unsigned long long unsigned64;
00292 #endif
00293 
00294 typedef signed long  int32;
00295 typedef signed short int16;
00296 typedef signed char  int8;
00297 
00298 typedef unsigned long   uint32;
00299 typedef unsigned short  uint16;
00300 typedef unsigned char   uint8;
00301 
00302 typedef unsigned long  unsigned32;
00303 typedef unsigned short unsigned16;
00304 typedef unsigned char  unsigned8;
00305 
00306 
00307 
00308 typedef long Fixed;
00309 typedef long Fract;
00310 typedef long (*ProcPtr)();
00311 
00312 #ifndef __TYPES__
00313 #ifndef __GEOMETRY__
00314 typedef struct Point
00315    {
00316       short v;
00317       short h;
00318    } Point;
00319 
00320 typedef struct Rect
00321    {
00322       short top;
00323       short left;
00324       short bottom;
00325       short right;
00326    } Rect;
00327 #endif
00328 #endif
00329 
00330 #ifndef __QUICKDRAW__
00331 typedef struct
00332    {
00333       WORD red;        /* Magnitude of red   component, 16 bit significant.*/
00334       WORD green;      /* Magnitude of green component, 16 bit significant.*/
00335       WORD blue;       /* Magnitude of blue  component, 16 bit significant.*/
00336    } RGBColor;
00337 #endif
00338 
00339 #ifndef __OCE__
00340 typedef unsigned long DescType;
00341 #endif
00342 
00343 typedef LPSTR Ptr;
00344 typedef LPSTR *Handle;
00345 typedef BYTE  Boolean;
00346 typedef DWORD OSType;
00347 typedef short OSErr;
00348 typedef unsigned long ResType;
00349 
00350 typedef unsigned char Str255[256];  /*  first byte length of string. The string is zero terminated. */
00351 typedef const unsigned char *ConstStr255Param;
00352 
00353 // NOTE !!! It is VERY IMPORTANT that this structure stay consistent.
00354 // Photoshop on Windows has always had this structure set up so that the
00355 // parID is longword aligned.  Double check that the version that gets picked
00356 // up from Files.h in whatever Universal Headers are being used at the moment
00357 // also agrees.
00358 
00359 #ifndef _FSSPEC_
00360 #define _FSSPEC_    1
00361 
00362 typedef struct
00363     {
00364     short vRefNum;
00365     short padding;  // Make the padding explicit.
00366     long parID;
00367     Str255 name;    /* Pascal String, for Windows files. */
00368     } FSSpec;
00369 
00370 #endif
00371 #endif //_FSSPEC_
00372 
00373 typedef struct PlatformData {           //64bits - API struct
00374 
00375     intptr_t hwnd;        /* window to own dialogs. */
00376 
00377     } PlatformData;
00378     
00379 short ShowAlert (short stringID); /* Developer implements this  */
00380     
00381 #endif    /* Windows */
00382 
00383 /******************************************************************************/
00384 
00385 // Unicode character type.
00386 typedef uint16 Character;
00387 
00388 /******************************************************************************/
00389 
00390 // HACK (SRP): The definition of LookUpTable is done this way because PITypes.h
00391 // is included in PSWorld.h prior to LookUpTable being declared.
00392 
00393 typedef unsigned8 PILookUpTable [256];
00394 
00395 #ifndef __PSWorld__
00396 
00397 /* Common datatypes defined in PSWorld */
00398 
00399 typedef PILookUpTable LookUpTable;
00400 
00401 typedef unsigned16 LookUpTable8x16 [256];
00402 
00404 typedef struct
00405     {
00406     LookUpTable R;
00407     LookUpTable G;
00408     LookUpTable B;
00409     } RGBLookUpTable;
00410 
00412 typedef struct
00413     {
00414     RGBLookUpTable clut;
00415     int32 count;
00416     int32 transparentIndex;
00417     } ColorTableInfo;
00418     
00419 /* Structures to hold colors in various spaces. */
00420 
00421 #ifndef __GEOMETRY__
00422 
00423 #ifndef USING_MFC
00424 
00425 typedef Rect CRect;
00426 
00427 #endif
00428 
00429 #endif
00430 
00431 #ifndef __UGEOMETRY__
00432 
00433 typedef struct
00434     {
00435     int32 top;
00436     int32 left;
00437     int32 bottom;
00438     int32 right;
00439     } VRect;
00440 
00442 typedef struct VPoint
00443     {
00444     int32 v;
00445     int32 h;
00446     } VPoint;
00447     
00448 #endif /* __UGEOMETRY__ */
00449 
00450 #ifndef __UMath__
00451 
00453 typedef struct FloatPoint
00454     {
00455     nativeFloat y, x;
00456     } FloatPoint;
00457 
00459 typedef struct FloatRect
00460     {
00461     nativeFloat top, left, bottom, right;
00462     } FloatRect;
00463 
00464 #endif /* __UMath__ */
00465 
00466 typedef char TVolumeName [256];
00467     
00468 /******************************************************************************/
00469 
00470 /*
00471  * Display Ordering Values.  Passed to certain bottlenecks to tell them what
00472  * the data looks like, and used (on non-Macs) in the pmReserved field of a
00473  * pixmap to tag that data.  For compatibility, the values are designed to
00474  * match up with some Latitude defined values we created for the Unix 3.0.
00475  * - SLB
00476  */
00477  
00478 enum DisplayByteOrder {         /* Data is... */
00479     displayOrderIndexed = 0,    /* 8-bit, or otherwise unspecified. */
00480     displayOrderURGB = 1,       /* 32-bit, high 8 unused, Mac uses this. */
00481     displayOrderUBGR = 2,       /* 32-bit, high 8 unused, Sun, SGI like this. */
00482     displayOrderRGBU = 3,       /* 32-bit, low 8 unused, for completeness. */
00483     displayOrderBGRU = 4,       /* 32-bit, good for little-endian (PC). */
00484     displayOrderRGBPacked = 5,  /* 24-bit, unaligned, currently unsupported!! */
00485     displayOrderBGRPacked = 6   /* 24-bit, unaligned, currently unsupported!! */
00486 };
00487 
00488 #endif  /* __PSWorld__ */
00489 
00490 /******************************************************************************/
00491 
00493 typedef struct
00494     {
00495     unsigned8   c;
00496     unsigned8   m;
00497     unsigned8   y;
00498     unsigned8   k;
00499     } CMYKtuple;
00500 
00502  typedef struct
00503     {
00504     unsigned8   alpha;
00505     unsigned8   r;
00506     unsigned8   g;
00507     unsigned8   b;
00508     } RGBtuple;
00509 
00511 typedef struct
00512     {
00513     unsigned8   alpha;
00514     unsigned8   h;
00515     unsigned8   s;
00516     unsigned8   l;
00517     } HSLtuple;
00518 
00520 typedef struct
00521     {
00522     unsigned8   alpha;
00523     unsigned8   h;
00524     unsigned8   s;
00525     unsigned8   b;
00526     } HSBtuple;
00527 
00529 typedef struct
00530     {
00531     unsigned8   alpha;
00532     unsigned8   L;
00533     unsigned8   a;
00534     unsigned8   b;
00535     } LABtuple;
00536 
00538 typedef struct
00539     {
00540     unsigned16   alpha;
00541     unsigned16   r;
00542     unsigned16   g;
00543     unsigned16   b;
00544     } RGB16tuple;
00545 
00547 typedef struct
00548     {
00549     unsigned16   c;
00550     unsigned16   m;
00551     unsigned16   y;
00552     unsigned16   k;
00553     } CMYK16tuple;
00554 
00556 typedef struct
00557     {
00558     unsigned16   alpha;
00559     unsigned16   L;
00560     unsigned16   a;
00561     unsigned16   b;
00562     } LAB16tuple;
00563     
00565 typedef struct
00566     {
00567     unsigned8   alpha;
00568     unsigned8   padding;
00569     unsigned16  X;
00570     unsigned16  Y;
00571     unsigned16  Z;
00572     } XYZ16tuple;
00573 
00574 typedef unsigned8   inverseCLUT [32][32][32];
00575 typedef unsigned32  histogram3 [][32][32];
00576 
00577 typedef int16            HueSatTable [1536];
00578 typedef PILookUpTable    HueSatMaps[4];     /* general form of RGBLookUpTable */
00579 
00580 /* hack for BNTLocal.c et al */
00581 #ifndef __UMonitor__
00582 typedef int16 Short3by3 [3] [3];
00583 #endif /* __UMonitor__ */
00584 
00586 typedef struct PIFloatPoint
00587     {
00588     double      y;
00589     double      x;
00590     } PIFloatPoint;
00591 
00593 typedef struct PIFloatRect
00594     {
00595     double      top;
00596     double      left;
00597     double      bottom;
00598     double      right;
00599     } PIFloatRect;
00600 
00601 
00602 /* 
00603 PIAffineMatrix represents 3x3 matrix that has the following structure:
00604 
00605 |   xx      xy      0   |
00606 |   yx      yy      0   |
00607 |   tx      ty      1   |
00608 
00609 */
00610 
00620 typedef struct PIAffineMatrix
00621     {
00622     double xx, xy, yx, yy, tx, ty;
00623     } PIAffineMatrix;
00624 
00625 
00626 /******************************************************************************/
00627 #if defined (__BORLANDC__)   
00628 #pragma option -a.
00629 #endif
00630 
00631 
00632 #endif /* __PITypes_h__ */