您当前的位置: 首页 > 

插件开发

暂无认证

  • 1浏览

    0关注

    492博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

Photoshop插件-黑白(四)-脚本开发-PS插件

插件开发 发布时间:2022-04-06 07:54:44 ,浏览量:1

文章目录
    • 1.插件界面
    • 2.关键代码--黑白风格四
    • 3.代码转执行
    • 4.作者答疑
  PS是一款栅格图像编辑软件,模块众多。提供了脚本,动态连接库等多种扩展机制,本文演示如何通过脚本实现黑白风格四相关功能,展示从互联网收集而来的一个小插件,供大家学习交流,请勿用于商业用途。

1.插件界面

  本文界面是一系列功能的一部分,将逐步展示,但是功能界面是共同的,如下图所示: 在这里插入图片描述

2.关键代码–黑白风格四

  大家可通过源代码阅读,来掌握相关技巧,源代码如下:

historyState = "U 2.0";
if (app.documents) {
    ErrStrs = {};
    ErrStrs.USER_CANCELED = localize("$$$/ScriptingSupport/Errors/UserCancelled");
    var historyStateNow = -1;
    do {
        historyStateNow++
    } while (app.activeDocument.activeHistoryState != app.activeDocument.historyStates[historyStateNow])
    try {
        app.activeDocument.suspendHistory(historyState, "Name()");
    } catch (e) {
        if (e.number != 8007) {
            alert(e + " : " + e.line);
        } else {
            app.activeDocument.activeHistoryState = app.activeDocument.historyStates[historyStateNow];
            app.activeDocument.suspendHistory(historyState + " [cancelled]", "");
            app.activeDocument.activeHistoryState = app.activeDocument.historyStates[historyStateNow];
        }
    }
}

function Name() {
    if (typeof jamEngine !== "object") {
        var jamEngine = {};

        function() {
            function putInReference(ref, containers) {
                if (containers.constructor === Array) {
                    var count = containers.length;
                    for (var i = 0; i = 0; index--) {
                        var stringIdStr = stringIdStrs[index];
                        if (!(app.charIDToTypeID(charIdStr.substring(1, 5)) === app.stringIDToTypeID(stringIdStr))) {
                            stringIdStrs.splice(index, 1);
                        }
                    }
                    if (stringIdStrs.length             
关注
打赏
1665481431
查看更多评论
0.2493s