PIFormat.h

Go to the documentation of this file.
00001 // ADOBE SYSTEMS INCORPORATED
00002 // Copyright  1993 - 2006 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 "PIActions.h"
00038 #include "PIGeneral.h"
00039 #include "SPBasic.h"
00040 #include "SPFiles.h"
00041 
00042 /* Operation selectors */
00044 
00045 
00055 #define formatSelectorAbout                 0
00056 
00063 #define formatSelectorReadPrepare           1
00064 
00108 #define formatSelectorReadStart             2
00109 
00122 #define formatSelectorReadContinue          3
00123 
00134 #define formatSelectorReadFinish            4
00135 
00143 #define formatSelectorOptionsPrepare        5
00144 
00154 #define formatSelectorOptionsStart          6
00155 
00163 #define formatSelectorOptionsContinue       7
00164 
00167 #define formatSelectorOptionsFinish         8
00168 
00174 #define formatSelectorEstimatePrepare       9
00175 
00185 #define formatSelectorEstimateStart         10
00186 
00195 #define formatSelectorEstimateContinue      11
00196 
00199 #define formatSelectorEstimateFinish        12
00200 
00208 #define formatSelectorWritePrepare          13
00209 
00251 #define formatSelectorWriteStart            14
00252 
00267 #define formatSelectorWriteContinue         15
00268 
00281 #define formatSelectorWriteFinish           16
00282 
00297 #define formatSelectorFilterFile            17
00298 
00299 #define formatSelectorGetFilePropertyValue  18  
00301 #define formatSelectorLosslessRotate        19  
00303 #define formatSelectorBulkSettings          20  
00305 #define formatSelectorXMPRead               21  
00306 #define formatSelectorXMPWrite              22  
00308 #define formatSelectorBulkOpen              23
00309 
00310 #define formatSelectorLoad                  24
00311 #define formatSelectorUnload                25
00312 
00313 #define formatSelectorPreferences           26
00314 
00315 #define formatSelectorSettingsCopy          27
00316 #define formatSelectorSettingsPaste         28
00317 #define formatSelectorSettingsClear         29
00318 #define formatSelectorSettingsDefault       30
00319 #define formatSelectorSettingsPrevious      31
00320 #define formatSelectorSettingsPresetList    32
00321 #define formatSelectorSettingsChecksum      33
00322 
00323 #define formatSelectorXMPAppend             34
00324 
00325 #define formatSelectorReadLayerStart        35
00326 #define formatSelectorReadLayerContinue     36
00327 #define formatSelectorReadLayerFinish       37
00328 
00329 #define formatSelectorWriteLayerStart       38
00330 #define formatSelectorWriteLayerContinue    39
00331 #define formatSelectorWriteLayerFinish      40
00332  // end ingroup
00335   
00336 // called when the plugin is used to launch an external editor (that Photoshop may not know about)
00337 // fileSpec and fileSpec2 will be the only valid fields in the format record
00338 #define formatSelectorLaunchExternalEditor  41
00339 
00340 /*  We keep various pieces of information about the file format in the PiMI resource.
00341     Here is the structure of that resource. */
00342 
00343 /******************************************************************************/
00344 
00349 
00350 
00351 
00368 #define PIFmtFileTypeProperty           0x666d5443  /* 'fmTC' <TypeCreatorPair> Default file type for file format. */
00369 
00376 #define PIReadTypesProperty             0x52645479  /* 'RdTy' <TypeCreatorPair []> File type info for file format plug-ins */
00377 
00386 #define PIFilteredTypesProperty         0x66667454  /* 'fftT' <TypeCreatorPair []> File types to filter for file format plug-ins */
00387 
00394 #define PIReadExtProperty               0x52644578  
00403 #define PIFilteredExtProperty           0x66667445  /* 'fftE' <OSType []> File types to filter for file format plug-ins */
00404 
00411 #define PIFmtFlagsProperty              0x666d7466  /* 'fmtf' <Set> Format flags */
00412 
00418 #define PIFmtHiddenFlagsProperty        0x666D6869  /* 'fmhi' Hidden read/write flags  */
00419 
00425 #define PIFmtICCFlagsProperty           0x666D6970  /* 'fmip' ICC profile flags. */
00426 
00432 #define PIFmtICCRequiredFlagsProperty   0x666D6972  /* 'fmir' ICC required profile flags.*/
00433 
00441 #define PIFmtMaxSizeProperty            0x6d78737a  /* 'mxsz' <Point> Max rows and cols supported by this format.   */
00442 
00454 #define PIFmtMaxChannelsProperty        0x6d786368  /* 'mxch' <int16 []> Max channels per mode for this format. */
00455 
00460 #define PIFmtFilePropertiesProperty     0x66667073  /* 'ffps' Supports formatSelectorGetFilePropertyValue selector. */
00461 
00466 #define PIFmtLosslessRotateProperty     0x666C6C72  /* 'fllr' Supports formatSelectorLosslessRotate selector. */
00467 
00472 #define PIFmtBulkSettingsProperty       0x66666273  /* 'ffbs' Supports formatSelectorBulkSettings selector.*/
00473 
00478 #define PIFmtPrimaryMetadataProperty    0x6666706d  /* 'ffpm' File format is primary metadata source.*/
00479 
00484 #define PIFmtPrimaryThumbnailProperty   0x66667074  /* 'ffpt' File format is primary thumbnail source. */
00485 
00490 #define PIFmtXMPReadProperty            0x786D7072  /* 'xmpr' Supports formatSelectorXMPRead selector.*/
00491 
00496 #define PIFmtXMPWriteProperty           0x786D7077  /* 'xmpw' Supports formatSelectorXMPWrite selector. */
00497 
00502 #define PIFmtQuickThumbExtractProperty  0x7174686D  /* 'qthm' Supports extractQuickThumbnail field. */
00503 
00508 #define PIFmtBulkOpenProperty           'ffbo'      /* 'ffbo' Supports formatSelectorBulkOpen selector. */
00509 
00514 #define PIFmtRawSettingsProperty        'rscp'      /* 'rscp' Supports settings copy/paste/etc selectors.*/
00515 
00520 #define PIFmtOpenWriteAccessProperty    'fowa'      /* 'fowa' Plug-in prefers write access when opening.*/
00521 
00526 #define PIFmtWarnIfOverriddenProperty   'fwio'      /* 'fwio' Warning if this plug-in is override by another. */
00527 
00532 #define PIFmtResourceThreadSafeProperty 'frts'      /* 'ft' Plug-in is resource fork thread safe. */
00533 
00534 #define PIFmtSupportsLayersProperty     'fmsl'      /* 'fmsl' plug-in supports layers */
00535 
00540 
00541 /******************************************************************************/
00542 
00543 /* properties that can be requested through formatSelectorGetFilePropertyValue */
00544 
00547 #define PIFmtPRotate                0x66726F74  
00548 /******************************************************************************/
00549 
00550 /* property values that should be returned by formatSelectorGetFilePropertyValue */
00551 
00552 #define PIFmtPVNotSupported                 0   
00554 /* values for kFFPRotate */
00555 #define PIFmtPVRotateNo                     2   
00556 #define PIFmtPVRotateIsLossy                3   
00557 #define PIFmtPVRotateIsLossless             4   
00558 #define PIFmtPVRotateIsLosslessWithCallback 5   
00560     /* add values for other format file properties here */
00561 
00562 /******************************************************************************/
00563 
00564 /* Format Hidden Flags Indices. */
00568 
00569 
00570 
00573 #define PIFmtShowReadFlag       0
00574 #define PIFmtShowWriteFlag      1
00575 
00577 
00578 /******************************************************************************/
00579 
00580 /* Format flags indices. */
00585 
00586 
00587 
00594 #define PIFmtReadsAllTypesFlag 0
00595 
00603 #define PIFmtSavesImageResourcesFlag 1
00604 
00608 #define PIFmtCanReadFlag 2
00609 
00613 #define PIFmtCanWriteFlag 3
00614 
00619 #define PIFmtCanWriteIfReadFlag 4
00620 
00627 #define PIFmtCanWriteTransparency 5
00628 
00633 #define PIFmtCanCreateThumbnail 6
00634 
00638 #define PIFmtCanWriteSpotChannel 7
00639 
00642 /******************************************************************************/
00643 
00644 /* Format ICC Profile Flags Indices. */
00647 
00648 
00649 
00652 #define PIFmtICCEmbedGrayFlag       0    
00653 #define PIFmtICCEmbedIndexedFlag    1    
00654 #define PIFmtICCEmbedRGBFlag        2    
00655 #define PIFmtICCEmbedCMYKFlag       3    
00658 
00659 /******************************************************************************/
00660 
00661 /* Required Format ICC Profile Flags Indices. */
00664 
00665 
00666 
00669 #define PIFmtICCRequireGrayFlag         0    
00670 #define PIFmtICCRequireIndexedFlag      1    
00671 #define PIFmtICCRequireRGBFlag          2    
00672 #define PIFmtICCRequireCMYKFlag         3    
00675 
00676 /******************************************************************************/
00677 
00678 /* Bit masks for the browserRotation field */
00681 
00682 
00683 
00686 #define PIFmtBrowserRotationFlipFlag        2   
00687 #define PIFmtBrowserRotationDisableFlag     3   
00688 #define PIFmtBrowserRotationEnableFlag      4   
00691 
00692 /******************************************************************************/
00693 
00694 /* Bit masks for bulkMask and bulkFlags fields */
00697 
00698 
00699 
00702 #define PIFmtBulkOpenMask               1
00703 #define PIFmtBulkInvalPreviewMask       2
00704 #define PIFmtBulkInvalMetaMask          4
00705 #define PIFmtBulkDeleteMask             8
00706 
00708 
00709 
00710 /******************************************************************************/
00711 
00712 /* Pragma to byte align structures; for Borland C */
00713 
00714 #if defined(__BORLANDC__)
00715 #pragma option -a-
00716 #endif
00717 
00718 /* Pragma to byte align structures; for Microsoft C */
00719 #if WIN32
00720 #pragma pack(push,1)
00721 #endif
00722 
00723 /******************************************************************************/
00724 
00725 #if PRAGMA_STRUCT_ALIGN
00726 #pragma options align=mac68k
00727 #endif
00728 
00732 typedef struct FormatInfo
00733     {
00734 
00735     PlugInInfo  plugInInfo;             
00736     int16       typeCount;              
00737     int16       extensionCount;         
00738     Boolean     canRead;                
00739     Boolean     readsAllTypes;          
00740     Boolean     canWrite;               
00741     Boolean     canWriteIfRead;         
00742     Boolean     savesImageResources;    
00743     Boolean     padFlag;                
00744     int16       maxChannels [16];       
00745     int16       maxRows;                
00746     int16       maxCols;                
00747     OSType      fileType;               
00748     OSType      creatorType;            
00749     OSType      typeList [1];           
00751     }
00752 FormatInfo;
00753 
00754 /******************************************************************************/
00755 /* turn off the byte align pragma back to its original state; only for Borland C */
00756 #if defined(__BORLANDC__)
00757 #pragma option -a.
00758 #endif
00759 
00760 /* Pragma to turn off align structures for Microsoft C */
00761 #if WIN32
00762 #pragma pack(pop)
00763 #endif
00764 /******************************************************************************/
00765 
00776 
00777 
00778 
00781 #define formatBadParameters     -30500  
00783 #define formatCannotRead        -30501  
00785 #define formatSkipFile          -30502  
00787 #define formatPasswordProtected -30503  
00790 
00791 #if WIN32
00792 #pragma pack(push,4)
00793 #endif
00794 
00802 typedef struct FormatRecord
00803     {
00804 
00805     int32               serialNumber;   
00812     TestAbortProc       abortProc;      
00814     ProgressProc        progressProc;   
00816     int32               maxData;        
00824     int32               minDataBytes;   
00828     int32               maxDataBytes;   
00833     int32               minRsrcBytes;   
00836     int32               maxRsrcBytes;   
00840     //64bits - sometimes we put ptr values into these fields. They need to be the right size
00841     intptr_t            dataFork;       
00846     intptr_t            rsrcFork;       
00852     FSSpec *            fileSpec;       
00856     int16               imageMode;      
00864     Point               imageSize;      
00866     int16               depth;          
00870     int16               planes;         
00882     Fixed               imageHRes;      
00890     Fixed               imageVRes;      
00903     LookUpTable         redLUT;         
00910     LookUpTable         greenLUT;       
00917     LookUpTable         blueLUT;        
00925     void *              data;           
00932     Rect                theRect;        
00934     int16               loPlane;        
00939     int16               hiPlane;        
00944     int16               colBytes;       
00948     int32               rowBytes;       
00950     int32               planeBytes;     
00955     PlaneMap            planeMap;       
00966     Boolean             canTranspose;   
00970     Boolean             needTranspose;  
00975     OSType              hostSig;        
00977     HostProc            hostProc;       
00982     int16               hostModes;      
00988     Handle              revertInfo;     
01012     NewPIHandleProc     hostNewHdl;     
01013     DisposePIHandleProc hostDisposeHdl; 
01015     Handle              imageRsrcData;  
01036     int32               imageRsrcSize;  
01040     PlugInMonitor       monitor;        
01042     void *              platformData;   
01045     BufferProcs *       bufferProcs;    
01050     ResourceProcs *     resourceProcs;  
01054     ProcessEventProc    processEvent;   
01057     DisplayPixelsProc   displayPixels;  
01060     HandleProcs         *handleProcs;   
01064 
01065 
01066     OSType              fileType;       
01068     ColorServicesProc   colorServices;  
01071     AdvanceStateProc    advanceState;   
01080 
01081 
01082     PropertyProcs       *propertyProcs; 
01087     ImageServicesProcs  *imageServicesProcs;
01090     int16               tileWidth;      
01092     int16               tileHeight;     
01095     Point               tileOrigin;     
01097 
01098 
01099     PIDescriptorParameters  *descriptorParameters;  
01100     Str255                  *errorString;           
01105 
01106 
01107     int32               maxValue;       
01108     SPBasicSuite        *sSPBasic;      
01110     void                *plugInRef;     
01112     int32               transparentIndex;   
01115     Handle              iCCprofileData; 
01127     int32               iCCprofileSize;     
01129     int32               canUseICCProfiles; 
01135 
01136 
01137     int32           lutCount;           
01142 
01143 
01144     /* The following fields are only relevant when reading. */
01145     
01146     int32           preferredColorModes;
01152     int32           convertMode;        
01159     VPoint          preferredSize;      
01164     int32           imageIndex;         
01167     int32           transparencyPlane;  
01182     int32           transparencyMatting;
01190 
01191 
01192     ChannelPortProcs *channelPortProcs; 
01194     ReadImageDocumentDesc *documentInfo;
01197     Boolean         openForPreview;     
01202 
01203 
01204     int32           browserRotation;    
01214     int32       HostSupports32BitCoordinates;   
01217     int32       PluginUsing32BitCoordinates;    
01220     VPoint      imageSize32;            
01230     VRect       theRect32;              
01235     uint32      requestedFileProperty;  
01238     uint32      filePropertyValue;      
01241     uint32      fileCount;              
01243     Handle      xmp;                    
01257     int32       supportsSkipFile;       
01262 
01263 
01264     Boolean     extractQuickThumbnail;  
01267     Boolean     hostInSecondaryThread;  
01270     uint32      bulkMask;               
01273     uint32 *    bulkFlags;              
01277     uint32      presetCount;            
01279     Handle      presetNames;            
01282     Handle      presetData;             
01284     uint32      settingsChecksum;       
01286     SPPlatformFileSpecificationW *fileSpec2;    
01289 
01290 
01291     uint32          layerData;          
01300     uint16          *layerName;         
01305     void            *renderRecord;      
01307     Handle *        bulkParams;         
01328     Boolean openAsSmartObject;          
01331 
01332 
01333 
01334     PIDescriptorParameters  *layerMetaData;     
01336     uint16 *finalSpec;                  
01340     Boolean isTextLayer;                
01343     PIDescriptorHandle  *textDescriptor; 
01346     Boolean isGroupDivider;             
01350     Boolean isGroupStart;               
01354     Boolean isVisible;              
01357     Boolean isLocked;               
01360     PIType  blendMode;                  
01362     unsigned8 opacity;                  
01366 
01367 
01368 
01369     char        reserved [18];                  
01372 
01373     }
01374 FormatRecord, *FormatRecordPtr;
01375 
01376 #if WIN32
01377 #pragma pack(pop)
01378 #endif
01379 
01380 #if PRAGMA_STRUCT_ALIGN
01381 #pragma options align=reset
01382 #endif
01383 
01384 #endif  // __PIFormat_h__