### Acquire Get File List Suite Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/group___pica_get_file_list_suite Example of acquiring the version 6 suite using the SPBasic suite pointer. ```C PSGetFileListSuite6 *sPSGetFileList; // Use most recent version. error = sSPBasic->AcquireSuite(kPSGetFileListSuite, kPSGetFileListSuiteVersion6, &sPSGetFileList); if (error) goto . . . //handle error ``` -------------------------------- ### Acquire Window Notify Suite Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/group___pica_window_notify_suite Example of how to acquire the suite using the SPBasic suite pointer. ```C PSWindowNotifyProcs *sPSWindowNofify; error = sSPBasic->AcquireSuite(kPSWindowNotifySuite, kPSWindowNotifySuiteVersion, &sPSWindowNofify); if (error) goto . . . //handle error ``` -------------------------------- ### Acquire Buffer Suite Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/group___pica_buffer_suite Example of acquiring the Buffer Suite using the SPBasic suite pointer. ```c PSBufferSuite1 *sPSBuffer; error = sSPBasic->AcquireSuite(kPSBufferSuite, kPSBufferSuiteVersion1, &sPSBuffer); if (error) goto . . . //handle error ``` -------------------------------- ### Acquire Progress Suite Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/group___pica_progress_suite Example of acquiring the Progress Suite using the SPBasic suite pointer. ```c PSProgressSuite1 *sPSProgress; error = sSPBasic->AcquireSuite(kPSProgressSuite, kPSProgressSuiteVersion2, &sPSProgress); if (error) goto . . . //handle error ``` -------------------------------- ### Acquire UI Hooks Suite Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/group___pica_u_i_hooks_suite Example demonstrating how to acquire the third version of the UI Hooks suite using the SPBasic suite. ```c PSUIHooksSuite3 *sPSUIHooks; // Get the most recent version. error = sSPBasic->AcquireSuite(kPSUIHooksSuite, kPSUIHooksSuiteVersion3, &sPSUIHooks); if (error) goto . . . //handle error ``` -------------------------------- ### Acquire Handle Suite Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/group___pica_handle_suite Example of acquiring the version 2 Handle Suite using the SPBasic suite. ```c PSHandleSuite2 *sPSHandle; // Acquire the most recent version. error = sSPBasic->AcquireSuite(kPSHandleSuite, kPSHandleSuiteVersion2, &sPSHandle); if (error) goto . . . //handle error ``` -------------------------------- ### Acquire Color Space Suite Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/group___pica_color_space_suite Example of how to acquire the Color Space suite using the SPBasic suite pointer. ```c PSColorSpaceSuite1 *sPSColorSpace; error = sSPBasic->AcquireSuite(kPSColorSpaceSuite, kPSColorSpaceSuiteVersion1, &sPSColorSpace); if (error) goto . . . //handle error ``` -------------------------------- ### Dissolve Plug-in Bundle Directory Layout Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/index.html Example directory structure for a bundled plug-in on macOS. ```text Dissolve.plugin/Contents/MacOS/Dissolve Dissolve.plugin/Contents/Info.plist Dissolve.plugin/Contents/PkgInfo Dissolve.plugin/Contents/Resources/Dissolve.rsrc ``` -------------------------------- ### Acquire the Error Suite Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/group___pica_error_suite Example of how to acquire the PSErrorSuite1 interface using the SPBasic suite. ```cpp PSErrorSuite1 *sPSErrors; error = sSPBasic->AcquireSuite(kPSErrorSuite, kPSErrorSuiteVersion1, &sPSErrors); if (error) goto . . . //handle error ``` -------------------------------- ### Acquire Channel Ports Suite Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/group___pica_channel_ports_suite Example of acquiring version 3 of the Channel Ports Suite using the SPBasic suite. ```c PSChannelPortsSuite1 *sPSChannelPorts; // Acquiring version 3. error = sSPBasic->AcquireSuite(kPSChannelPortsSuite, kPSChannelPortsSuiteVersion3, &sPSChannelPorts); if (error) goto . . . //handle error ``` -------------------------------- ### Define Suite Versions Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/group___pica_get_file_list_suite Constants representing the available versions of the Get File List Suite. ```C #define kPSGetFileListSuiteVersion1 1 #define kPSGetFileListSuiteVersion2 2 #define kPSGetFileListSuiteVersion3 3 #define kPSGetFileListSuiteVersion4 4 #define kPSGetFileListSuiteVersion5 5 #define kPSGetFileListSuiteVersion6 6 ``` -------------------------------- ### Property Suite Procedure Definitions Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/_p_i_general_8h_source.html Function pointers for getting and setting plug-in properties using signatures and keys. ```C typedef MACPASCAL OSErr (*GetPropertyProc) (PIType signature, PIType key, int32 index, intptr_t *simpleProperty, Handle *complexProperty); ``` ```C typedef MACPASCAL OSErr (*SetPropertyProc) (PIType signature, PIType key, int32 index, intptr_t simpleProperty, Handle complexProperty); ``` -------------------------------- ### Acquire the Get Path Suite Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/group___pica_get_path_suite Standard pattern for acquiring the suite pointer using the SPBasic suite. ```c PSGetPathSuite1 *sPSGetPath; error = sSPBasic->AcquireSuite(kPSGetPathSuite, kPSGetPathSuiteVersion1, &sPSGetPath); if (error) goto . . . //handle error ``` -------------------------------- ### Accessing Property Suite and Getting a Property Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/group___property_suite Retrieves the Property Suite pointer from the parameter block and demonstrates fetching a simple property value. ```C PropertyProcs *propSuite; DLLExport MACPASCAL void PluginMain (const int16 selector, ExportRecordPtr exportParamBlock, intptr_t* data, int16* result) { ... // Get the Property Suite from the parameter block propSuite = exportParamBlock->propertyProcs; // Get the value for the simple property propNumberOfPaths from Photoshop, // return value goes in count. int32 *count; propSuite->getPropertyProc('8BIM', propNumberOfPaths, 0, count, nil); ... } ``` -------------------------------- ### Acquire Action Control Suite Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/group___pica_action_control_suite Demonstrates how to acquire the suite using the SPBasic suite pointer. ```C PSActionControlProcs *sPSActionControl; error = sSPBasic->AcquireSuite(kPSActionControlSuite, kPSActionControlSuiteVersion, &sPSActionControl); if (error) goto . . . //handle error ``` -------------------------------- ### Define Get Path Suite Constants Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/group___pica_get_path_suite Identifiers and version constants used to reference the Get Path suite. ```c #define kPSGetPathSuite "Photoshop GetPath Suite for Plug-ins" ``` ```c #define kPSGetPathSuiteVersion1 1 ``` -------------------------------- ### Get Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/struct_p_s_descriptor_registry_procs Returns a descriptor from the registry. ```APIDOC ## Get ### Description Returns a descriptor from the registry. This is a copy, the plug-in must free the memory when it is done. ### Parameters - **key** (const char *) - Required - The unique string ID for the descriptor to return. - **descriptor** (PIActionDescriptor *) - Required - The descriptor returned. ### Returns - **OSErr** - Non-zero error if failure. ``` -------------------------------- ### Acquire Matrix Math Suite Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/group___matrix_math_suite Demonstrates how to acquire the suite using the SPBasic suite pointer. ```c PSMatrixMathProcs *sPSMatrixMath; error = sSPBasic->AcquireSuite(kPSMatrixMathSuite, kPSMatrixMathSuiteVersion, &sPSErrors); if (error) goto . . . //handle error ``` -------------------------------- ### GetPIHandleSizeProc Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/group___handle_suite Gets the size of the indicated handle. ```APIDOC ## GetPIHandleSizeProc ### Description Gets the size of the indicated handle. ### Parameters - **h** (Handle) - Required - The handle to get the size of. ### Returns - The size of the handle. ``` -------------------------------- ### GetDependentRect Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/struct_p_s_channel_ports_suite1 Gets the dependent rectangle at a particular level. ```APIDOC ## SPAPI SPErr(* PSChannelPortsSuite1::GetDependentRect)(PIChannelPort port, int32 sourceLevel, const VRect *sourceBounds, int32 dependentLevel, VRect *dependentBounds) ### Description Gets the dependent rectangle at a particular level. ### Parameters - **port** (PIChannelPort) - Required - Port to check. - **sourceLevel** (int32) - Required - Level of the port to check. - **sourceBounds** (VRect*) - Required - [OUT] - **dependentLevel** (int32) - Required - Level to check. - **dependentBounds** (VRect*) - Required - [OUT] Dependent rectangle, returned. ### Returns Non-zero error if failure. ``` -------------------------------- ### GetTilingGrid Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/struct_p_s_channel_ports_suite1 Gets the tiling information at a given level. ```APIDOC ## SPAPI SPErr(* PSChannelPortsSuite1::GetTilingGrid)(PIChannelPort port, int32 level, VPoint *tileOrigin, VPoint *tileSize) ### Description Gets the tiling information at a given level. ### Parameters - **port** (PIChannelPort) - Required - Port to check. - **level** (int32) - Required - Level of the port to check. - **tileOrigin** (VPoint*) - Required - [OUT] Origin point for the tiling system. - **tileSize** (VPoint*) - Required - [OUT] Size of the tiles. ### Returns Non-zero error if failure. ``` -------------------------------- ### GetWriteLimit Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/struct_p_s_channel_ports_suite1 Gets the bounds to which we can write at a given level. ```APIDOC ## SPAPI SPErr(* PSChannelPortsSuite1::GetWriteLimit)(PIChannelPort port, int32 level, VRect *writeBounds) ### Description Gets the bounds to which we can write at a given level. ### Parameters - **port** (PIChannelPort) - Required - Port to check. - **level** (int32) - Required - Level of the port to check. - **writeBounds** (VRect*) - Required - [OUT] Rectangle that provides the write bounds for the pixel data. ### Returns Non-zero error if failure. ``` -------------------------------- ### Execute JavaScript via Scripting Suite Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/_j_s_scripting_suite_8h_source.html Demonstrates the standard workflow for acquiring the suite, creating an engine, executing a script, and cleaning up the engine. ```c JSEngineRef engineRef = NULL; SPErr err = noErr; JSScriptingSuite2 * sScriptingSuite = NULL; err = basicSuite->AcquireSuite(kJSScriptingSuite, kJSScriptingSuiteVersion, (const void **)&sScriptingSuite); if ( err == kSPNoError ) { err = sScriptingSuite->CreateEngine( &engineRef ); if ( err == kSPNoError ) { const ASUnicode scriptText[] = {'a', 'l', 'e', 'r', 't', '(', '\'', 'h', 'i', '\'', ')', ';', 0 } ; // Script to create a new document const ASUnicode * result = NULL; err = sScriptingSuite->ExecuteScript( engineRef, scriptText, kJSExecutionModeNoDebug, &result ); if ( err == kJSScriptExecutionError ) { // If error during execution, display a dialog containing returned error information string. // ErrorAlert( result ); } } } ... err = sScriptingSuite->DeleteEngine( engineRef ); ``` -------------------------------- ### GetDepth Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/struct_p_s_channel_ports_suite1 Gets the pixel depth at a given level. ```APIDOC ## SPAPI SPErr(* PSChannelPortsSuite1::GetDepth)(PIChannelPort port, int32 level, int32 *depth) ### Description Gets the pixel depth at a given level. ### Parameters - **port** (PIChannelPort) - Required - Port to check. - **level** (int32) - Required - Level of the port to check. - **depth** (int32*) - Required - [OUT] Pixel depth, returned. Zero if the port or level is invalid. ### Returns Non-zero error if failure. ``` -------------------------------- ### GetPIResourceProc Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/group___resource_suite Gets the indicated resource for the current document. ```APIDOC ## GetPIResourceProc ### Description Gets the indicated resource for the current document. The plug-in host owns the returned handle, which should be treated as read-only. ### Parameters - **type** (ResType) - Required - The type of resource to get. - **index** (int16) - Required - The index of the resource to get. ### Returns - (Handle) A handle to the resource for the current document; NULL if no resource exists with the given type and index. ``` -------------------------------- ### GetDataBounds Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/struct_p_s_channel_ports_suite1 Gets the bounds for the pixel data at a given level. ```APIDOC ## SPAPI SPErr(* PSChannelPortsSuite1::GetDataBounds)(PIChannelPort port, int32 level, VRect *bounds) ### Description Gets the bounds for the pixel data at a given level. ### Parameters - **port** (PIChannelPort) - Required - Port to check. - **level** (int32) - Required - Level of the port to check. - **bounds** (VRect*) - Required - [OUT] Rectangle that provides the bounds for the pixel data. An empty rectangle if the parameters are invalid. ### Returns Non-zero error if failure. ``` -------------------------------- ### PSActionListProcs::GetType Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/struct_p_s_action_list_procs Gets the type for an index within a list. ```APIDOC ## PSActionListProcs::GetType ### Description Gets the type for an index within a list. Often used with GetCount to iterate through a list. ### Parameters - **list** (PIActionList) - List to get the type of. - **index** (uint32) - Index to get the type of. - **value** (DescriptorTypeID) - [OUT] Type for the value stored at index. ### Returns Non-zero error if failure. ``` -------------------------------- ### Acquire Action Reference Suite Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/group___pica_action_reference_suite Demonstrates the standard PICA pattern for acquiring the Action Reference Suite pointer. ```c PSActionReferenceProcs *sPSActionReference; error = sSPBasic->AcquireSuite(kPSActionReferenceSuite, kPSActionReferenceSuiteVersion, &sPSActionReference); if (error) goto . . . //handle error ``` -------------------------------- ### PSActionListProcs::GetZString Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/struct_p_s_action_list_procs Gets a zstring (typeChar) from a list for a given index. ```APIDOC ## PSActionListProcs::GetZString ### Description Gets a zstring (typeChar) from a list for a given index. ### Parameters - **list** (PIActionList) - The list from which to read. - **index** (uint32) - The index for which to return the string. - **zstring** (ASZString*) - [OUT] The zstring returned. ### Returns - Non-zero error if failure ``` -------------------------------- ### Acquiring the Basic Action Control Suite Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/group___pica_basic_control_suite Demonstrates how to acquire the Basic Action Control Suite using the SPBasic suite acquisition method. ```APIDOC ## Acquiring the Basic Action Control Suite ### Description To use the routines provided by the Basic Action Control Suite, a plug-in must first acquire the suite using the `sSPBasic->AcquireSuite` method. ### Implementation ```c PSBasicActionControlProcs *sPSBasicActionControl; error = sSPBasic->AcquireSuite(kPSBasicActionControlSuite, kPSBasicActionControlSuiteVersion, &sPSBasicActionControl); if (error) goto . . . //handle error ``` ### Constants - **kPSBasicActionControlSuite**: "3eb7c480-8797-11d1-8da7-00c04fd5f7ee" - **kPSBasicActionControlSuiteVersion**: 3 ``` -------------------------------- ### PSActionDescriptorProcs::GetData Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/struct_p_s_action_descriptor_procs Gets a data block (typeRawData) from a descriptor for a given key. ```APIDOC ## PSActionDescriptorProcs::GetData ### Description Gets a data block (typeRawData) from a descriptor for a given key. ### Signature SPAPI OSErr(* PSActionDescriptorProcs::GetData)(PIActionDescriptor descriptor, DescriptorKeyID key, void *value) ### Parameters - **descriptor** (PIActionDescriptor) - The descriptor from which to read. - **key** (DescriptorKeyID) - The key to read. - **value** (void*) - [OUT] The data block returned. ### Returns Non-zero error if failure. ``` -------------------------------- ### Build a descriptor using the Action Descriptor Suite Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/_p_g_scripting_plugins.html Demonstrates creating an action descriptor, populating it with key/value pairs, and assigning it to the filter record's descriptor parameters. ```cpp PIActionDescriptor actionDescriptor = NULL; // Create the action descriptor HERROR(sPSActionDescriptor->Make(&actionDescriptor)); // Put the descriptor key/value pairs into the descriptor HERROR(sPSActionDescriptor->PutEnumerated(actionDescriptor, keyResult, typeResult, enumResult)); // See if we need to clear the handle of an existing descriptor if (filterRecord->descriptorParameters != NULL && filterRecord->descriptorParameters->descriptor != NULL && filterRecord->handleProcs != NULL) { HandleProcs * handleProcs = filterRecord->handleProcs; handleProcs->disposeProc(filterRecord->descriptorParameters->descriptor); filterRecord->descriptorParameters->descriptor = NULL; } // Convert the Action Descriptor to a PIDescriptorHandle, and return // it in the descriptor parameters structure. HERROR(sPSActionDescriptor->AsHandle(actionDescriptor, &filterRecord->descriptorParameters->descriptor)); // Free the action descriptor if (actionDescriptor != NULL) sPSActionDescriptor->Free(actionDescriptor); ``` -------------------------------- ### main() Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/_p_g_plug_in_interface.html The main entry point routine for a plug-in module, invoked by the host in response to user actions. ```APIDOC ## main() ### Description The main entry point for the plug-in module. All calls from the host to the module are routed through this routine. ### Signature ``` #if MSWindows void ENTRYPOINT (short selector, void* pluginParamBlock, long* pluginData, short* result); #else pascal void main (short selector, Ptr pluginParamBlock, long* pluginData, short* result); #endif ``` ### Parameters - **selector** (short) - Identifies the specific action or request from the host. - **pluginParamBlock** (void* / Ptr) - Pointer to the parameter block containing data for the operation. - **pluginData** (long*) - Pointer to persistent plug-in data. - **result** (short*) - Pointer to the location where the operation result code should be stored. ``` -------------------------------- ### PSActionDescriptorProcs::GetDataLength Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/struct_p_s_action_descriptor_procs Gets the length of a data block from a descriptor for a given key. ```APIDOC ## PSActionDescriptorProcs::GetDataLength ### Description Gets the length of a data block from a descriptor for a given key. ### Signature SPAPI OSErr(* PSActionDescriptorProcs::GetDataLength)(PIActionDescriptor descriptor, DescriptorKeyID key, int32 *value) ### Parameters - **descriptor** (PIActionDescriptor) - The descriptor from which to read. - **key** (DescriptorKeyID) - The key to read. - **value** (int32*) - [OUT] The length of the data block. ### Returns Non-zero error if failure. ``` -------------------------------- ### Define the plug-in main entry point Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/_p_g_writing_plugins.html The main entry point routine handles calls from the host using platform-specific declarations for Windows and Macintosh. ```C #if MSWindows void ENTRYPOINT ( short selector, void* pluginParamBlock, long* pluginData, short* result); #else pascal void main ( short selector, Ptr pluginParamBlock, long* pluginData, short* result); #endif ``` -------------------------------- ### PSActionListProcs::GetBookmark Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/struct_p_s_action_list_procs Gets an alias (typeAlias) from a list, converts to a bookmark, and returns it. ```APIDOC ## PSActionListProcs::GetBookmark ### Description Gets an alias (typeAlias) from a list, given an indexed position in the list, converts to a bookmark, and returns it. ### Parameters - **list** (PIActionList) - The list from which to read. - **index** (uint32) - Indexed position in the list to retrieve. - **bookmark** (CFDataRef*) - [OUT] The bookmark returned. Caller must call CFRelease on the bookmark. ### Returns - Non-zero error if failure ``` -------------------------------- ### PSActionListProcs::GetData Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/struct_p_s_action_list_procs Gets a data block (typeRawData) from a list for a given index. ```APIDOC ## PSActionListProcs::GetData ### Description Gets a data block (typeRawData) from a list for a given index. ### Parameters - **list** (PIActionList) - The list from which to read. - **index** (uint32) - The index for which to return the data block. - **value** (void*) - [OUT] The data block returned. ### Returns - Non-zero error if failure ``` -------------------------------- ### Acquiring the Matrix Math Suite Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/group___matrix_math_suite Demonstrates how to acquire the Matrix Math Suite using the SPBasic suite acquisition method. ```APIDOC ## Acquiring the Matrix Math Suite ### Description To use the Matrix Math Suite, you must acquire it through the SPBasic suite acquisition interface using the suite identifier and version. ### Implementation ```c PSMatrixMathProcs *sPSMatrixMath; error = sSPBasic->AcquireSuite(kPSMatrixMathSuite, kPSMatrixMathSuiteVersion, &sPSErrors); if (error) { // Handle error } ``` ### Constants - **kPSMatrixMathSuite**: "9cfaa249-e6f1-11d2-b8eb-0060b0c1f95d" - **kPSMatrixMathSuiteVersion**: 1 ``` -------------------------------- ### Acquiring the Window Notify Suite Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/group___pica_window_notify_suite Demonstrates how to acquire the PSWindowNotifyProcs suite using the SPBasic suite acquisition method. ```APIDOC ## Acquiring the Window Notify Suite ### Description To use the Window Notify suite, you must acquire it from the SPBasic suite manager using the suite identifier and version. ### Code Example ```c PSWindowNotifyProcs *sPSWindowNofify; error = sSPBasic->AcquireSuite(kPSWindowNotifySuite, kPSWindowNotifySuiteVersion, &sPSWindowNofify); if (error) goto . . . //handle error ``` ``` -------------------------------- ### PSActionControlProcs::Get Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/struct_p_s_action_control_procs Gets a property from the host using the actions system as a database. ```APIDOC ## PSActionControlProcs::Get ### Description Gets a property from the host. The actions system serves as a database for properties. ### Parameters - **result** (PIActionDescriptor*) - [OUT] A descriptor with the pertinent information. - **reference** (PIActionReference) - The property to get. ``` -------------------------------- ### Validate File Readability Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/group___format_module Example logic for determining if a module can process a specific file. ```C if (module can read this file) *result = noErr; else *result = formatCannotRead; ``` -------------------------------- ### Accessing the Resource Suite in PluginMain Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/group___resource_suite Demonstrates how to retrieve the Resource Suite from the FormatRecord parameter block and invoke a procedure. ```cpp // FormatRecord global pointer. FormatRecord * gFormatRecord = NULL; DLLExport MACPASCAL void PluginMain (const int16 selector, FormatRecordPtr formatParamBlock, intptr_t* data, int16* result) { // The Resource Suite is contained in the parameter block passed // in formatParamBlock. gFormatRecord = formatParamBlock; ... // Get the Resource Suite from the parameter block, and call // countProc to count the number of "histResource" resources. int16 resourceCount = gFormatRecord->resourceProcs->countProc(histResource); ... } ``` -------------------------------- ### Acquiring the Action Reference Suite Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/group___pica_action_reference_suite This snippet demonstrates how to acquire the Action Reference Suite using the PICA (Plug-in Internal Component Architecture) basic suite. ```APIDOC ## Acquiring the Action Reference Suite ### Description To use the Action Reference Suite, a plug-in must acquire the suite interface using the `SPBasicSuite` pointer. The suite is identified by the constant `kPSActionReferenceSuite` and the version `kPSActionReferenceSuiteVersion`. ### Implementation ```c PSActionReferenceProcs *sPSActionReference; error = sSPBasic->AcquireSuite(kPSActionReferenceSuite, kPSActionReferenceSuiteVersion, &sPSActionReference); if (error) { // Handle error } ``` ### Constants - **kPSActionReferenceSuite**: "df135117-c769-11d0-8079-00c04fd7ec47" - **kPSActionReferenceSuiteVersion**: 3 ``` -------------------------------- ### Configure Linker Entry Point Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/_p_g_win_plugins.html Linker assignment for the DLL entry point in sample makefiles. ```Makefile PSDLLENTRY=DLLInit@12 ``` -------------------------------- ### PSActionListProcs::GetBoolean Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/struct_p_s_action_list_procs Gets a boolean value (typeBoolean) from a list, given an indexed position in the list. ```APIDOC ## SPAPI OSErr(* PSActionListProcs::GetBoolean)(PIActionList list, uint32 index, Boolean *value) ### Description Gets a boolean value (typeBoolean) from a list, given an indexed position in the list. ### Parameters - **list** (PIActionList) - The list from which to read. - **index** (uint32) - Indexed position in the list to retrieve. - **value** (Boolean*) - [OUT] The boolean value returned. ### Returns - Non-zero error if failure ``` -------------------------------- ### PSActionListProcs::GetInteger Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/struct_p_s_action_list_procs Gets an integer value (typeInteger) from a list, given an indexed position in the list. ```APIDOC ## SPAPI OSErr(* PSActionListProcs::GetInteger)(PIActionList list, uint32 index, int32 *value) ### Description Gets an integer value (typeInteger) from a list, given an indexed position in the list. ### Parameters - **list** (PIActionList) - The list from which to read. - **index** (uint32) - Indexed position in the list to retrieve. - **value** (int32*) - [OUT] The integer value returned. ### Returns - Non-zero error if failure ``` -------------------------------- ### Define Plug-in Entry Points for Windows Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/_f_a_qs.html Use these macro definitions and function signatures to ensure your plug-in entry points are correctly exported for the Windows environment. ```cpp #define DLLExport extern "C" -declspec (dllexport) DLLExport MACPASCAL void PluginMain(const intl6 selector, FilterRecord* filterRecord, int32* data, intl6* result); DLLExport BOOL WINAPI DissolveProc(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM lParam); ``` -------------------------------- ### Acquiring the Action List Suite Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/group___pica_action_list_suite Demonstrates how to acquire the PSActionListProcs suite using the SPBasic suite acquisition method. ```APIDOC ## Acquiring the Action List Suite ### Description To use the Action List Suite, a plug-in must acquire the suite using the SPBasic suite acquisition method with the unique suite identifier and version constant. ### Implementation ```c PSActionListProcs *sPSActionList; error = sSPBasic->AcquireSuite(kPSActionListSuite, kPSActionListSuiteVersion, &sPSActionList); if (error) goto . . . //handle error ``` ### Constants - **kPSActionListSuite**: "df135116-c769-11d0-8079-00c04fd7ec47" - **kPSActionListSuiteVersion**: 3 ``` -------------------------------- ### Define Source Rectangle for Scaling Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/struct_p_s_scaling Example of setting the boundaries for a 100-pixel square source rectangle. ```cpp sourceRect.top = 0; sourceRect.left = 0; sourceRect.bottom = 100; sourceRect.right = 100; ``` -------------------------------- ### Accessing and Using the Handle Suite Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/group___handle_suite Demonstrates defining a data structure, accessing the suite via the FilterRecord, and allocating memory using the newProc routine. ```cpp // The structure to hold the data, we'll create a handle for this. typedef struct Data { FilterColor color; FilterColor colorArray[4]; Boolean queryForParameters; BufferID dissolveBufferID; Ptr dissolveBuffer; VRect proxyRect; real32 scaleFactor; BufferID proxyBufferID; Ptr proxyBuffer; int32 proxyWidth; int32 proxyHeight; int32 proxyPlaneSize; } Data; FilterRecord *gFilterRecord = NULL; DLLExport MACPASCAL void PluginMain(const int16 selector, FilterRecordPtr filterRecord, intptr_t* data, int16* result) { // The parameter block that contains the suite is found in filterRecord. gFilterRecord = filterRecord; ... } // This function uses one of the Handle Suite routines void CreateDataHandle(void) { // Get the Handle Suite, and call the // newProc routine to allocate the memory for the handle. Handle h = gFilterRecord->handleProcs->newProc(sizeof(Data)); ... } ``` -------------------------------- ### Platform and Environment Configuration Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/_p_i_actions_8h_source.html Macros for defining platform-specific environment variables and including necessary system headers. ```cpp #ifndef MSWindows #ifdef MSDOS #define MSWindows MSDOS #endif #ifdef WIN32 #define MSWindows WIN32 #endif #ifndef MSWindows #define MSWindows 0 #endif #endif #ifndef INSIDE_PHOTOSHOP #define INSIDE_PHOTOSHOP 0 #endif #ifndef qiOS #define qiOS 0 #endif #ifdef Rez #if !MSWindows && !qiOS #include #endif #else // Rez #if !MSWindows && !qiOS && !PS_OS_ANDROID #include #endif #if PS_OS_ANDROID #include #endif // PS_OS_ANDROID #include "PITypes.h" #include "SPTypes.h" #include "SPPlugs.h" #endif // Rez ``` -------------------------------- ### Configure PiPL entrypoint for ARM Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/_a_r_m.html Update the PiPL definition to support Universal binaries on Macintosh and correct entrypoints on Windows using PIResourceDefines.h. ```cpp #include "PIResourceDefines.h" // in your PiPL definition change these to your entrypoints #if Macintosh #if defined(__arm64__) CodeMacARM64 { "PluginMain" }, #endif #if defined(__x86_64__) CodeMacIntel64 { "PluginMain" }, #endif #elif MSWindows CodeEntryPointWin64 { "PluginMain" }, #endif ``` -------------------------------- ### UI and Color Property Keys Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/group___property_keys Macros for retrieving UI theme settings, colors, and scaling preferences. ```c #define propUXPrimaryColor 'Uxpc' ``` ```c #define propUXSecondaryColor 'Uxsc' ``` ```c #define propUXUseUpdatedUX 'Uxuu' ``` ```c #define propUIBrightness 'UIBR' ``` ```c #define propHighlightColor 'HLCR' ``` ```c #define propLargeTabs 'LGTB' ``` ```c #define propScaleUIToFontZoom 'SUFZ' ``` ```c #define propCheckerboardColor1 'cHK1' ``` ```c #define propCheckerboardColor2 'cHK2' ``` ```c #define propCheckerboardSize 'cHKz' ``` ```c #define propUseCheckerboard 'UcHK' ``` -------------------------------- ### Terminology Resource Shortcuts Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/_p_i_actions_8h Shortcuts for defining plug-in reply requirements and image direct parameters. ```c #define NO_REPLY ``` ```c #define IMAGE_DIRECT_PARAMETER ``` -------------------------------- ### Define PSScaling Rectangles Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/group___channel_ports_suite Examples of setting source and destination rectangles for image scaling operations. ```C sourceRect.top = 0; sourceRect.left = 0; sourceRect.bottom = 100; sourceRect.right = 100; ``` ```C destinationRect.top = 0; destinationRect.left = 0; destinationRect.bottom = 50; destinationRect.right = 50; ``` -------------------------------- ### Inspect plug-in exports Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/_f_a_qs.html Use the dumpbin utility to verify the exported functions of a Windows plug-in binary. ```bash dumpbin /EXPORTS MyPluginName.8bf ``` -------------------------------- ### PSActionDescriptorProcs::GetBookmark Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/struct_p_s_action_descriptor_procs Macintosh only, gets an alias (typeAlias) from a descriptor for a given key, converts to a bookmark, and returns it. ```APIDOC ## PSActionDescriptorProcs::GetBookmark ### Description Macintosh only, gets an alias (typeAlias) from a descriptor for a given key, converts to a bookmark, and returns it. Caller must call CFRelease on the bookmark. ### Signature SPAPI OSErr(* PSActionDescriptorProcs::GetBookmark)(PIActionDescriptor descriptor, DescriptorKeyID key, CFDataRef *value) ### Parameters - **descriptor** (PIActionDescriptor) - The descriptor from which to read. - **key** (DescriptorKeyID) - The key to read. - **value** (CFDataRef*) - [OUT] The bookmark returned. ### Returns Non-zero error if failure. ``` -------------------------------- ### PSActionDescriptorProcs::GetInteger64 Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/struct_p_s_action_descriptor_procs Gets a 64 bit integer value (typeComp (typeSInt64)) from a descriptor for a given key. ```APIDOC ## PSActionDescriptorProcs::GetInteger64 ### Description Gets a 64 bit integer value (typeComp (typeSInt64)) from a descriptor for a given key. ### Signature SPAPI OSErr(* PSActionDescriptorProcs::GetInteger64)(PIActionDescriptor descriptor, DescriptorKeyID key, int64 *value) ### Parameters - **descriptor** (PIActionDescriptor) - The descriptor from which to read. - **key** (DescriptorKeyID) - The key to read. - **value** (int64*) - [OUT] The 64 bit integer value returned. ### Returns Non-zero error if failure. ``` -------------------------------- ### Acquire, use, and release a PICA suite Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/_p_g_pica_callback_suites.html Demonstrates the lifecycle of a suite: acquiring the ADM Basic Suite, invoking a function, and releasing the suite. ```cpp // Pointer to the ADM (Adobe Dialog Manager) Basic Suite ADMBasicSuite *sADMBasic; // Acquire the ADM Basic Suite filterParamBlock->sSPBasic->AcquireSuite( kADMBasicSuite, kADMBasicSuiteVersion, &sADMBasic ); // Call its Beep() function sADMBasic->Beep( ); // Release the suite filterParamBlock->sSPBasic->ReleaseSuite( kADMBasicSuite, kADMBasicSuiteVersion ); ``` -------------------------------- ### MainAppRootWindowProc Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/_p_i_u_i_hooks_suite_8h_source.html Returns the Windows application frame HWND, or NULL on Mac. ```APIDOC ## MainAppRootWindowProc ### Description Returns the Windows application frame HWND, or NULL on Mac. ``` -------------------------------- ### Define Suite Identifier Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/group___pica_get_file_list_suite The unique string identifier used to reference the Get File List Suite. ```C #define kPSGetFileListSuite "Photoshop GetFileList Suite for Plug-ins" ``` -------------------------------- ### Acquire Basic Action Control Suite Source: https://adobesdk.neocities.org/pluginsdk/documentation/html/group___pica_basic_control_suite Standard pattern for acquiring the suite using the SPBasic suite pointer. Ensure error handling is implemented to manage potential acquisition failures. ```c PSBasicActionControlProcs *sPSBasicActionControl; error = sSPBasic->AcquireSuite(kPSBasicActionControlSuite, kPSBasicActionControlSuiteVersion, &sPSBasicActionControl); if (error) goto . . . //handle error ```