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 #if MSWindows
00038 #include "PITypes.h"    // contains FSSpec
00039 #endif
00040 
00041 #include "PIActions.h"
00042 #include "PIGeneral.h"
00043 #include "SPBasic.h"
00044 #include "SPFiles.h"
00045 
00046 /* Operation selectors */
00048 
00049 
00059 #define formatSelectorAbout                 0
00060 
00067 #define formatSelectorReadPrepare           1
00068 
00112 #define formatSelectorReadStart             2
00113 
00126 #define formatSelectorReadContinue          3
00127 
00138 #define formatSelectorReadFinish            4
00139 
00147 #define formatSelectorOptionsPrepare        5
00148 
00158 #define formatSelectorOptionsStart          6
00159 
00167 #define formatSelectorOptionsContinue       7
00168 
00171 #define formatSelectorOptionsFinish         8
00172 
00178 #define formatSelectorEstimatePrepare       9
00179 
00189 #define formatSelectorEstimateStart         10
00190 
00199 #define formatSelectorEstimateContinue      11
00200 
00203 #define formatSelectorEstimateFinish        12
00204 
00212 #define formatSelectorWritePrepare          13
00213 
00255 #define formatSelectorWriteStart            14
00256 
00271 #define formatSelectorWriteContinue         15
00272 
00285 #define formatSelectorWriteFinish           16
00286 
00301 #define formatSelectorFilterFile            17
00302 
00303 #define formatSelectorGetFilePropertyValue  18  
00305 #define formatSelectorLosslessRotate        19  
00307 #define formatSelectorBulkSettings          20  
00309 #define formatSelectorXMPRead               21  
00310 #define formatSelectorXMPWrite              22  
00312 #define formatSelectorBulkOpen              23
00313 
00314 #define formatSelectorLoad                  24
00315 #define formatSelectorUnload                25
00316 
00317 #define formatSelectorPreferences           26
00318 
00319 #define formatSelectorSettingsCopy          27
00320 #define formatSelectorSettingsPaste         28
00321 #define formatSelectorSettingsClear         29
00322 #define formatSelectorSettingsDefault       30
00323 #define formatSelectorSettingsPrevious      31
00324 #define formatSelectorSettingsPresetList    32
00325 #define formatSelectorSettingsChecksum      33
00326 
00327 #define formatSelectorXMPAppend             34
00328 
00329 #define formatSelectorReadLayerStart        35
00330 #define formatSelectorReadLayerContinue     36
00331 #define formatSelectorReadLayerFinish       37
00332 
00333 #define formatSelectorWriteLayerStart       38
00334 #define formatSelectorWriteLayerContinue    39
00335 #define formatSelectorWriteLayerFinish      40
00336  // end ingroup
00339   
00340 // called when the plugin is used to launch an external editor (that Photoshop may not know about)
00341 // fileSpec and fileSpec2 will be the only valid fields in the format record
00342 #define formatSelectorLaunchExternalEditor  41
00343 
00344 /*  We keep various pieces of information about the file format in the PiMI resource.
00345     Here is the structure of that resource. */
00346 
00347 /******************************************************************************/
00348 
00353 
00354 
00355 
00372 #define PIFmtFileTypeProperty           0x666d5443  /* 'fmTC' <TypeCreatorPair> Default file type for file format. */
00373 
00380 #define PIReadTypesProperty             0x52645479  /* 'RdTy' <TypeCreatorPair []> File type info for file format plug-ins */
00381 
00390 #define PIFilteredTypesProperty         0x66667454  /* 'fftT' <TypeCreatorPair []> File types to filter for file format plug-ins */
00391 
00398 #define PIReadExtProperty               0x52644578  
00407 #define PIFilteredExtProperty           0x66667445  /* 'fftE' <OSType []> File types to filter for file format plug-ins */
00408 
00415 #define PIFmtFlagsProperty              0x666d7466  /* 'fmtf' <Set> Format flags */
00416 
00422 #define PIFmtHiddenFlagsProperty        0x666D6869  /* 'fmhi' Hidden read/write flags  */
00423 
00429 #define PIFmtICCFlagsProperty           0x666D6970  /* 'fmip' ICC profile flags. */
00430 
00436 #define PIFmtICCRequiredFlagsProperty   0x666D6972  /* 'fmir' ICC required profile flags.*/
00437 
00445 #define PIFmtMaxSizeProperty            0x6d78737a  /* 'mxsz' <Point> Max rows and cols supported by this format.   */
00446 
00458 #define PIFmtMaxChannelsProperty        0x6d786368  /* 'mxch' <int16 []> Max channels per mode for this format. */
00459 
00464 #define PIFmtFilePropertiesProperty     0x66667073  /* 'ffps' Supports formatSelectorGetFilePropertyValue selector. */
00465 
00470 #define PIFmtLosslessRotateProperty     0x666C6C72  /* 'fllr' Supports formatSelectorLosslessRotate selector. */
00471 
00476 #define PIFmtBulkSettingsProperty       0x66666273  /* 'ffbs' Supports formatSelectorBulkSettings selector.*/
00477 
00482 #define PIFmtPrimaryMetadataProperty    0x6666706d  /* 'ffpm' File format is primary metadata source.*/
00483 
00488 #define PIFmtPrimaryThumbnailProperty   0x66667074  /* 'ffpt' File format is primary thumbnail source. */
00489 
00494 #define PIFmtXMPReadProperty            0x786D7072  /* 'xmpr' Supports formatSelectorXMPRead selector.*/
00495 
00500 #define PIFmtXMPWriteProperty           0x786D7077  /* 'xmpw' Supports formatSelectorXMPWrite selector. */
00501 
00506 #define PIFmtQuickThumbExtractProperty  0x7174686D  /* 'qthm' Supports extractQuickThumbnail field. */
00507 
00512 #define PIFmtBulkOpenProperty           'ffbo'      /* 'ffbo' Supports formatSelectorBulkOpen selector. */
00513 
00518 #define PIFmtRawSettingsProperty        'rscp'      /* 'rscp' Supports settings copy/paste/etc selectors.*/
00519 
00524 #define PIFmtOpenWriteAccessProperty    'fowa'      /* 'fowa' Plug-in prefers write access when opening.*/
00525 
00530 #define PIFmtWarnIfOverriddenProperty   'fwio'      /* 'fwio' Warning if this plug-in is override by another. */
00531 
00536 #define PIFmtResourceThreadSafeProperty 'frts'      /* 'ft' Plug-in is resource fork thread safe. */
00537 
00538 #define PIFmtSupportsLayersProperty     'fmsl'      /* 'fmsl' plug-in supports layers */
00539 
00540 #define PIFmtSupportsLayersReadOnlyProperty 'slRO'  /* 'slRO' plug-in layer support is read-only */
00541 
00548 #define PIFmtSupportsBackgroundSaveProperty 'fbgs'  /* 'fbgs' plug-in supports background save */
00549 
00554 
00555 /******************************************************************************/
00556 
00557 /* properties that can be requested through formatSelectorGetFilePropertyValue */
00558 
00561 #define PIFmtPRotate                0x66726F74  
00562 /******************************************************************************/
00563 
00564 /* property values that should be returned by formatSelectorGetFilePropertyValue */
00565 
00566 #define PIFmtPVNotSupported                 0   
00568 /* values for kFFPRotate */
00569 #define PIFmtPVRotateNo                     2   
00570 #define PIFmtPVRotateIsLossy                3   
00571 #define PIFmtPVRotateIsLossless             4   
00572 #define PIFmtPVRotateIsLosslessWithCallback 5   
00574     /* add values for other format file properties here */
00575 
00576 /******************************************************************************/
00577 
00578 /* Format Hidden Flags Indices. */
00582 
00583 
00584 
00587 #define PIFmtShowReadFlag       0
00588 #define PIFmtShowWriteFlag      1
00589 
00591 
00592 /******************************************************************************/
00593 
00594 /* Format flags indices. */
00599 
00600 
00601 
00608 #define PIFmtReadsAllTypesFlag 0
00609 
00617 #define PIFmtSavesImageResourcesFlag 1
00618 
00622 #define PIFmtCanReadFlag 2
00623 
00627 #define PIFmtCanWriteFlag 3
00628 
00633 #define PIFmtCanWriteIfReadFlag 4
00634 
00641 #define PIFmtCanWriteTransparency 5
00642 
00647 #define PIFmtCanCreateThumbnail 6
00648 
00652 #define PIFmtCanWriteSpotChannel 7
00653 
00656 /******************************************************************************/
00657 
00658 /* Format ICC Profile Flags Indices. */
00661 
00662 
00663 
00666 #define PIFmtICCEmbedGrayFlag       0    
00667 #define PIFmtICCEmbedIndexedFlag    1    
00668 #define PIFmtICCEmbedRGBFlag        2    
00669 #define PIFmtICCEmbedCMYKFlag       3    
00672 
00673 /******************************************************************************/
00674 
00675 /* Required Format ICC Profile Flags Indices. */
00678 
00679 
00680 
00683 #define PIFmtICCRequireGrayFlag         0    
00684 #define PIFmtICCRequireIndexedFlag      1    
00685 #define PIFmtICCRequireRGBFlag          2    
00686 #define PIFmtICCRequireCMYKFlag         3    
00689 
00690 /******************************************************************************/
00691 
00692 /* Bit masks for the browserRotation field */
00695 
00696 
00697 
00700 #define PIFmtBrowserRotationFlipFlag        2   
00701 #define PIFmtBrowserRotationDisableFlag     3   
00702 #define PIFmtBrowserRotationEnableFlag      4   
00705 
00706 /******************************************************************************/
00707 
00708 /* Bit masks for bulkMask and bulkFlags fields */
00711 
00712 
00713 
00716 #define PIFmtBulkOpenMask               1
00717 #define PIFmtBulkInvalPreviewMask       2
00718 #define PIFmtBulkInvalMetaMask          4
00719 #define PIFmtBulkDeleteMask             8
00720 
00722 
00723 /******************************************************************************/
00724 
00725 /* Pragma to byte align structures; for Borland C */
00726 
00727 #if defined(__BORLANDC__)
00728 #pragma option -a-
00729 #endif
00730 
00731 /* Pragma to byte align structures; for Microsoft C */
00732 #if WIN32
00733 #pragma pack(push,1)
00734 #endif
00735 
00736 /******************************************************************************/
00737 
00738 #if PRAGMA_STRUCT_ALIGN
00739 #pragma options align=mac68k
00740 #endif
00741 
00745 typedef struct FormatInfo
00746     {
00747 
00748     PlugInInfo  plugInInfo;             
00749     int16       typeCount;              
00750     int16       extensionCount;         
00751     Boolean     canRead;                
00752     Boolean     readsAllTypes;          
00753     Boolean     canWrite;               
00754     Boolean     canWriteIfRead;         
00755     Boolean     savesImageResources;    
00756     Boolean     padFlag;                
00757     int16       maxChannels [16];       
00758     int16       maxRows;                
00759     int16       maxCols;                
00760     OSType      fileType;               
00761     OSType      creatorType;            
00762     OSType      typeList [1];           
00764     }
00765 FormatInfo;
00766 
00767 /******************************************************************************/
00768 /* turn off the byte align pragma back to its original state; only for Borland C */
00769 #if defined(__BORLANDC__)
00770 #pragma option -a.
00771 #endif
00772 
00773 /* Pragma to turn off align structures for Microsoft C */
00774 #if WIN32
00775 #pragma pack(pop)
00776 #endif
00777 /******************************************************************************/
00778 
00789 
00790 
00791 
00794 #define formatBadParameters     -30500  
00796 #define formatCannotRead        -30501  
00798 #define formatSkipFile          -30502  
00800 #define formatPasswordProtected -30503  
00801 #define formatUnsupportedRaw    -30504  
00803 #define formatUnsupportedDNG    -30505  
00807 
00808 #if WIN32
00809 #pragma pack(push,4)
00810 #endif
00811 
00819 typedef struct FormatRecord
00820     {
00821 
00822     int32               serialNumber;   
00829     TestAbortProc       abortProc;      
00831     ProgressProc        progressProc;   
00833     int32               maxData;        
00841     int32               minDataBytes;   
00845     int32               maxDataBytes;   
00850     int32               minRsrcBytes;   
00853     int32               maxRsrcBytes;   
00857     //64bits - sometimes we put ptr values into these fields. They need to be the right size
00858     intptr_t            dataFork;       
00863     intptr_t            rsrcFork;       
00868 #if __LP64__
00869     FSSpec *            unusedFileSpec; 
00870 #else
00871     FSSpec *            fileSpec;       
00876 #endif
00877 
00878     int16               imageMode;      
00886     Point               imageSize;      
00888     int16               depth;          
00892     int16               planes;         
00904     Fixed               imageHRes;      
00912     Fixed               imageVRes;      
00925     LookUpTable         redLUT;         
00932     LookUpTable         greenLUT;       
00939     LookUpTable         blueLUT;        
00947     void *              data;           
00954     Rect                theRect;        
00956     int16               loPlane;        
00961     int16               hiPlane;        
00966     int16               colBytes;       
00970     int32               rowBytes;       
00972     int32               planeBytes;     
00977     PlaneMap            planeMap;       
00988     Boolean             canTranspose;   
00992     Boolean             needTranspose;  
00997     OSType              hostSig;        
00999     HostProc            hostProc;       
01004     int16               hostModes;      
01010     Handle              revertInfo;     
01034     NewPIHandleProc     hostNewHdl;     
01035     DisposePIHandleProc hostDisposeHdl; 
01037     Handle              imageRsrcData;  
01058     int32               imageRsrcSize;  
01062     PlugInMonitor       monitor;        
01064     void *              platformData;   
01067     BufferProcs *       bufferProcs;    
01072     ResourceProcs *     resourceProcs;  
01076     ProcessEventProc    processEvent;   
01079     DisplayPixelsProc   displayPixels;  
01082     HandleProcs         *handleProcs;   
01086 
01087 
01088     OSType              fileType;       
01090     ColorServicesProc   colorServices;  
01093     AdvanceStateProc    advanceState;   
01102 
01103 
01104     PropertyProcs       *propertyProcs; 
01109     ImageServicesProcs  *imageServicesProcs;
01112     int16               tileWidth;      
01114     int16               tileHeight;     
01117     Point               tileOrigin;     
01119 
01120 
01121     PIDescriptorParameters  *descriptorParameters;  
01122     Str255                  *errorString;           
01127 
01128 
01129     int32               maxValue;       
01130     SPBasicSuite        *sSPBasic;      
01132     void                *plugInRef;     
01134     int32               transparentIndex;   
01137     Handle              iCCprofileData; 
01149     int32               iCCprofileSize;     
01151     int32               canUseICCProfiles; 
01157 
01158 
01159     int32           lutCount;           
01164 
01165 
01166     /* The following fields are only relevant when reading. */
01167     
01168     int32           preferredColorModes;
01174     int32           convertMode;        
01181     VPoint          preferredSize;      
01186     int32           imageIndex;         
01189     int32           transparencyPlane;  
01204     int32           transparencyMatting;
01212 
01213 
01214     ChannelPortProcs *channelPortProcs; 
01216     ReadImageDocumentDesc *documentInfo;
01219     Boolean         openForPreview;     
01224 
01225 
01226     int32           browserRotation;    
01236     int32       HostSupports32BitCoordinates;   
01239     int32       PluginUsing32BitCoordinates;    
01242     VPoint      imageSize32;            
01252     VRect       theRect32;              
01257     uint32      requestedFileProperty;  
01260     uint32      filePropertyValue;      
01263     uint32      fileCount;              
01265     Handle      xmp;                    
01279     int32       supportsSkipFile;       
01284 
01285 
01286     Boolean     extractQuickThumbnail;  
01289     Boolean     hostInSecondaryThread;  
01292     uint32      bulkMask;               
01295     uint32 *    bulkFlags;              
01299     uint32      presetCount;            
01301     Handle      presetNames;            
01304     Handle      presetData;             
01306     uint32      settingsChecksum;       
01308     SPPlatformFileSpecificationW *fileSpec2;    
01311 
01312 
01313     uint32          layerData;          
01322     uint16          *layerName;         
01327     void            *renderRecord;      
01329     Handle *        bulkParams;         
01350     Boolean openAsSmartObject;          
01353 
01354 
01355 
01356     PIDescriptorParameters  *layerMetaData;     
01358     uint16 *finalSpec;                  
01362     Boolean isTextLayer;                
01365     PIDescriptorHandle  *textDescriptor; 
01368     Boolean isGroupDivider;             
01372     Boolean isGroupStart;               
01376     Boolean isVisible;              
01379     Boolean isLocked;               
01382     PIType  blendMode;                  
01384     unsigned8 opacity;                  
01388 
01389 
01390 
01391     char        reserved [18];                  
01394 
01395     }
01396 FormatRecord, *FormatRecordPtr;
01397 
01398 #if WIN32
01399 #pragma pack(pop)
01400 #endif
01401 
01402 #if PRAGMA_STRUCT_ALIGN
01403 #pragma options align=reset
01404 #endif
01405 
01406 #endif  // __PIFormat_h__