当前位置:   article > 正文

Photoshop插件开发_ps的sdk插件开发

ps的sdk插件开发

1.      获取SDK

http://www.adobe.com/devnet/photoshop/sdk.html,根据需要找到对应的版本,现在最新的是Adobe Photoshop CC 2014的SDK,另外还有CS、CS2、CS3、CS4、Touch、CS5、CS6、CC的SDK。这里以CC为例。

2.      探索SDK

Plug-In SDK:开发者可以使用这个SDK来创建插件和扩展Adobe Photoshop CC的功能。

Connection SDK:使用这个SDK,开发者可以创建和使得APP能操控或与PhotoshopCC通信。

3.      用Plug-in SDK开发PS插件

这个开发包是为c语言开发者准备的,可用来编写Windows和MAC操作系统下的PS插件。开发包下的源码Mac下是XCode,Windows下是Visual C++。

使用开发包下的documentation.html来了解插件的具体开发资料。如SDK程序员指南就涵盖了许多插件开发知识,包括:

1.      插件基础

2.      插件类型

3.      插件接口

4.      内存管理策略

5.      创建Mac操作系统下的插件

6.      创建Windows操作系统下的插件

7.      回调和回调功能集

8.      编写插件

9.      插件的脚本支持

10.  创建PiPL资源

11.  样例代码

12.  杂项

4.      例子插件MFCPlugin

这里挑选了SDK中的一个例子插件MFCPlugin,它展示了在插件开发中使用MFC,其各项功能的入口如下:

CMFCPlugInApp theApp;

SPBasicSuite * sSPBasic = NULL;

SPPluginRef      gPlugInRef = NULL;

DLLExport SPAPI void PluginMain(const int16 selector,

                                     FilterRecordPtr filterParamBlock,

                                     intptr_t* data,

                                     int16* result);

DLLExport SPAPI void PluginMain(const int16 selector,

                                     FilterRecordPtr filterParamBlock,

                                     intptr_t* data,

                                     int16* result)

{

 

         sSPBasic= filterParamBlock->sSPBasic;

         gPlugInRef= (SPPluginRef)filterParamBlock->plugInRef;

 

         try

         {

                   theApp.Entry(filterParamBlock,data);

 

                   switch(selector )

                   {

                            case filterSelectorAbout:

                                     sSPBasic = ((AboutRecordPtr)(filterParamBlock))->sSPBasic;

                                     gPlugInRef = (SPPluginRef)((AboutRecordPtr)(filterParamBlock))->plugInRef;

                                     theApp.About();

                                     break;

                            case filterSelectorParameters:

                                     theApp.Parameters();

                                     break;

                            case filterSelectorPrepare:

                                     theApp.Prepare();

                                     break;

                            case filterSelectorStart:

                                     theApp.Start();

                                     break;

                            case filterSelectorContinue:

                                     theApp.Continue();

                                     break;

                            case filterSelectorFinish:

                                     theApp.Finish();

                                     break;

                   }

 

                   if(selector != filterSelectorAbout)

                            theApp.Exit();

 

         }

 

         catch(char* inErrorString)

         {

                   OutputDebugString(inErrorString);

                   char*pErrorString = (char*)filterParamBlock->errorString;

                   if(pErrorString != NULL&& (strlen(inErrorString)< 256))

                   {

                            *pErrorString = (char)strlen(inErrorString);

                            memcpy(pErrorString+1,inErrorString, (unsignedchar)(*pErrorString));

                   }

                   *result= errReportString;

 

         }

        

         catch(short inError)

         {

                   *result= inError;

         }

        

         catch(...)

         {

                   *result= -1;

         }

}

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/笔触狂放9/article/detail/179430
推荐阅读
相关标签
  

闽ICP备14008679号