![]() |
Adobe Photoshop SDK |
|
Writing Color Picker Plug-insWhen the user invokes a Color Picker plug-in by selecting its name in the Preferences General dialog and then trying to pick a custom color (such as clicking on the foreground or background colors in the tools palette), Adobe Photoshop calls the plug-in once with pickerSelectorPick. The recommended sequence of actions for your plug-in to take is shown in the following diagram. ![]() For descriptions of the sample Color Picker plug-ins provided with the SDK, see Color Picker Samples. Color Pickers and ScriptingAdobe Photoshop’s scripting routines save the information pointed to by the recording parameters field, so that it can operate the selection without user input during play back. Your plug-in should validate the contents of its playback parameters when it starts processing if there is a danger of it crashing from bad parameters. You may wish to design your plug-in so that you store default values or the last used set of values in the plug-in’s Mac OS resource fork or a Windows external file. This way, you can save preference settings for your plug-in that are consistent every time the host application runs. Color Pickers and Mac OS Resource ForksColor Pickers are very special plug-ins because they can be called by other plug-ins. This means that you must be extra careful to make sure the plug-in reads the correct resources, since multiple resource forks may be available. For instance, a Filter module uses the Color Services callback suite and requests it pop the "Choose a color" interface. The user has selected your Color Picker module as the chosen Color Picker. Now, the host’s resource fork is open, the Filter module’s resource fork is open, and then, once your Color Picker module is loaded, its resource fork is open. If you need a resource in your Color Picker’s resource fork, make sure to use the Mac OS toolbox call |