home *** CD-ROM | disk | FTP | other *** search
/ ftp.mactech.com 2010 / ftp.mactech.com.tar / ftp.mactech.com / machack / Hacks95 / Closure.sit / Closure / Sources / PhotoshopHeaders / PIGeneral.h < prev    next >
Text File  |  1995-06-24  |  14KB  |  476 lines

  1. /*
  2.     File: PIGeneral.h
  3.  
  4.     Copyright 1992-95 by Adobe Systems, Inc.  All rights reserved.
  5.  
  6.     This file describes the elements common to all plug-in interfaces.
  7. */
  8.  
  9. #ifndef __PIGeneral__
  10. #define __PIGeneral__
  11.  
  12. #include "PITypes.h"
  13.  
  14. #if !MSWindows && !THINK_C
  15. #pragma options align=mac68k
  16. #endif
  17.  
  18. #if defined(__BORLANDC__)
  19. #pragma option -a-
  20. #endif
  21.  
  22. #if MSWindows
  23. /* The following macros are part of PIGeneral.r on the Mac. We need to have access  */
  24. /* to those macros in a header file. This file should be updated to reflect the     */
  25. /* changes made to PIGeneral.r.                                                        */
  26.  
  27. #define PIVersion "3.00"
  28. #define ProductVersion  3,0,0x80,0
  29.  
  30. #define supportsBitmap          1
  31. #define supportsGrayScale       2
  32. #define supportsIndexedColor    4
  33. #define supportsRGBColor        8
  34. #define supportsCMYKColor      16
  35. #define supportsHSLColor       32
  36. #define supportsHSBColor       64
  37. #define supportsMultichannel  128
  38. #define supportsDuotone       256
  39. #define supportsLABColor      512
  40.  
  41. #define latestAcquireVersion        4
  42. #define latestAcquireSubVersion     0
  43. #define latestExportVersion         4
  44. #define latestExportSubVersion      0
  45. #define latestExtensionVersion      1
  46. #define latestExtensionSubVersion   0
  47. #define latestFilterVersion         4
  48. #define latestFilterSubVersion      0
  49. #define latestFormatVersion         1
  50. #define latestFormatSubVersion      0
  51.  
  52. #endif
  53.  
  54. /********************************************************************************/
  55.  
  56. /* The following error codes are available for all plug-ins. */
  57.  
  58. #define errPlugInHostInsufficient    -30900
  59.         /* "the plug-in requires services not provided by this host." */
  60.  
  61. #define errPlugInPropertyUndefined    -30901
  62.         /* "a requested property could not be found. */
  63.  
  64. /********************************************************************************/
  65.  
  66. #define PIKindProperty            0x6b696e64L /* 'kind' <OSType> giving the plug-in's kind */
  67. #define PIVersionProperty        0x76657273L /* 'vers' <int32> Major<int16>.Minor<int16> version number. */
  68. #define PIPriorityProperty        0x70727479L /* 'prty' <int32> Load order priority */
  69. #define PIImageModesProperty    0x6d6f6465L /* 'mode' <FlagSet> Image modes supported flags. (bitmask) */
  70. #define PIRequiredHostProperty    0x686f7374L /* 'host' <OSType> giving host required if any. */
  71. #define PICategoryProperty        0x63617467L /* 'catg' <PString> Category name that appears on top level menu. */
  72. #define PINameProperty            0x6e616d65L /* 'name' <PString> Menu name. */
  73. #define PI68KCodeProperty        0x6d36386bL /* 'm68k' <PI68KCodeDesc> 68k code descriptor. See type below. */
  74. #define PI68KFPUCodeProperty    0x36386670L    /* '68fp' <PI68KCodeDesc> 68k w/FPU code descriptor. See type below. */
  75. #define PIPowerPCCodeProperty    0x70777063L /* 'pwpc' <PICFMCodeDesc> PowerPC code descriptor. See type below. */
  76. #define PIWin32X86CodeProperty  0x77783836L /* 'wx86' <PIWin32X86CodeDesc> Win32 Intel code descriptor. See type below */
  77. #define PIWin16X86CodeProperty  0x66783836L /* 'fx86' <PIWin16X86CodeDesc> Win16 Intel code descriptor. See type below */
  78.  
  79. /********************************************************************************/
  80.  
  81. /* Structures that directly represent resources. */
  82.  
  83. #define kCurrentPiPLVersion 0
  84.  
  85. typedef struct PIProperty
  86.     {
  87.     OSType vendorID;        /* Vendor specific identifier. */
  88.     OSType propertyKey;        /* Identification key for this property type. */
  89.     int32  propertyID;        /* Index within this property type. Must be unique for properties of a given type in a PiPL. */
  90.     int32  propertyLength;    /* Length of following data array. Will be rounded to a multiple of 4. */
  91.     char   propertyData [1]; /* propertyLength bytes long. Must be a multiple of 4. Can be zero? */
  92.     } PIProperty;
  93.  
  94. typedef struct PIPropertyList
  95.     {
  96.     int32 version;            /* Properties datastructure version number. */
  97.     int32 count;            /* Number of properties contained. */
  98.     PIProperty properties[1];    /* The actual properties. */
  99.     } PIPropertyList;
  100.  
  101. typedef PIPropertyList **PIPropertyListHandle;
  102.  
  103. /* Below are structures describing types used in plug-in property lists.
  104.  * These structure obey Macintosh 68k alignment and padding rules though
  105.  * generally they are laid out so fields have natural alignment and any
  106.  * needed padding is explicit in the structure.
  107.  *
  108.  * In addition to these structure types, simple types such as int32, int16,
  109.  * etc. are used. Two other examples are PString and FlagSet. PString is like a
  110.  * rez pstring or a Str255 except that storage maynot be present for all
  111.  * 255 characters. The initial length byte is present in the property.
  112.  * FlagSet is a variable length bitstring in which the first member is
  113.  * represented by the most significant bit of the first byte, the eighth
  114.  * member is in the least significant bit of the first byte, etc. The length
  115.  * of the set is kept in the property's length field of course.
  116.  *
  117.  * Arrays are also used in places with bounds either taken from the
  118.  * property length or explicitly represented within the property.
  119.  */
  120.  
  121. typedef struct PI68KCodeDesc
  122.     {
  123.     OSType fType;
  124.     int16 fID;
  125.     } PI68KCodeDesc;
  126.  
  127. typedef struct PICFMCodeDesc
  128.     {
  129.     long fContainerOffset;
  130.     long fContainerLength;
  131.     char fEntryName[1];
  132.     } PICFMCodeDesc;
  133.     
  134. typedef struct PIWin32X86CodeDesc
  135. {
  136.     char fEntryName[1];
  137. } PIWin32X86CodeDesc;
  138.  
  139. typedef struct PIWin16X86CodeDesc
  140. {
  141.     char fEntryName[1];
  142. } PIWin16X86CodeDesc;
  143.  
  144. typedef struct TypeCreatorPair
  145.     {
  146.     OSType type;
  147.     OSType creator;
  148.     } TypeCreatorPair;
  149.  
  150. /********************************************************************************/
  151.  
  152. typedef struct PlugInInfo
  153.     {
  154.  
  155.     int16    version;            /* The version number of the interface supported. */
  156.     int16    subVersion;         /* The sub-version number.                          */
  157.     int16    priority;            /* The plug-in's priority.                        */
  158.     int16    generalInfoSize;    /* The size of the general info.                  */
  159.     int16    typeInfoSize;        /* The size of the type specific info.              */
  160.     int16    supportsMode;        /* A bit mask indicating supported image modes.   */
  161.     OSType    requireHost;        /* A required host if any.                          */
  162.  
  163.     }
  164. PlugInInfo;
  165.  
  166. #if !MSWindows && !THINK_C
  167. #pragma options align=reset
  168. #endif
  169.  
  170. typedef struct PSBuffer *BufferID;
  171.  
  172. #define kPIGeneralInfoSize 16
  173.  
  174. /* Image modes */
  175.  
  176. #define plugInModeBitmap       0
  177. #define plugInModeGrayScale    1
  178. #define plugInModeIndexedColor 2
  179. #define plugInModeRGBColor       3
  180. #define plugInModeCMYKColor    4
  181. #define plugInModeHSLColor       5
  182. #define plugInModeHSBColor       6
  183. #define plugInModeMultichannel 7
  184. #define plugInModeDuotone       8
  185. #define plugInModeLabColor       9
  186. #define plugInModeGray16      10
  187. #define plugInModeRGB48          11
  188.  
  189. /* The Window procID for a Moveable Modal Dialog window that can be used
  190.  *    under System 6.  WDEF(128) is part of Photoshop.
  191.  */
  192.  
  193. #define PSmovableDBoxProc    (128*16+5)
  194.  
  195. /* Other commonly used structures */
  196.  
  197. typedef int16 PlaneMap [16];
  198.  
  199. typedef struct PlugInMonitor
  200.     {
  201.     Fixed gamma;
  202.     Fixed redX;
  203.     Fixed redY;
  204.     Fixed greenX;
  205.     Fixed greenY;
  206.     Fixed blueX;
  207.     Fixed blueY;
  208.     Fixed whiteX;
  209.     Fixed whiteY;
  210.     Fixed ambient;
  211.     }
  212. PlugInMonitor;
  213.  
  214. /* The following structures reflect the version 1 structure for PSPixelMaps. */
  215.  
  216. typedef struct PSPixelMask
  217.     {
  218.     struct PSPixelMask *next;
  219.     void *maskData;
  220.     int32 rowBytes;
  221.     int32 colBytes;
  222.     int32 maskDescription;
  223.     }
  224. PSPixelMask;
  225.  
  226. #define kSimplePSMask   0
  227. #define kBlackMatPSMask 1
  228. #define kGrayMatPSMask  2
  229. #define kWhiteMatPSMask 3
  230. #define kInvertPSMask   4
  231.  
  232. typedef struct PSPixelMap
  233.     {
  234.     int32 version;
  235.     VRect bounds;
  236.     int32 imageMode;
  237.     int32 rowBytes;
  238.     int32 colBytes;
  239.     int32 planeBytes;
  240.     void *baseAddr;
  241.     
  242.     /* Fields new in version 1. */
  243.     
  244.     PSPixelMask *mat;
  245.     PSPixelMask *masks;
  246.     int32 maskPhaseRow;    /* Used for setting the phase of the checkerboard. */
  247.     int32 maskPhaseCol;
  248.     }
  249. PSPixelMap;
  250.  
  251. typedef struct ColorServicesInfo
  252.     {
  253.     int32 infoSize;
  254.     int16 selector;
  255.     int16 sourceSpace;
  256.     int16 resultSpace;
  257.     Boolean resultGamutInfoValid;
  258.     Boolean resultInGamut;
  259.     void *reservedSourceSpaceInfo;     /* Must be NULL. (Will return paramErr if not.) */
  260.     void *reservedResultSpaceInfo;     /* Must be NULL. (Will return paramErr if not.) */
  261.     int16 colorComponents[4];
  262.     void *reserved;                     /* Must be NULL. (Will return paramErr if not.) */
  263.     Str255 *pickerPrompt;
  264.     }
  265. ColorServicesInfo;
  266.  
  267. /* Constants for resultSpace and sourceSpace fields. */
  268. #define plugIncolorServicesRGBSpace    0
  269. #define plugIncolorServicesHSBSpace    1
  270. #define plugIncolorServicesCMYKSpace    2
  271. #define plugIncolorServicesLabSpace    3
  272. #define plugIncolorServicesGraySpace    4
  273. #define plugIncolorServicesHSLSpace    5
  274. #define plugIncolorServicesXYZSpace    6
  275.  
  276. /* Only valid in the resultSpace field. Says leave the color in the space the user chose.
  277.  * Custom colors will be returned in an arbitrary space possibly depending on the book.
  278.  */
  279. #define plugIncolorServicesChosenSpace    -1
  280.  
  281. /* Color Service Selectors. */
  282. #define plugIncolorServicesChooseColor    0
  283. #define plugIncolorServicesConvertColor    1
  284.  
  285. #ifdef __cplusplus
  286.  
  287. extern "C"
  288.     {
  289. #endif
  290.  
  291.     typedef MACPASCAL Boolean (*TestAbortProc) (void);
  292.  
  293.     typedef MACPASCAL void (*ProgressProc) (int32 done, int32 total);
  294.  
  295.     typedef MACPASCAL void (*HostProc) (int16 selector, int32 *data);
  296.  
  297.     typedef MACPASCAL int32 (*SpaceProc) (void);
  298.  
  299.     typedef MACPASCAL Handle (*NewPIHandleProc) (int32 size);
  300.  
  301.     typedef MACPASCAL void (*DisposePIHandleProc) (Handle h);
  302.     
  303.     typedef MACPASCAL int32 (*GetPIHandleSizeProc) (Handle h);
  304.     
  305.     typedef MACPASCAL OSErr (*SetPIHandleSizeProc) (Handle h, int32 newSize);
  306.  
  307.     typedef MACPASCAL Ptr (*LockPIHandleProc) (Handle h, Boolean moveHigh);
  308.     
  309.     typedef MACPASCAL void (*UnlockPIHandleProc) (Handle h);
  310.  
  311.     typedef MACPASCAL void (*RecoverSpaceProc) (int32 size);
  312.  
  313.     typedef MACPASCAL OSErr (*AllocateBufferProc) (int32 size, BufferID *bufferID);
  314.  
  315.     typedef MACPASCAL Ptr (*LockBufferProc) (BufferID bufferID, Boolean moveHigh);
  316.  
  317.     typedef MACPASCAL void (*UnlockBufferProc) (BufferID bufferID);
  318.  
  319.     typedef MACPASCAL void (*FreeBufferProc) (BufferID bufferID);
  320.     
  321.     typedef MACPASCAL int32 (*BufferSpaceProc) (void);
  322.     
  323.     typedef MACPASCAL int16 (*CountPIResourcesProc) (ResType type);
  324.     
  325.     typedef MACPASCAL Handle (*GetPIResourceProc) (ResType type, int16 index);
  326.     
  327.     typedef MACPASCAL void (*DeletePIResourceProc) (ResType type, int16 index);
  328.     
  329.     typedef MACPASCAL OSErr (*AddPIResourceProc) (ResType type, Handle data);
  330.     
  331.     typedef MACPASCAL void (*ProcessEventProc) (void *event);
  332.     
  333.     typedef MACPASCAL OSErr (*DisplayPixelsProc) (const PSPixelMap *source,
  334.                                                   const VRect *srcRect,
  335.                                                   int32 dstRow,
  336.                                                   int32 dstCol,
  337.                                                   void *platformContext);
  338.                                             
  339.     typedef MACPASCAL OSErr (*AdvanceStateProc) (void);
  340.     
  341.     typedef MACPASCAL OSErr (*GetPropertyProc) (OSType signature,
  342.                                                 OSType key,
  343.                                                 int32 index,
  344.                                                 int32 *simpleProperty,
  345.                                                 Handle *complexProperty);
  346.  
  347.     typedef MACPASCAL OSErr (*ColorServicesProc) (ColorServicesInfo *info);
  348.     
  349. #ifdef __cplusplus
  350.     }
  351. #endif
  352.  
  353. #define kCurrentBufferProcsVersion 2
  354.  
  355. typedef struct BufferProcs
  356.     {
  357.  
  358.     int16 bufferProcsVersion;
  359.     
  360.     int16 numBufferProcs;
  361.  
  362.     AllocateBufferProc allocateProc;
  363.  
  364.     LockBufferProc lockProc;
  365.  
  366.     UnlockBufferProc unlockProc;
  367.  
  368.     FreeBufferProc freeProc;
  369.     
  370.     BufferSpaceProc spaceProc;
  371.  
  372.     }
  373. BufferProcs;
  374.  
  375. #define kCurrentBufferProcsCount \
  376.     ((sizeof(BufferProcs) - offsetof(BufferProcs, allocateProc)) / sizeof(void *)) 
  377.  
  378. #define kCurrentResourceProcsVersion 3
  379.  
  380. typedef struct ResourceProcs
  381.     {
  382.     
  383.     int16 resourceProcsVersion;
  384.     
  385.     int16 numResourceProcs;
  386.     
  387.     CountPIResourcesProc countProc;
  388.     
  389.     GetPIResourceProc getProc;
  390.     
  391.     DeletePIResourceProc deleteProc;
  392.     
  393.     AddPIResourceProc addProc;
  394.     
  395.     }
  396. ResourceProcs;
  397.  
  398. #define kCurrentResourceProcsCount \
  399.     ((sizeof(ResourceProcs) - offsetof(ResourceProcs, countProc)) / sizeof(void *)) 
  400.  
  401. /* Here are the resource types that have been reserved. */
  402.  
  403. #define kDayStarColorMatchingResource 'DCSR'
  404.  
  405.  
  406. #define kCurrentHandleProcsVersion 1
  407.  
  408. typedef struct HandleProcs
  409.     {
  410.     
  411.     int16 handleProcsVersion;
  412.     
  413.     int16 numHandleProcs;
  414.     
  415.     NewPIHandleProc newProc;
  416.     
  417.     DisposePIHandleProc disposeProc;
  418.     
  419.     GetPIHandleSizeProc getSizeProc;
  420.     
  421.     SetPIHandleSizeProc setSizeProc;
  422.     
  423.     LockPIHandleProc lockProc;
  424.     
  425.     UnlockPIHandleProc unlockProc;
  426.     
  427.     RecoverSpaceProc recoverSpaceProc;
  428.     
  429.     }
  430. HandleProcs;
  431.  
  432. #define kCurrentHandleProcsCount \
  433.     ((sizeof(HandleProcs) - offsetof(HandleProcs, newProc)) / sizeof(void *)) 
  434.  
  435. /*********************************************************************************/
  436.  
  437. /* The following constants indicate what sort of padding to use.  Values 0
  438.    through 255 specify a constant value.  Negative values imply special
  439.    operations. */
  440.    
  441. #define plugInWantsEdgeReplication            -1
  442. #define plugInDoesNotWantPadding            -2
  443. #define plugInWantsErrorOnBoundsException    -3
  444.  
  445. /* If the plug-in does not want padding and does not want errors, then
  446.    exterior areas will contain arbitrary values. */
  447.  
  448. /*********************************************************************************/
  449.  
  450. /* The sampling flag indicates the level of sampling support. */
  451.  
  452. #define hostDoesNotSupportSampling        0
  453. #define hostSupportsIntegralSampling    1
  454. #define hostSupportsFractionalSampling    2
  455.  
  456. /*********************************************************************************/
  457.  
  458. /* Layout values for filters and export modules. */
  459.  
  460. #define piLayoutTraditional                0    /* Rows, columns, planes with colbytes = # planes */
  461. #define piLayoutRowsColumnsPlanes        1
  462. #define piLayoutRowsPlanesColumns        2
  463. #define piLayoutColumnsRowsPlanes        3
  464. #define piLayoutColumnsPlanesRows        4
  465. #define piLayoutPlanesRowsColumns        5
  466. #define piLayoutPlanesColumnsRows        6
  467.  
  468. /*********************************************************************************/
  469.  
  470. #if defined(__BORLANDC__)
  471. #pragma option -a.
  472. #endif
  473.  
  474. #endif
  475.  
  476.