![]() |
Adobe Photoshop SDK |
|
Plug-in BasicsSections on this Page
This section describes what plug-in modules are and provides information common to all plug-in modules. You should understand this material before proceeding to the chapters detailing the specific types of plug-in modules. This chapter also contains information about compiling and testing plug-in modules under the Mac OS and Microsoft Windows. Additional compiler-specific information is available in the toolkit header files. Plug-in modules and plug-in hostsAdobe Photoshop plug-in modules are software programs developed by Adobe Systems and third-party vendors with Adobe Systems to extend the standard Adobe Photoshop program. Plug-in modules can be added or updated independently by end users to customize Photoshop to their particular needs. This guide also frequently refers to plug-in hosts. A plug-in host is responsible for loading plug-in modules into memory and calling them. Adobe Photoshop is a plug-in host. These Adobe applications function as plug-in hosts: Adobe After Effects, Adobe Premiere, Adobe Illustrator, Adobe PageMaker, and Adobe PhotoDeluxe. Most of these applications support some, but not all, Photoshop plug-in modules. Many applications from third-party developers support the use of Photoshop plug-in modules, as well. Most plug-in hosts are application programs, but this not a requirement. A plug-in host may itself be a plug-in module. A good example of this is the "Photoshop Adapter" which allows Adobe Illustrator 6.0 to host Photoshop Format and Filter modules. This toolkit and guide are not designed for developers interested in creating plug-in hosts; the emphasis and goal for this guide is presenting information pertinent to creating plug-in modules. Unless otherwise stated, Adobe Photoshop is assumed to be the plug-in host throughout this manual. Other hosts may or may not support all the callbacks, properties and functionality described in this guide. A short history lessonPlug-ins are not unique to Photoshop. Many Macintosh and Windows applications support some form of plug-in extensions. Perhaps the best known example of an application that supports a plug-in architecture is Apple’s HyperCard, with its support for XCMDs and XFCNs. One of the first companies to incorporate plug-in modules into their products was Silicon Beach, in its Digital Darkroom and SuperPaint products. Silicon Beach spent a lot of time developing a newer, better designed plug-in implementation. In HyperCard, developers have to paste their plug-ins into the host application using ResEdit. Silicon Beach’s design for plug-in modules has the code residing in individual files. This allows the plug-in files to be placed anywhere, not just in the System Folder. Silicon Beach’s design also incorporated the concept of version numbering, which allowed for smooth migration as new functionality was added to the interface. Adobe Photoshop’s implementation of plug-in modules loosely resembles that used by Silicon Beach. It uses a similar calling sequence, and the same version number scheme. However, the similarity ends there. As Photoshop’s plug-in architecture evolved, the detailed interface for Photoshop’s plug-in modules became completely different from that used by Silicon Beach. The differences were required primarily to support color images and Adobe Photoshop’s virtual memory scheme. A great overview of Macintosh programming with code fragments is provided in A Fragment of Your Imagination, by Joe Zobkiw (1995, Addison-Wesley, NY, ISBN 0-201-483358-0). Chapter ten of Zobkiw’s book is solely about writing Photoshop filters. Macintosh and Windows developmentThe original plug-in interface was designed when Adobe Photoshop was a Macintosh-only product. This heritage is still apparent today, and affects Windows developers building plug-ins. While you can build plug-in modules for Windows without needing a Macintosh, there are a number of data structures and Mac toolbox-like calls that will appear in your Windows code. The good news is that this makes building plug-ins that work across both Mac OS and Windows easier. The bad news is that if you’re developing only for the Windows platform, some of the terminology may be unfamiliar. Another important difference between the Macintosh and Windows is byte ordering. Motorola and PowerPC processors store pointers, 16-, and 32- bit numbers in big endian format, while Intel processors use little endian format. An example of this is the number 65298, which would disassemble as hex word $FF 12 on a Motorola or PowerPC processor, and $12 FF on an Intel processor. $12 FF on the Intel could be mistaken by beginning Macintosh programmers as 4863, when it in fact is 65298. Because many Photoshop files are designed to work across both platforms, the Photoshop engineering team chose to standardize on big endian format (Photoshop’s heritage shows through again). When programming under Windows, you must be careful to handle byte ordering properly. Version Information2.5 & 3.0 The other significant change in version 3.0 is the introduction of the AdvanceStateProc callback function. This callback provides improved performance for plug-in modules that handle large images. 3.0.4 Version 3.0.4 also adds a new callback suite: the Image Services Suite Callbacks. The two callback functions in this suite allow you to resample image data, and are useful for various types of filter, import, and export modules. 3.0.5 4.0 4.0.1 5.0 See Photoshop Actions Event Guide for detailed information on automation plug-ins. 5.0.2 5.5 6.0 7.0 The Scripting Support plug-in developed for Illustrator is now available for Photoshop. You can now create JavaScript, AppleScript, and Visual Basic scripts. Scripting Support comes in a separate package and installer. Plug ins now have read access to all the layers in a Photoshop document. See the PoorMansTypeTool example. Share Data Section must be off in your project settings for Macintosh. The AutomationFilter automation plug in and Hidden filter plug in work together to access all layers and all channels of a document. This release moves the pixel read and write inside the Hidden plug in. This allows the Hidden filter to work faster and to use tiling. New properties available, see If your dialog uses a custom WDEF your dialog will show up behind the Photoshop palettes on OS X. Use the following OS call to fix the problem. SetWindowGroup(myWindowRef, GetWindowGroupOfClass(kModalWindowClass)); See the Apple documentation for more details. The Project settings for Windows now use Blend for Processor. CS (8.0) CS2 (9.0) CS3 (10.0) |