PITypes.h

Go to the documentation of this file.
00001 // ADOBE SYSTEMS INCORPORATED
00002 // (c) Copyright  1993 - 2005, 2009 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(__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 #include <CoreServices/CoreServices.h>
00119 #include <ApplicationServices/ApplicationServices.h>
00120 #endif
00121 
00122 #ifndef TRUE
00123 #define TRUE    true
00124 #endif
00125 
00126 #ifndef FALSE
00127 #define FALSE   false
00128 #endif
00129 
00130 #ifndef MACPASCAL
00131 #define MACPASCAL pascal
00132 #endif
00133 
00134 #ifndef __MWERKS__
00135 #ifndef far
00136 #define far
00137 #endif
00138 #endif
00139 
00140 #ifndef huge
00141 #define huge
00142 #endif
00143 
00144 #ifndef __PSWorld__
00145 
00146 #include "PSIntTypes.h"
00147 
00148 #ifndef PSHALFFLOAT
00149 #define PSHALFFLOAT 1
00150 typedef uint16 PSHalfFloat;
00151 #endif
00152 
00153 #ifndef OTHER_AGM_BASIC_H
00154 #define OTHER_AGM_BASIC_H "PITypes.h"
00155 #endif
00156 
00157 #endif /* __PSWorld__ */
00158 
00159 typedef struct PlatformData {
00160 
00161     int16 dummy;                    /* dummy variable required for some compilers. */
00162 
00163     } PlatformData;
00164 
00165 #endif /* Macintosh */
00166 
00167 /******************************************************************************/
00168 
00169 /* Native floating point type. */
00170 
00171 #ifndef nativeFloat     // DRSWAT - get rid of redefined warning in GCC
00172 #define nativeFloat real64
00173 #endif
00174 
00175 /******************************************************************************/
00176 
00177 #if MSWindows
00178 
00179 #define MACPASCAL
00180 
00181 #ifndef __PSWorld__
00182 #if defined(WINVER)
00183 #undef WINVER
00184 #endif
00185 #define WINVER 0x500
00186 #include <windows.h>
00187 
00188 /* Error codes. */
00189 #define noErr 0
00190 
00191 #define userCanceledErr (-128)
00192 #define coercedParamErr 2
00193 
00194 #define readErr         (-19)
00195 #define writErr         (-20)
00196 #define openErr         (-23)
00197 #define dskFulErr           (-34)
00198 #define ioErr               (-36)
00199 #define eofErr              (-39)       // Also - end of descriptor error.
00200 #define fnfErr              (-43)
00201 #define vLckdErr            (-46)
00202 #define fLckdErr            (-45)
00203 #define paramErr            (-50)
00204 #define memFullErr      (-108)
00205 #define nilHandleErr        (-109)
00206 #define memWZErr            (-111)
00207 
00208 
00209 #define nil        NULL
00210 
00211 #ifndef TRUE
00212 #define TRUE 1
00213 #endif
00214 
00215 #ifndef FALSE
00216 #define FALSE 0
00217 #endif
00218 
00219 #ifndef true
00220 #define true       TRUE
00221 #endif
00222 
00223 #ifndef false
00224 #define false      FALSE
00225 #endif
00226 
00227 #include "PSIntTypes.h"
00228 
00229 typedef int32 Fixed;
00230 typedef int32 Fract;
00231 typedef int32 (*ProcPtr)();
00232 
00233 #ifndef __TYPES__
00234 #ifndef __GEOMETRY__
00235 typedef struct Point
00236    {
00237       int16 v;
00238       int16 h;
00239    } Point;
00240 
00241 typedef struct Rect
00242    {
00243       int16 top;
00244       int16 left;
00245       int16 bottom;
00246       int16 right;
00247    } Rect;
00248 #endif
00249 #endif
00250 
00251 #ifndef __QUICKDRAW__
00252 typedef struct
00253    {
00254       WORD red;        /* Magnitude of red   component, 16 bit significant.*/
00255       WORD green;      /* Magnitude of green component, 16 bit significant.*/
00256       WORD blue;       /* Magnitude of blue  component, 16 bit significant.*/
00257    } RGBColor;
00258 #endif
00259 
00260 #ifndef __OCE__
00261 typedef uint32 DescType;
00262 #endif
00263 
00264 typedef LPSTR Ptr;
00265 typedef LPSTR *Handle;
00266 typedef BYTE  Boolean;
00267 typedef uint32 OSType; // Must match FourCharCode from MacTypes.h
00268 typedef int16 OSErr;
00269 typedef uint32 ResType;
00270 
00271 typedef unsigned char Str255[256];  /*  first byte length of string. The string is zero terminated. */
00272 typedef const unsigned char *ConstStr255Param;
00273 
00274 // NOTE !!! It is VERY IMPORTANT that this structure stay consistent.
00275 // Photoshop on Windows has always had this structure set up so that the
00276 // parID is longword aligned.  Double check that the version that gets picked
00277 // up from Files.h in whatever Universal Headers are being used at the moment
00278 // also agrees.
00279 
00280 #ifndef _FSSPEC_
00281 #define _FSSPEC_    1
00282 
00283 typedef struct
00284     {
00285     int16 vRefNum;
00286     int16 padding;  // Make the padding explicit.
00287     int32 parID;
00288     Str255 name;    /* Pascal String, for Windows files. */
00289     } FSSpec;
00290 
00291 #endif
00292 #endif //_FSSPEC_
00293 
00294 typedef struct PlatformData {           //64bits - API struct
00295 
00296     intptr_t hwnd;        /* window to own dialogs. */
00297 
00298     } PlatformData;
00299     
00300 int16 ShowAlert (int16 stringID); /* Developer implements this  */
00301     
00302 #endif    /* Windows */
00303 
00304 /******************************************************************************/
00305 
00306 // Unicode character type.
00307 typedef uint16 Character;
00308 
00309 /******************************************************************************/
00310 
00311 // HACK (SRP): The definition of LookUpTable is done this way because PITypes.h
00312 // is included in PSWorld.h prior to LookUpTable being declared.
00313 
00314 typedef unsigned8 PILookUpTable [256];
00315 
00316 #ifndef __PSWorld__
00317 
00318 #ifndef __PSWorldEnums__
00319 
00320 /* Common datatypes defined in PSWorld */
00321 
00322 typedef PILookUpTable LookUpTable;
00323 
00324 typedef unsigned16 LookUpTable8x16 [256];
00325 
00327 typedef struct
00328     {
00329     LookUpTable R;
00330     LookUpTable G;
00331     LookUpTable B;
00332     } RGBLookUpTable;
00333 
00335 typedef struct
00336     {
00337     RGBLookUpTable clut;
00338     int32 count;
00339     int32 transparentIndex;
00340     } ColorTableInfo;
00341     
00342 #endif // __PSWorldEnums__
00343 
00344 /* Structures to hold colors in various spaces. */
00345 
00346 #ifndef __GEOMETRY__
00347 
00348 #ifndef USING_MFC
00349 
00350 typedef Rect CRect;
00351 
00352 #endif
00353 
00354 #endif
00355 
00356 #ifndef __UGEOMETRY__
00357 
00358 typedef struct
00359     {
00360     int32 top;
00361     int32 left;
00362     int32 bottom;
00363     int32 right;
00364     } VRect;
00365 
00367 typedef struct VPoint
00368     {
00369     int32 v;
00370     int32 h;
00371     } VPoint;
00372     
00373 #endif /* __UGEOMETRY__ */
00374 
00375 #ifndef __UMath__
00376 
00378 typedef struct FloatPoint
00379     {
00380     nativeFloat y, x;
00381     } FloatPoint;
00382 
00384 typedef struct FloatRect
00385     {
00386     nativeFloat top, left, bottom, right;
00387     } FloatRect;
00388 
00389 #endif /* __UMath__ */
00390     
00391 /******************************************************************************/
00392 
00393 /*
00394  * Display Ordering Values.  Passed to certain bottlenecks to tell them what
00395  * the data looks like, and used (on non-Macs) in the pmReserved field of a
00396  * pixmap to tag that data.  For compatibility, the values are designed to
00397  * match up with some Latitude defined values we created for the Unix 3.0.
00398  * - SLB
00399  */
00400  
00401 enum DisplayByteOrder {         /* Data is... */
00402     displayOrderIndexed = 0,    /* 8-bit, or otherwise unspecified. */
00403     displayOrderURGB = 1,       /* 32-bit, high 8 unused, Mac uses this. */
00404     displayOrderUBGR = 2,       /* 32-bit, high 8 unused, Sun, SGI like this. */
00405     displayOrderRGBU = 3,       /* 32-bit, low 8 unused, for completeness. */
00406     displayOrderBGRU = 4,       /* 32-bit, good for little-endian (PC). */
00407     displayOrderRGBPacked = 5,  /* 24-bit, unaligned, currently unsupported!! */
00408     displayOrderBGRPacked = 6   /* 24-bit, unaligned, currently unsupported!! */
00409 };
00410 
00411 #endif  /* __PSWorld__ */
00412 
00413 /******************************************************************************/
00414 
00416 typedef struct
00417     {
00418     unsigned8   c;
00419     unsigned8   m;
00420     unsigned8   y;
00421     unsigned8   k;
00422     } CMYKtuple;
00423 
00425  typedef struct
00426     {
00427     unsigned8   alpha;
00428     unsigned8   r;
00429     unsigned8   g;
00430     unsigned8   b;
00431     } RGBtuple;
00432 
00434 typedef struct
00435     {
00436     unsigned8   alpha;
00437     unsigned8   h;
00438     unsigned8   s;
00439     unsigned8   l;
00440     } HSLtuple;
00441 
00443 typedef struct
00444     {
00445     unsigned8   alpha;
00446     unsigned8   h;
00447     unsigned8   s;
00448     unsigned8   b;
00449     } HSBtuple;
00450 
00452 typedef struct
00453     {
00454     unsigned8   alpha;
00455     unsigned8   L;
00456     unsigned8   a;
00457     unsigned8   b;
00458     } LABtuple;
00459 
00461 typedef struct
00462     {
00463     unsigned16   alpha;
00464     unsigned16   r;
00465     unsigned16   g;
00466     unsigned16   b;
00467     } RGB16tuple;
00468 
00470 typedef struct
00471     {
00472     unsigned16   c;
00473     unsigned16   m;
00474     unsigned16   y;
00475     unsigned16   k;
00476     } CMYK16tuple;
00477 
00479 typedef struct
00480     {
00481     unsigned16   alpha;
00482     unsigned16   L;
00483     unsigned16   a;
00484     unsigned16   b;
00485     } LAB16tuple;
00486     
00488 typedef struct
00489     {
00490     unsigned8   alpha;
00491     unsigned8   padding;
00492     unsigned16  X;
00493     unsigned16  Y;
00494     unsigned16  Z;
00495     } XYZ16tuple;
00496 
00497 typedef unsigned8   inverseCLUT [32][32][32];
00498 typedef unsigned32  histogram3 [][32][32];
00499 
00500 typedef int16            HueSatTable [1536];
00501 typedef PILookUpTable    HueSatMaps[4];     /* general form of RGBLookUpTable */
00502 
00503 /* hack for BNTLocal.c et al */
00504 #ifndef __UMonitor__
00505 typedef int16 Short3by3 [3] [3];
00506 #endif /* __UMonitor__ */
00507 
00509 typedef struct PIFloatPoint
00510     {
00511     real64      y;
00512     real64      x;
00513     } PIFloatPoint;
00514 
00516 typedef struct PIFloatRect
00517     {
00518     real64      top;
00519     real64      left;
00520     real64      bottom;
00521     real64      right;
00522     } PIFloatRect;
00523 
00524 
00525 /* 
00526 PIAffineMatrix represents 3x3 matrix that has the following structure:
00527 
00528 |   xx      xy      0   |
00529 |   yx      yy      0   |
00530 |   tx      ty      1   |
00531 
00532 */
00533 
00543 typedef struct PIAffineMatrix
00544     {
00545     real64 xx, xy, yx, yy, tx, ty;
00546     } PIAffineMatrix;
00547 
00548 
00549 /******************************************************************************/
00550 #if defined (__BORLANDC__)   
00551 #pragma option -a.
00552 #endif
00553 
00554 
00555 #endif /* __PITypes_h__ */