latestFilterSubVersion },
#ifdef __PIWin__
CodeWin32X86 { "PluginMain" },
#else
CodeMachOPowerPC { 0, 0, "PluginMain" },
#endif
SupportedModes
{
noBitmap, doesSupportGrayScale,
noIndexedColor, doesSupportRGBColor,
doesSupportCMYKColor, doesSupportHSLColor,
doesSupportHSBColor, doesSupportMultichannel,
doesSupportDuotone, doesSupportLABColor
},
HasTerminology
{
plugInClassID,
plugInEventID,
16000, /* int16 aeteResNum; number of 'aete' resource */
plugInUniqueID
},
EnableInfo
{
"in (PSHOP_ImageMode, RGBMode,"
"CMYKMode, HSLMode, HSBMode, "
"DuotoneMode, LabMode)"
},
PlugInMaxSize { 2000000, 2000000 },
FilterCaseInfo {
{ /* array: 7 elements */
/* Flat data, no selection */
inStraightData,
outStraightData,
doNotWriteOutsideSelection,
doesNotFilterLayerMasks,
doesNotWorkWithBlankData,
copySourceToDestination,
/* Flat data with selection */
inStraightData,
outStraightData,
doNotWriteOutsideSelection,
doesNotFilterLayerMasks,
doesNotWorkWithBlankData,
copySourceToDestination,
/* Floating selection */
inStraightData,
outStraightData,
doNotWriteOutsideSelection,
doesNotFilterLayerMasks,
doesNotWorkWithBlankData,
copySourceToDestination,
/* Editable transparency, no selection */
inStraightData,
outStraightData,
doNotWriteOutsideSelection,
doesNotFilterLayerMasks,
doesNotWorkWithBlankData,
copySourceToDestination,
/* Editable transparency, with selection */
inStraightData,
outStraightData,
doNotWriteOutsideSelection,
doesNotFilterLayerMasks,
doesNotWorkWithBlankData,
copySourceToDestination,
/* Preserved transparency, no selection */
inStraightData,
outStraightData,
doNotWriteOutsideSelection,
doesNotFilterLayerMasks,
doesNotWorkWithBlankData,
copySourceToDestination,
/* Preserved transparency, with selection */
inStraightData,
outStraightData,
doNotWriteOutsideSelection,
doesNotFilterLayerMasks,
doesNotWorkWithBlankData,
copySourceToDestination
}
}
}
};
resource 'aete' (16000, "FillRed dictionary", purgeable)
{
1, 0, english, roman, /* aete version and language specifiers */
{
vendorName, /* vendor suite name */
"FillRed Demo By hoodlum1980", /* optional description */
plugInSuiteID, /* suite ID */
1, /* suite code, must be 1 */
1, /* suite level, must be 1 */
{ /* structure for filters */
plugInName, /* unique filter name */
plugInAETEComment, /* optional description */
plugInClassID, /* class ID, must be unique or Suite ID */
plugInEventID, /* event ID, must be unique to class ID */
NO_REPLY, /* never a reply */
IMAGE_DIRECT_PARAMETER, /* direct parameter, used by Photoshop */
{ /* parameters here, if any */
"FillColor", /* parameter name */
KEY_FILLCOLOR, /* parameter key ID */
typeInteger, /* parameter type ID */
"Fill color in RGB", /* optional description */
flagsSingleParameter, /* parameter flags */
"Opacity", /* optional parameter */
KEY_OPACITY, /* key ID */
typeInteger, /* type */
"opacity in RGB", /* optional desc */
flagsSingleParameter /* parameter flags */
}
},
{ /* non-filter plug-in class here */
},
{ /* comparison ops (not supported) */
},
{ /* any enumerations */
}
}
};
在上面的文件中,我们可以看到我们的滤镜含有的两个主要参数:填充颜色 和 不透明度。位于 IMAGE_DIRECT_PARAMETER 结构中,typeInteger 指明它们是整数类型。flagsSingleParameter指明它们是基本类型(具有单一值)。此外,还可以把参数定义为枚举类型,同时把枚举的值域定义放在最后一节中,这里我们对此不做介绍了。
![怎样编写一个Photoshop滤镜-- Scripting Plug-ins 怎样编写一个Photoshop滤镜-- Scripting Plug-ins](http://img.zhengzen.com/upload/drawing_3/drawing_1214092934_1.jpg)
滤镜被重新编译后,我们在PS中对它录制一个动作,命名为“测试 FillRed”,录制完成后,可以看到在动作面板上的左侧,出现了对话框选项的CheckBox,我们可以设置播放时是否弹出对话框。我们把FillRed滤镜命令的下拉列表展开可以看到滤镜参数:
FillColor: 10
Opacity:90
请注意参数的名字就是来自于上面的aete资源中的定义的滤镜参数名字属性,这就是我们需要给它定义一个可读的参数名的原因。需要注意的是,由于我们把对话框上三个参数合成为了一个参数,这就使得上面的参数显示是三个参数的合成值(10进制)。因此这里为了看清楚,我就只设置了 R 和 O1,其他参数都为0,这样我们在动作面板看到的参数值就和滤镜的对话框上的参数值是一致的。否则我们看到的将是三个参数合成后的值。
更多怎样编写一个Photoshop滤镜-- Scripting Plug-ins相关文章请关注PHP中文网!
Photoshop默认保存的文件格式,可以保留所有有图层、色版、通道、蒙版、路径、未栅格化文字以及图层样式等。
关键词:怎样编写一个Photoshop滤镜-- Scripting Plug-ins