| |
Getting Started
SDK API Reference
SDK API Features
Other Documentation
|
|
|
Resource Suite Callbacks
Detailed Description
This suite of callback routines provides support for storing and retrieving data from a document.
These routines provide pseudo-resources which plug-in modules can attach to documents and use to communicate with each other.
Each resource is a Handle of data and is identified by a 4 character code ResType and a one-based index. The maximum number of pseudo-resources in a document for Photoshop is 1000. Use the Handle Suite Callbacks to manage the Handle data structure.
The standard Resource Suite is found as a pointer in the parameter blocks of the plug-in modules. You can access the routines within the Resource Suite in the following manner:
FormatRecordPtr gFormatRecord = NULL;
DLLExport MACPASCAL void PluginMain (const int16 selector,
FormatRecordPtr formatParamBlock,
intptr_t * data,
int16 * result)
{
gFormatRecord = reinterpret_cast<FormatRecordPtr>(formatParamBlock);
...
int16 resourceCount = gFormatRecord->resourceProcs->countProc(histResource);
...
}
|
Data Structures |
| struct | ResourceProcs |
| | The set of routines available in the Resource suite. More...
|
Pseudo-Resource Suite Callbacks |
| typedef MACPASCAL int16(*) | CountPIResourcesProc (ResType type) |
| | Counts the number of resources of a given type.
|
| typedef MACPASCAL Handle(*) | GetPIResourceProc (ResType type, int16 index) |
| | Gets the indicated resource for the current document.
|
| typedef MACPASCAL void(*) | DeletePIResourceProc (ResType type, int16 index) |
| | Deletes the indicated resource in the current document.
|
| typedef MACPASCAL OSErr(*) | AddPIResourceProc (ResType type, Handle data) |
| | Adds a resource of the given type at the end of the list for that type.
|
Defines |
| #define | kCurrentResourceProcsVersion 3 |
| | The current version of the resource suite.
|
| #define | kCurrentResourceProcsCount ((sizeof(ResourceProcs) - offsetof(ResourceProcs, countProc)) / sizeof(void *)) |
| | Current number of routines in the Resource Suite.
|
Define Documentation
| #define kCurrentResourceProcsVersion 3 |
The current version of the resource suite.
Current number of routines in the Resource Suite.
Typedef Documentation
Counts the number of resources of a given type.
- Parameters:
-
| type | The type of resource to count. |
- Returns:
- The number of resources of the given type.
Gets the indicated resource for the current document.
The plug-in host owns the returned handle. The handle should be treated as read-only. - Parameters:
-
| type | The type of resource to get. |
| index | The index of the resource to get. |
- Returns:
- A handle to the resource for the current document; NULL if no resource exists with the given type and index.
Deletes the indicated resource in the current document.
Note that since resources are identified by index rather than ID, this causes subsequent resources to be renumbered. - Parameters:
-
| type | The type of resource to delete. |
| index | The index of the resource to delete. |
Adds a resource of the given type at the end of the list for that type.
The contents of data are duplicated so that the plug-in retains control over the original handle. The maximum number of resources in a Photoshop document is 1000. - Parameters:
-
| type | The type of resource to add. |
| data | The resource data to add. |
- Returns:
memFullErr if there is not enough memory or the document already has too many plug-in resources.
|
|