PIFormat.h
Go to the documentation of this file.
00001 // ADOBE SYSTEMS INCORPORATED
00002 // Copyright  1993 - 2014 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 //-------------------------------------------------------------------
00030 #ifndef __PIFormat__
00031 #define __PIFormat__
00032 
00033 #if PRAGMA_ONCE
00034 #pragma once
00035 #endif
00036 
00037 #include <stdio.h>
00038 
00039 #if MSWindows
00040 #ifndef __PSWorld__
00041 #include "PITypes.h"    // contains FSSpec
00042 #else
00043 #include <Files.h>      // contains betterer FSSpec
00044 #endif
00045 #endif
00046 
00047 #include "PIActions.h"
00048 #include "PIGeneral.h"
00049 #include "SPBasic.h"
00050 #include "SPFiles.h"
00051 
00052 /* Operation selectors */
00054 
00055 
00065 #define formatSelectorAbout                 0
00066 
00073 #define formatSelectorReadPrepare           1
00074 
00118 #define formatSelectorReadStart             2
00119 
00132 #define formatSelectorReadContinue          3
00133 
00144 #define formatSelectorReadFinish            4
00145 
00153 #define formatSelectorOptionsPrepare        5
00154 
00164 #define formatSelectorOptionsStart          6
00165 
00173 #define formatSelectorOptionsContinue       7
00174 
00177 #define formatSelectorOptionsFinish         8
00178 
00184 #define formatSelectorEstimatePrepare       9
00185 
00195 #define formatSelectorEstimateStart         10
00196 
00205 #define formatSelectorEstimateContinue      11
00206 
00209 #define formatSelectorEstimateFinish        12
00210 
00218 #define formatSelectorWritePrepare          13
00219 
00261 #define formatSelectorWriteStart            14
00262 
00277 #define formatSelectorWriteContinue         15
00278 
00291 #define formatSelectorWriteFinish           16
00292 
00307 #define formatSelectorFilterFile            17
00308 
00309 #define formatSelectorGetFilePropertyValue  18  
00311 #define formatSelectorLosslessRotate        19  
00313 #define formatSelectorBulkSettings          20  
00315 #define formatSelectorXMPRead               21  
00316 #define formatSelectorXMPWrite              22  
00318 #define formatSelectorBulkOpen              23
00319 
00320 #define formatSelectorLoad                  24
00321 #define formatSelectorUnload                25
00322 
00323 #define formatSelectorPreferences           26
00324 
00325 #define formatSelectorSettingsCopy          27
00326 #define formatSelectorSettingsPaste         28
00327 #define formatSelectorSettingsClear         29
00328 #define formatSelectorSettingsDefault       30
00329 #define formatSelectorSettingsPrevious      31
00330 #define formatSelectorSettingsPresetList    32
00331 #define formatSelectorSettingsChecksum      33
00332 
00333 #define formatSelectorXMPAppend             34
00334 
00335 #define formatSelectorReadLayerStart        35
00336 #define formatSelectorReadLayerContinue     36
00337 #define formatSelectorReadLayerFinish       37
00338 
00339 #define formatSelectorWriteLayerStart       38
00340 #define formatSelectorWriteLayerContinue    39
00341 #define formatSelectorWriteLayerFinish      40
00342  // end ingroup
00345   
00346 // called when the plugin is used to launch an external editor (that Photoshop may not know about)
00347 // fileSpec and fileSpec2 will be the only valid fields in the format record
00348 #define formatSelectorLaunchExternalEditor  41
00349 
00350 /*  We keep various pieces of information about the file format in the PiMI resource.
00351     Here is the structure of that resource. */
00352 
00353 /******************************************************************************/
00354 
00359 
00360 
00361 
00378 #define PIFmtFileTypeProperty           0x666d5443  /* 'fmTC' <TypeCreatorPair> Default file type for file format. */
00379 
00386 #define PIReadTypesProperty             0x52645479  /* 'RdTy' <TypeCreatorPair []> File type info for file format plug-ins */
00387 
00396 #define PIFilteredTypesProperty         0x66667454  /* 'fftT' <TypeCreatorPair []> File types to filter for file format plug-ins */
00397 
00404 #define PIReadExtProperty               0x52644578  
00413 #define PIFilteredExtProperty           0x66667445  /* 'fftE' <OSType []> File types to filter for file format plug-ins */
00414 
00421 #define PIFmtFlagsProperty              0x666d7466  /* 'fmtf' <Set> Format flags */
00422 
00428 #define PIFmtHiddenFlagsProperty        0x666D6869  /* 'fmhi' Hidden read/write flags  */
00429 
00435 #define PIFmtICCFlagsProperty           0x666D6970  /* 'fmip' ICC profile flags. */
00436 
00442 #define PIFmtICCRequiredFlagsProperty   0x666D6972  /* 'fmir' ICC required profile flags.*/
00443 
00451 #define PIFmtMaxSizeProperty            0x6d78737a  /* 'mxsz' <Point> Max rows and cols supported by this format.   */
00452 
00464 #define PIFmtMaxChannelsProperty        0x6d786368  /* 'mxch' <int16 []> Max channels per mode for this format. */
00465 
00470 #define PIFmtFilePropertiesProperty     0x66667073  /* 'ffps' Supports formatSelectorGetFilePropertyValue selector. */
00471 
00476 #define PIFmtLosslessRotateProperty     0x666C6C72  /* 'fllr' Supports formatSelectorLosslessRotate selector. */
00477 
00482 #define PIFmtBulkSettingsProperty       0x66666273  /* 'ffbs' Supports formatSelectorBulkSettings selector.*/
00483 
00488 #define PIFmtPrimaryMetadataProperty    0x6666706d  /* 'ffpm' File format is primary metadata source.*/
00489 
00494 #define PIFmtPrimaryThumbnailProperty   0x66667074  /* 'ffpt' File format is primary thumbnail source. */
00495 
00500 #define PIFmtXMPReadProperty            0x786D7072  /* 'xmpr' Supports formatSelectorXMPRead selector.*/
00501 
00506 #define PIFmtXMPWriteProperty           0x786D7077  /* 'xmpw' Supports formatSelectorXMPWrite selector. */
00507 
00512 #define PIFmtQuickThumbExtractProperty  0x7174686D  /* 'qthm' Supports extractQuickThumbnail field. */
00513 
00518 #define PIFmtBulkOpenProperty           'ffbo'      /* 'ffbo' Supports formatSelectorBulkOpen selector. */
00519 
00524 #define PIFmtRawSettingsProperty        'rscp'      /* 'rscp' Supports settings copy/paste/etc selectors.*/
00525 
00530 #define PIFmtOpenWriteAccessProperty    'fowa'      /* 'fowa' Plug-in prefers write access when opening.*/
00531 
00536 #define PIFmtWarnIfOverriddenProperty   'fwio'      /* 'fwio' Warning if this plug-in is override by another. */
00537 
00542 #define PIFmtResourceThreadSafeProperty 'frts'      /* 'ft' Plug-in is resource fork thread safe. */
00543 
00544 #define PIFmtSupportsLayersProperty     'fmsl'      /* 'fmsl' plug-in supports layers */
00545 
00546 #define PIFmtSupportsLayersReadOnlyProperty 'slRO'  /* 'slRO' plug-in layer support is read-only */
00547 
00554 #define PIFmtSupportsBackgroundSaveProperty 'fbgs'  /* 'fbgs' plug-in supports background save */
00555 
00562 #define PIFmtSupportsPOSIXIOProperty 'fxio'     /* 'fxio' plug-in supports POSIX API for read and write */
00563 
00572 #define PIFmtFileSizeLimitProperty          0x66736c6d  /* 'fslm' <int32 > Max size on disk your format can read and write. In gigabytes. */
00573 
00578 #define PIFmtSupportsPluginOpeningFile 'fpof'   /* 'fpof' plug-in supports open and closing files for itself. */
00579 
00584 
00585 /******************************************************************************/
00586 
00587 /* properties that can be requested through formatSelectorGetFilePropertyValue */
00588 
00591 #define PIFmtPRotate                0x66726F74  
00592 /******************************************************************************/
00593 
00594 /* property values that should be returned by formatSelectorGetFilePropertyValue */
00595 
00596 #define PIFmtPVNotSupported                 0   
00598 /* values for kFFPRotate */
00599 #define PIFmtPVRotateNo                     2   
00600 #define PIFmtPVRotateIsLossy                3   
00601 #define PIFmtPVRotateIsLossless             4   
00602 #define PIFmtPVRotateIsLosslessWithCallback 5   
00604     /* add values for other format file properties here */
00605 
00606 /******************************************************************************/
00607 
00608 /* Format Hidden Flags Indices. */
00612 
00613 
00614 
00617 #define PIFmtShowReadFlag       0
00618 #define PIFmtShowWriteFlag      1
00619 
00621 
00622 /******************************************************************************/
00623 
00624 /* Format flags indices. */
00629 
00630 
00631 
00638 #define PIFmtReadsAllTypesFlag 0
00639 
00648 #define PIFmtSavesImageResourcesFlag 1
00649 
00653 #define PIFmtCanReadFlag 2
00654 
00658 #define PIFmtCanWriteFlag 3
00659 
00664 #define PIFmtCanWriteIfReadFlag 4
00665 
00672 #define PIFmtCanWriteTransparency 5
00673 
00678 #define PIFmtCanCreateThumbnail 6
00679 
00683 #define PIFmtCanWriteSpotChannel 7
00684 
00687 /******************************************************************************/
00688 
00689 /* Format ICC Profile Flags Indices. */
00692 
00693 
00694 
00697 #define PIFmtICCEmbedGrayFlag       0    
00698 #define PIFmtICCEmbedIndexedFlag    1    
00699 #define PIFmtICCEmbedRGBFlag        2    
00700 #define PIFmtICCEmbedCMYKFlag       3    
00703 
00704 /******************************************************************************/
00705 
00706 /* Required Format ICC Profile Flags Indices. */
00709 
00710 
00711 
00714 #define PIFmtICCRequireGrayFlag         0    
00715 #define PIFmtICCRequireIndexedFlag      1    
00716 #define PIFmtICCRequireRGBFlag          2    
00717 #define PIFmtICCRequireCMYKFlag         3    
00720 
00721 /******************************************************************************/
00722 
00723 /* Bit masks for the browserRotation field */
00726 
00727 
00728 
00731 #define PIFmtBrowserRotationFlipFlag        2   
00732 #define PIFmtBrowserRotationDisableFlag     3   
00733 #define PIFmtBrowserRotationEnableFlag      4   
00736 
00737 /******************************************************************************/
00738 
00739 /* Bit masks for bulkMask and bulkFlags fields */
00742 
00743 
00744 
00747 #define PIFmtBulkOpenMask               1
00748 #define PIFmtBulkInvalPreviewMask       2
00749 #define PIFmtBulkInvalMetaMask          4
00750 #define PIFmtBulkDeleteMask             8
00751 #define PIFmtBulkModifyListMask        16
00752 
00754 
00755 /******************************************************************************/
00756 
00757 /* Pragma to byte align structures; for Microsoft C */
00758 #if WIN32
00759 #pragma pack(push,1)
00760 #endif
00761 
00762 /******************************************************************************/
00763 
00764 #if PRAGMA_STRUCT_ALIGN
00765 #pragma options align=mac68k
00766 #endif
00767 
00771 typedef struct FormatInfo
00772     {
00773 
00774     PlugInInfo  plugInInfo;             
00775     int16       typeCount;              
00776     int16       extensionCount;         
00777     Boolean     canRead;                
00778     Boolean     readsAllTypes;          
00779     Boolean     canWrite;               
00780     Boolean     canWriteIfRead;         
00781     Boolean     savesImageResources;    
00782     Boolean     padFlag;                
00783     int16       maxChannels [16];       
00784     int16       maxRows;                
00785     int16       maxCols;                
00786     OSType      fileType;               
00787     OSType      creatorType;            
00788     OSType      typeList [1];           
00790     }
00791 FormatInfo;
00792 
00793 /* Pragma to turn off align structures for Microsoft C */
00794 #if WIN32
00795 #pragma pack(pop)
00796 #endif
00797 /******************************************************************************/
00798 
00809 
00810 
00811 
00814 #define formatBadParameters     -30500  
00816 #define formatCannotRead        -30501  
00818 #define formatSkipFile          -30502  
00820 #define formatPasswordProtected -30503  
00821 #define formatUnsupportedRaw    -30504  
00823 #define formatUnsupportedDNG    -30505  
00827 
00828 #if WIN32
00829 #pragma pack(push,4)
00830 #endif
00831 
00839 typedef struct FormatRecord
00840     {
00841 
00842     int32               serialNumber;   
00849     TestAbortProc       abortProc;      
00851     ProgressProc        progressProc;   
00853     int32               maxData;        
00861     int32               minDataBytes;   
00865     int32               maxDataBytes;   
00870     int32               minRsrcBytes;   
00873     int32               maxRsrcBytes;   
00877     intptr_t            dataFork;       
00883     intptr_t            rsrcFork;       
00888 #if __LP64__
00889     FSSpec *            unusedFileSpec; 
00890 #else
00891     FSSpec *            fileSpec;       
00896 #endif
00897 
00898     int16               imageMode;      
00906     Point               imageSize;      
00908     int16               depth;          
00912     int16               planes;         
00924     Fixed               imageHRes;      
00932     Fixed               imageVRes;      
00945     LookUpTable         redLUT;         
00952     LookUpTable         greenLUT;       
00959     LookUpTable         blueLUT;        
00967     void *              data;           
00974     Rect                theRect;        
00976     int16               loPlane;        
00981     int16               hiPlane;        
00986     int16               colBytes;       
00990     int32               rowBytes;       
00992     int32               planeBytes;     
00997     PlaneMap            planeMap;       
01008     Boolean             canTranspose;   
01012     Boolean             needTranspose;  
01017     OSType              hostSig;        
01019     HostProc            hostProc;       
01024     int16               hostModes;      
01030     Handle              revertInfo;     
01054     NewPIHandleProc     hostNewHdl;     
01055     DisposePIHandleProc hostDisposeHdl; 
01057     Handle              imageRsrcData;  
01078     int32               imageRsrcSize;  
01082     PlugInMonitor       monitor;        
01084     void *              platformData;   
01087     BufferProcs *       bufferProcs;    
01092     ResourceProcs *     resourceProcs;  
01096     ProcessEventProc    processEvent;   
01099     DisplayPixelsProc   displayPixels;  
01102     HandleProcs         *handleProcs;   
01106     // New in 3.0
01107 
01108     OSType              fileType;       
01110     ColorServicesProc   colorServices;  
01113     AdvanceStateProc    advanceState;   
01122     // New in 3.0.4
01123 
01124     PropertyProcs       *propertyProcs; 
01129     ImageServicesProcs  *imageServicesProcs;
01132     int16               tileWidth;      
01134     int16               tileHeight;     
01137     Point               tileOrigin;     
01139     // New in 4.0 
01140 
01141     PIDescriptorParameters  *descriptorParameters;  
01142     Str255                  *errorString;           
01147     // New in 5.0 
01148 
01149     int32               maxValue;       
01150     SPBasicSuite        *sSPBasic;      
01152     void                *plugInRef;     
01154     int32               transparentIndex;   
01157     Handle              iCCprofileData; 
01169     int32               iCCprofileSize;     
01171     int32               canUseICCProfiles; 
01176     // New in 5.5 
01177 
01178     int32           lutCount;           
01183     // New in 6.0 
01184 
01185     /* The following fields are only relevant when reading. */
01186     
01187     int32           preferredColorModes;
01193     int32           convertMode;        
01200     VPoint          preferredSize;      
01205     int32           imageIndex;         
01208     int32           transparencyPlane;  
01223     int32           transparencyMatting;
01231     // New in 7.0 
01232 
01233     ChannelPortProcs *channelPortProcs; 
01235     ReadImageDocumentDesc *documentInfo;
01238     Boolean         openForPreview;     
01242     // New in 8.0 
01243 
01244     int32           browserRotation;    
01254     int32       HostSupports32BitCoordinates;   
01257     int32       PluginUsing32BitCoordinates;    
01260     VPoint      imageSize32;            
01270     VRect       theRect32;              
01275     uint32      requestedFileProperty;  
01278     uint32      filePropertyValue;      
01281     uint32      fileCount;              
01286     Handle      xmp;                    
01300     int32       supportsSkipFile;       
01304     // New in 9.0 
01305 
01306     Boolean     extractQuickThumbnail;  
01309     Boolean     hostInSecondaryThread;  
01312     uint32      bulkMask;               
01315     uint32 *    bulkFlags;              
01319     uint32      presetCount;            
01321     Handle      presetNames;            
01324     Handle      presetData;             
01326     uint32      settingsChecksum;       
01328     SPPlatformFileSpecificationW *fileSpec2;    
01330     // New in 10.0 
01331 
01332     uint32          layerData;          
01341     uint16          *layerName;         
01346     void            *renderRecord;      
01348     Handle *        bulkParams;         
01369     Boolean openAsSmartObject;          
01371     // New in 11.0 
01372 
01373     PIDescriptorParameters  *layerMetaData;     
01375     uint16 *finalSpec;                  
01379     Boolean isTextLayer;                
01382     PIDescriptorHandle  *textDescriptor; 
01385     Boolean isGroupDivider;             
01389     Boolean isGroupStart;               
01393     Boolean isVisible;              
01396     Boolean isLocked;               
01399     PIType  blendMode;                  
01401     unsigned8 opacity;                  
01403     // New in 15.0
01404 
01405     Handle bulkExtraData;               
01408     // New in 17.0
01409 
01410     XPlatFileSpec*  fileSpecX;          
01413     // New in 20.0
01414 
01415     int16       hostSupportsPOSIXIO;    
01417     int16       pluginUsingPOSIXIO;     
01420     int32       posixFileDescriptor;    
01423     // New in 21.0
01424 
01425     Boolean      hostSupportsPluginOpeningFile;         
01429     Boolean      hostSupportsSingleOpenToBulkSwitch;    
01433     Boolean      pluginWantsSingleOpenToBulkSwitch;     
01437 
01438 
01439 
01440     char        reserved [50];                  
01443 
01444     }
01445 FormatRecord, *FormatRecordPtr;
01446 
01447 #if WIN32
01448 #pragma pack(pop)
01449 #endif
01450 
01451 #if PRAGMA_STRUCT_ALIGN
01452 #pragma options align=reset
01453 #endif
01454 
01455 #endif  // __PIFormat_h__