●EXORフィルタ1
・アウトライン
1.空のプロジェクト作成
- Win32 Dynamic-Link Library
- 空のDLL プロジェクト
2.ソースファイルの追加
- exor.cpp
- exor.pipl
3. リソーススクリプトの新規作成
- exor.rc を新規作成
- エディタで開いて, #include "exor.pipl" を追記
4.インクルードパスの設定
- PhotoshopAPI/Photoshop
- PhotoshopAPI/pica_sp
- common/Includes
5.出力ファイル名の変更
- exor.8bf
6.ビルド
7.プラグインをコピー |
|
|
・exor.cpp
#include "PIDefines.h"
#include "PIFilter.h"
#define BIN 0xaa
FilterRecord * gFR = NULL;
int32 * gDataHandle = NULL;
int16 DoStart(void);
BOOL APIENTRY DllMain(HANDLE , DWORD , LPVOID ) { return true; }
DLLExport MACPASCAL void PluginMain(const int16 selector,
FilterRecord *filterRecord,
int32 *data,
int16 *result)
{
gFR = filterRecord;
gDataHandle = data;
switch (selector)
{
case filterSelectorStart:
*result = DoStart();
break;
case filterSelectorAbout:
case filterSelectorParameters:
case filterSelectorPrepare:
case filterSelectorContinue:
case filterSelectorFinish:
break;
}
}
int16 DoStart( void )
{
Rect * filterRect = & gFR->filterRect;
Rect * outRect = & gFR->outRect;
int16 width = filterRect->right - filterRect->left;
int16 height = filterRect->bottom - filterRect->top ;
int16 expectedPlanes = 3;
*outRect = *filterRect;
for (uint16 ch = 0; ch < expectedPlanes; ch++)
{
gFR->outLoPlane = gFR->inLoPlane = ch;
gFR->outHiPlane = gFR->inHiPlane = ch;
int16 res = gFR->advanceState();
if ( res != noErr ) return res;
uint8 * pix = (uint8*) gFR->outData;
for(int y=0; y < height; y++)
{
uint8 * pix1 = pix + width;
for(; pix < pix1; pix++) *pix ^= BIN;
pix += gFR->outRowBytes - width;
}
}
memset( outRect, 0, sizeof(Rect) );
return noErr;
}
|
・exor.r
#include "PIGeneral.h"
#define plugInName "eXoR0"
#define vendorName "ymtkyk"
resource 'PiPL' ( 16000, plugInName, purgeable )
{
{
Kind { Filter },
Name { plugInName },
Category { vendorName },
Version { (latestFilterVersion >> 16) | latestFilterSubVersion },
CodeWin32X86 { "PluginMain" },
EnableInfo { "in (PSHOP_ImageMode, RGBMode )" }
}
};
|
・pipl の生成(cl と cnvtpipl の実行)
cl /EP /DWIN32=1 /Tc.\exor.r > .\exor.rr
cnvtpipl.exe .\exor.rr .\exor.pipl
del .\exor.rr
|
|