Accept Merge Request #162: (hyc -> master)
Merge Request: 【修改】增加ps蒙版考点 Created By: @华允传 Accepted By: @华允传 URL: https://g-iswv8783.coding.net/p/education/d/ExamLocalhost/git/merge/162?initial=true
This commit is contained in:
531
checkPSD.jsx
531
checkPSD.jsx
@@ -176,7 +176,13 @@ function processLayers(layers, resultArray) {
|
||||
if (filterInfo && !isEmptyObject(filterInfo)) {
|
||||
info["滤镜信息"] = filterInfo;
|
||||
}
|
||||
|
||||
//蒙版
|
||||
//蒙版操作 执行动作 创建 图层蒙版、 矢量蒙版、 剪切蒙版
|
||||
// 🔹 蒙版
|
||||
var maskInfo = getMaskInfo(layer);
|
||||
if (maskInfo && !isEmptyObject(maskInfo)) {
|
||||
info["蒙版类型"] = maskInfo;
|
||||
}
|
||||
|
||||
// 选中当前图层为智能对象后
|
||||
var soLayer = app.activeDocument.activeLayer;
|
||||
@@ -441,92 +447,132 @@ function countSmartObjects(doc) {
|
||||
return count;
|
||||
}
|
||||
|
||||
// 读取文字图层的变形属性
|
||||
// 读取文字图层的变形属性(分开返回属性并汉化样式)
|
||||
function getWarpTextProps() {
|
||||
try {
|
||||
var ref = new ActionReference();
|
||||
ref.putEnumerated(charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt")); // 当前图层
|
||||
var desc = executeActionGet(ref);
|
||||
var ref = new ActionReference();
|
||||
ref.putEnumerated(charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt"));
|
||||
var desc = executeActionGet(ref);
|
||||
|
||||
if (desc.hasKey(stringIDToTypeID("textKey"))) {
|
||||
var textDesc = desc.getObjectValue(stringIDToTypeID("textKey"));
|
||||
if (!desc.hasKey(stringIDToTypeID("textKey"))) return null;
|
||||
|
||||
if (textDesc.hasKey(stringIDToTypeID("warp"))) {
|
||||
var warpDesc = textDesc.getObjectValue(stringIDToTypeID("warp"));
|
||||
var textDesc = desc.getObjectValue(stringIDToTypeID("textKey"));
|
||||
if (!textDesc.hasKey(stringIDToTypeID("warp"))) return null;
|
||||
|
||||
// 获取英文样式
|
||||
var warpStyleEn = warpDesc.hasKey(stringIDToTypeID("warpStyle"))
|
||||
? typeIDToStringID(warpDesc.getEnumerationValue(stringIDToTypeID("warpStyle")))
|
||||
: "none";
|
||||
var warpDesc = textDesc.getObjectValue(stringIDToTypeID("warp"));
|
||||
|
||||
// 样式汉化映射
|
||||
var warpStyleMap = {
|
||||
"warpNone": "无",
|
||||
"warpArc": "弧形",
|
||||
"warpArcLower": "下弧形",
|
||||
"warpArcUpper": "上弧形",
|
||||
"warpArch": "拱形",
|
||||
"warpBulge": "凸出",
|
||||
"warpShellLower": "下壳形",
|
||||
"warpShellUpper": "上壳形",
|
||||
"warpFlag": "旗帜",
|
||||
"warpWave": "波浪",
|
||||
"warpFish": "鱼形",
|
||||
"warpRise": "上升",
|
||||
"warpFisheye": "鱼眼",
|
||||
"warpInflate": "膨胀",
|
||||
"warpSqueeze": "挤压",
|
||||
"warpTwist": "扭曲"
|
||||
};
|
||||
// 样式汉化映射
|
||||
var warpStyleMap = {
|
||||
"warpNone":"无","warpArc":"弧形","warpArcLower":"下弧形","warpArcUpper":"上弧形",
|
||||
"warpArch":"拱形","warpBulge":"凸出","warpShellLower":"下壳形","warpShellUpper":"上壳形",
|
||||
"warpFlag":"旗帜","warpWave":"波浪","warpFish":"鱼形","warpRise":"上升",
|
||||
"warpFisheye":"鱼眼","warpInflate":"膨胀","warpSqueeze":"挤压","warpTwist":"扭曲"
|
||||
};
|
||||
var warpStyleEn = warpDesc.hasKey(stringIDToTypeID("warpStyle")) ? typeIDToStringID(warpDesc.getEnumerationValue(stringIDToTypeID("warpStyle"))) : "warpNone";
|
||||
var warpStyleCn = warpStyleMap[warpStyleEn] || warpStyleEn;
|
||||
|
||||
// 汉化样式
|
||||
var warpStyleCn = warpStyleMap[warpStyleEn] || warpStyleEn;
|
||||
var warpBend = warpDesc.hasKey(stringIDToTypeID("warpValue")) ? warpDesc.getDouble(stringIDToTypeID("warpValue")) + "%" : "0%";
|
||||
|
||||
var warpHorizontal = warpDesc.hasKey(stringIDToTypeID("warpValue"))
|
||||
? warpDesc.getDouble(stringIDToTypeID("warpValue")) + "%"
|
||||
: "0%";
|
||||
|
||||
var warpVertical = warpDesc.hasKey(stringIDToTypeID("warpPerspective"))
|
||||
? warpDesc.getDouble(stringIDToTypeID("warpPerspective")) + "%"
|
||||
: "0%";
|
||||
|
||||
var warpEnabled = warpDesc.hasKey(stringIDToTypeID("warpFlag"))
|
||||
? warpDesc.getBoolean(stringIDToTypeID("warpFlag"))
|
||||
: false;
|
||||
|
||||
var result = {};
|
||||
|
||||
if (warpStyleCn !== "无") {
|
||||
result["样式"] = warpStyleCn;
|
||||
result["水平扭曲"] = warpHorizontal;
|
||||
result["垂直扭曲"] = warpVertical;
|
||||
}
|
||||
|
||||
if (warpEnabled === true) {
|
||||
result["是否变形"] = true;
|
||||
}
|
||||
|
||||
return result;
|
||||
} else {
|
||||
return { "提示": "该文字图层没有使用变形文字" };
|
||||
}
|
||||
var horizontalKeys = ["horizontalDistortion", "horizontalDistortionValue","warpPerspective"];
|
||||
var warpHorizontal = "0%";
|
||||
for (var i=0;i<horizontalKeys.length;i++) {
|
||||
if (warpDesc.hasKey(stringIDToTypeID(horizontalKeys[i]))) {
|
||||
warpHorizontal = warpDesc.getDouble(stringIDToTypeID(horizontalKeys[i])) + "%";
|
||||
break;
|
||||
}
|
||||
} catch (e) {
|
||||
// alert("读取变形文字属性时出错: " + e.message);
|
||||
}
|
||||
|
||||
return null;
|
||||
var verticalKeys = ["verticalDistortion", "verticalDistortionValue","warpPerspectiveOther"];
|
||||
var warpVertical = "0%";
|
||||
for (var i=0;i<verticalKeys.length;i++) {
|
||||
if (warpDesc.hasKey(stringIDToTypeID(verticalKeys[i]))) {
|
||||
warpVertical = warpDesc.getDouble(stringIDToTypeID(verticalKeys[i])) + "%";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 如果都是默认值,说明没有实际变形,返回 null
|
||||
if (warpStyleCn === "无" && warpBend === "0%" && warpHorizontal === "0%" && warpVertical === "0%") {
|
||||
return null;
|
||||
}
|
||||
|
||||
return {
|
||||
"样式": warpStyleCn,
|
||||
"弯曲": warpBend,
|
||||
"水平扭曲": warpHorizontal,
|
||||
"垂直扭曲": warpVertical
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
function dumpDescriptor(desc, indent) {
|
||||
indent = indent || "";
|
||||
for (var i = 0; i < desc.count; i++) {
|
||||
var key = desc.getKey(i);
|
||||
var type = desc.getType(key);
|
||||
var keyName = typeIDToStringID(key);
|
||||
$.writeln(indent + keyName + " (" + type + ")");
|
||||
try {
|
||||
if (type == DescValueType.OBJECTTYPE) {
|
||||
dumpDescriptor(desc.getObjectValue(key), indent + " ");
|
||||
} else if (type == DescValueType.ENUMERATEDTYPE) {
|
||||
$.writeln(indent + " value: " + typeIDToStringID(desc.getEnumerationValue(key)));
|
||||
} else if (type == DescValueType.BOOLEANTYPE) {
|
||||
$.writeln(indent + " value: " + desc.getBoolean(key));
|
||||
} else if (type == DescValueType.DOUBLETYPE) {
|
||||
$.writeln(indent + " value: " + desc.getDouble(key));
|
||||
} else if (type == DescValueType.UNITDOUBLE) {
|
||||
$.writeln(indent + " value: " + desc.getUnitDoubleValue(key));
|
||||
} else if (type == DescValueType.STRINGTYPE) {
|
||||
$.writeln(indent + " value: " + desc.getString(key));
|
||||
} else if (type == DescValueType.INTEGERTYPE) {
|
||||
$.writeln(indent + " value: " + desc.getInteger(key));
|
||||
}
|
||||
} catch(e) {
|
||||
$.writeln(indent + " (无法读取: " + e + ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function dumpDescriptor(desc, indent) {
|
||||
indent = indent || "";
|
||||
for (var i = 0; i < desc.count; i++) {
|
||||
var key = desc.getKey(i);
|
||||
var type = desc.getType(key);
|
||||
var keyName = typeIDToStringID(key);
|
||||
$.writeln(indent + keyName + " (" + type + ")");
|
||||
try {
|
||||
if (type == DescValueType.OBJECTTYPE) {
|
||||
dumpDescriptor(desc.getObjectValue(key), indent + " ");
|
||||
} else if (type == DescValueType.ENUMERATEDTYPE) {
|
||||
$.writeln(indent + " value: " + typeIDToStringID(desc.getEnumerationValue(key)));
|
||||
} else if (type == DescValueType.BOOLEANTYPE) {
|
||||
$.writeln(indent + " value: " + desc.getBoolean(key));
|
||||
} else if (type == DescValueType.DOUBLETYPE) {
|
||||
$.writeln(indent + " value: " + desc.getDouble(key));
|
||||
} else if (type == DescValueType.UNITDOUBLE) {
|
||||
$.writeln(indent + " value: " + desc.getUnitDoubleValue(key));
|
||||
} else if (type == DescValueType.STRINGTYPE) {
|
||||
$.writeln(indent + " value: " + desc.getString(key));
|
||||
} else if (type == DescValueType.INTEGERTYPE) {
|
||||
$.writeln(indent + " value: " + desc.getInteger(key));
|
||||
}
|
||||
} catch(e) {
|
||||
$.writeln(indent + " (无法读取: " + e + ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function getLayerStyles(layer) {
|
||||
var styles = {};
|
||||
|
||||
// ---- 激活图层 ----
|
||||
app.activeDocument.activeLayer = layer;
|
||||
|
||||
|
||||
// ---- 获取 ActionDescriptor ----
|
||||
var desc;
|
||||
try {
|
||||
@@ -552,6 +598,11 @@ function getLayerStyles(layer) {
|
||||
}
|
||||
try {
|
||||
var effects = desc.getObjectValue(stringIDToTypeID("layerEffects"));
|
||||
// 用法:
|
||||
if (effects.hasKey(stringIDToTypeID("bevelEmboss"))) {
|
||||
var bevel = effects.getObjectValue(stringIDToTypeID("bevelEmboss"));
|
||||
dumpDescriptor(bevel, ">> ");
|
||||
}
|
||||
|
||||
// ---- 描边 ----
|
||||
if (effects.hasKey(stringIDToTypeID("frameFX"))) {
|
||||
@@ -615,55 +666,224 @@ function getLayerStyles(layer) {
|
||||
if (bevel.hasKey(stringIDToTypeID("enabled"))) {
|
||||
var enabled = bevel.getBoolean(stringIDToTypeID("enabled"));
|
||||
if (enabled) {
|
||||
styles["斜面_样式"] = typeIDToStringID(bevel.getEnumerationValue(stringIDToTypeID("style")));
|
||||
styles["斜面_方法"] = typeIDToStringID(bevel.getEnumerationValue(stringIDToTypeID("technique")));
|
||||
styles["斜面_深度"] = bevel.getDouble(stringIDToTypeID("strength")) + "%";
|
||||
styles["斜面_方向"] = typeIDToStringID(bevel.getEnumerationValue(stringIDToTypeID("direction")));
|
||||
styles["斜面_大小"] = bevel.getUnitDoubleValue(stringIDToTypeID("size")) + " 像素";
|
||||
styles["斜面_软化"] = bevel.getUnitDoubleValue(stringIDToTypeID("soften")) + " 像素";
|
||||
styles["斜面_使用全局光"] = bevel.getBoolean(stringIDToTypeID("useGlobalAngle"));
|
||||
styles["斜面_角度"] = bevel.getInteger(stringIDToTypeID("localLightingAngle")) + "°";
|
||||
var styleID = null;
|
||||
if (bevel.hasKey(stringIDToTypeID("style"))) styleID = bevel.getEnumerationValue(stringIDToTypeID("style"));
|
||||
else if (bevel.hasKey(stringIDToTypeID("bevelStyle"))) styleID = bevel.getEnumerationValue(stringIDToTypeID("bevelStyle"));
|
||||
|
||||
if (bevel.hasKey(stringIDToTypeID("highlightColor"))) {
|
||||
var color = bevel.getObjectValue(stringIDToTypeID("highlightColor"));
|
||||
styles["斜面_高光颜色"] = colorToHex(color);
|
||||
|
||||
else if (bevel.hasKey(stringIDToTypeID("bevelTechnique"))) techniqueID = bevel.getEnumerationValue(stringIDToTypeID("bevelTechnique"));
|
||||
|
||||
if (styleID) styles["斜面和浮雕_样式"] = getBevelStyleName(typeIDToStringID(styleID));
|
||||
|
||||
// 读取斜面和浮雕方法
|
||||
var techniqueID = null;
|
||||
if (bevel.hasKey(stringIDToTypeID("technique"))) {
|
||||
techniqueID = bevel.getEnumerationValue(stringIDToTypeID("technique"));
|
||||
} else if (bevel.hasKey(stringIDToTypeID("bevelTechnique"))) {
|
||||
techniqueID = bevel.getEnumerationValue(stringIDToTypeID("bevelTechnique"));
|
||||
}
|
||||
|
||||
if (techniqueID) {
|
||||
styles["斜面和浮雕_方法"] = getBevelTechniqueName(typeIDToStringID(techniqueID));
|
||||
} else {
|
||||
styles["斜面和浮雕_方法"] = "未知";
|
||||
}
|
||||
|
||||
// 深度
|
||||
if (bevel.hasKey(stringIDToTypeID("depth"))) {
|
||||
styles["斜面和浮雕_深度"] = Math.round(bevel.getDouble(stringIDToTypeID("depth")) * 100) + "%";
|
||||
} else if (bevel.hasKey(stringIDToTypeID("strengthRatio"))) {
|
||||
styles["斜面和浮雕_深度"] = Math.round(bevel.getUnitDoubleValue(stringIDToTypeID("strengthRatio"))) + "%";
|
||||
}
|
||||
|
||||
// 方向
|
||||
if (bevel.hasKey(stringIDToTypeID("direction")) || bevel.hasKey(stringIDToTypeID("bevelDirection"))) {
|
||||
var dir = bevel.hasKey(stringIDToTypeID("direction"))
|
||||
? typeIDToStringID(bevel.getEnumerationValue(stringIDToTypeID("direction")))
|
||||
: typeIDToStringID(bevel.getEnumerationValue(stringIDToTypeID("bevelDirection")));
|
||||
styles["斜面和浮雕_方向"] = (dir === "up") ? "向上" : "向下";
|
||||
}
|
||||
|
||||
// 大小
|
||||
if (bevel.hasKey(stringIDToTypeID("size"))) {
|
||||
styles["斜面和浮雕_大小"] = bevel.getUnitDoubleValue(stringIDToTypeID("size")) + " 像素";
|
||||
} else if (bevel.hasKey(stringIDToTypeID("blur"))) {
|
||||
styles["斜面和浮雕_大小"] = bevel.getUnitDoubleValue(stringIDToTypeID("blur")) + " 像素";
|
||||
}
|
||||
|
||||
// 软化
|
||||
if (bevel.hasKey(stringIDToTypeID("soften")) || bevel.hasKey(stringIDToTypeID("softness"))) {
|
||||
styles["斜面和浮雕_软化"] = bevel.hasKey(stringIDToTypeID("soften"))
|
||||
? bevel.getUnitDoubleValue(stringIDToTypeID("soften")) + " 像素"
|
||||
: bevel.getUnitDoubleValue(stringIDToTypeID("softness")) + " 像素";
|
||||
}
|
||||
|
||||
// 使用全局光
|
||||
if (bevel.hasKey(stringIDToTypeID("useGlobalAngle"))) {
|
||||
styles["斜面和浮雕_使用全局光"] = bevel.getBoolean(stringIDToTypeID("useGlobalAngle")) ? "是" : "否";
|
||||
}
|
||||
|
||||
// 角度
|
||||
if (bevel.hasKey(stringIDToTypeID("localLightingAngle"))) {
|
||||
styles["斜面和浮雕_角度"] = bevel.getInteger(stringIDToTypeID("localLightingAngle")) + "°";
|
||||
}
|
||||
|
||||
// 高度
|
||||
if (bevel.hasKey(stringIDToTypeID("localLightingAltitude"))) {
|
||||
styles["斜面和浮雕_高度"] = bevel.getInteger(stringIDToTypeID("localLightingAltitude")) + "°";
|
||||
}
|
||||
|
||||
// 等高线
|
||||
if (bevel.hasKey(stringIDToTypeID("transparencyShape")) || bevel.hasKey(stringIDToTypeID("transferSpec"))) {
|
||||
var contour = bevel.hasKey(stringIDToTypeID("transparencyShape"))
|
||||
? bevel.getObjectValue(stringIDToTypeID("transparencyShape"))
|
||||
: bevel.getObjectValue(stringIDToTypeID("transferSpec"));
|
||||
styles["斜面和浮雕_等高线"] = contour.hasKey(stringIDToTypeID("name")) ? contour.getString(stringIDToTypeID("name")) : "未知";
|
||||
} else {
|
||||
styles["斜面和浮雕_等高线"] = "未知";
|
||||
}
|
||||
|
||||
|
||||
// 高光
|
||||
if (bevel.hasKey(stringIDToTypeID("highlightMode"))) {
|
||||
var mode = bevel.getEnumerationValue(stringIDToTypeID("highlightMode"));
|
||||
styles["斜面_高光模式"] = typeIDToStringID(mode);
|
||||
styles["斜面和浮雕_高光模式"] = getBlendModeName(bevel.getEnumerationValue(stringIDToTypeID("highlightMode")));
|
||||
}
|
||||
if (bevel.hasKey(stringIDToTypeID("highlightColor"))) {
|
||||
styles["斜面和浮雕_高光颜色"] = colorDescToHex(bevel.getObjectValue(stringIDToTypeID("highlightColor")));
|
||||
}
|
||||
if (bevel.hasKey(stringIDToTypeID("highlightOpacity"))) {
|
||||
styles["斜面和浮雕_高光不透明度"] = Math.round(bevel.getUnitDoubleValue(stringIDToTypeID("highlightOpacity"))) + "%";
|
||||
}
|
||||
|
||||
// 阴影
|
||||
if (bevel.hasKey(stringIDToTypeID("shadowMode"))) {
|
||||
styles["斜面和浮雕_阴影模式"] = getBlendModeName(bevel.getEnumerationValue(stringIDToTypeID("shadowMode")));
|
||||
}
|
||||
if (bevel.hasKey(stringIDToTypeID("shadowColor"))) {
|
||||
styles["斜面和浮雕_阴影颜色"] = colorDescToHex(bevel.getObjectValue(stringIDToTypeID("shadowColor")));
|
||||
}
|
||||
if (bevel.hasKey(stringIDToTypeID("shadowOpacity"))) {
|
||||
styles["斜面和浮雕_阴影不透明度"] = Math.round(bevel.getUnitDoubleValue(stringIDToTypeID("shadowOpacity"))) + "%";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ---- 外发光 ----
|
||||
if (effects.hasKey(stringIDToTypeID("outerGlow"))) {
|
||||
var outerGlow = effects.getObjectValue(stringIDToTypeID("outerGlow"));
|
||||
if (outerGlow.hasKey(stringIDToTypeID("enabled"))) {
|
||||
var enabled = outerGlow.getBoolean(stringIDToTypeID("enabled"));
|
||||
if (styles["外发光_启用"]) {
|
||||
if (enabled) {
|
||||
|
||||
// 不透明度
|
||||
if (outerGlow.hasKey(stringIDToTypeID("opacity"))) {
|
||||
styles["外发光_不透明度"] = Math.round(outerGlow.getUnitDoubleValue(stringIDToTypeID("opacity"))) + "%";
|
||||
}
|
||||
if (outerGlow.hasKey(stringIDToTypeID("color"))) {
|
||||
styles["外发光_颜色"] = colorDescToHex(outerGlow.getObjectValue(stringIDToTypeID("color")));
|
||||
}
|
||||
|
||||
// 方法(精确 / 平滑)
|
||||
if (outerGlow.hasKey(stringIDToTypeID("glowTechnique"))) {
|
||||
var techEnum = outerGlow.getEnumerationValue(stringIDToTypeID("glowTechnique"));
|
||||
styles["外发光_图素方法"] = getOuterGlowTechniqueName(typeIDToStringID(techEnum));
|
||||
}
|
||||
// 颜色(单色模式)
|
||||
if (outerGlow.hasKey(stringIDToTypeID("color"))) {
|
||||
styles["外发光_颜色"] = colorDescToHex(outerGlow.getObjectValue(stringIDToTypeID("color")));
|
||||
}
|
||||
// 大小
|
||||
if (outerGlow.hasKey(stringIDToTypeID("blur"))) {
|
||||
styles["外发光_大小"] = outerGlow.getUnitDoubleValue(stringIDToTypeID("blur")) + " 像素";
|
||||
}
|
||||
|
||||
// 阻塞
|
||||
if (outerGlow.hasKey(stringIDToTypeID("chokeMatte"))) {
|
||||
styles["外发光_阻塞"] = outerGlow.getUnitDoubleValue(stringIDToTypeID("chokeMatte")) + " 像素";
|
||||
}
|
||||
|
||||
// 混合模式
|
||||
if (outerGlow.hasKey(stringIDToTypeID("mode"))) {
|
||||
styles["外发光_混合模式"] = getBlendModeName(outerGlow.getEnumerationValue(stringIDToTypeID("mode")));
|
||||
}
|
||||
|
||||
// ---- 渐变信息 ----
|
||||
if (outerGlow.hasKey(stringIDToTypeID("gradient"))) {
|
||||
var gradient = outerGlow.getObjectValue(stringIDToTypeID("gradient"));
|
||||
|
||||
// 内部渐变名 ID
|
||||
var gradientID = gradient.getString(stringIDToTypeID("name"));
|
||||
|
||||
// 常用渐变 ID -> 中文名映射表
|
||||
var gradientNameMap = {
|
||||
// 2025 版本直接英文名
|
||||
"Chrome": "铬黄渐变",
|
||||
"Black, White": "黑白渐变",
|
||||
"Blue, Red": "蓝红渐变",
|
||||
"Gold": "金色渐变",
|
||||
"Silver": "银色渐变",
|
||||
"Copper": "铜色渐变",
|
||||
"Red, Yellow": "红黄渐变",
|
||||
"Yellow, Green": "黄绿渐变",
|
||||
"Green, Cyan": "绿青渐变",
|
||||
"Cyan, Blue": "青蓝渐变",
|
||||
"Magenta, Purple": "品紫渐变",
|
||||
"Orange, Red": "橙红渐变",
|
||||
"Blue, Purple": "蓝紫渐变",
|
||||
"Foreground to Background": "前景到背景渐变",
|
||||
"Black, Foreground": "黑到前景色渐变",
|
||||
"Foreground to Transparent": "前景到透明渐变",
|
||||
"Neutral Density": "中性密度渐变",
|
||||
"Noise": "噪点渐变",
|
||||
"Blue, Green": "蓝到绿渐变",
|
||||
"Green, Yellow": "绿到黄渐变",
|
||||
"Red, Blue": "红到蓝渐变",
|
||||
"Yellow, Orange": "黄到橙渐变",
|
||||
"Purple, Red": "紫到红渐变",
|
||||
"White, Black": "白到黑渐变",
|
||||
|
||||
// CS6 及旧版 $$$ ID 格式
|
||||
"$$$/DefaultGradient/Chrome=Chrome": "铬黄渐变",
|
||||
"$$$/DefaultGradient/Black, White=Black, White": "黑白渐变",
|
||||
"$$$/DefaultGradient/Blue, Red=Blue, Red": "蓝红渐变",
|
||||
"$$$/DefaultGradient/Gold=Gold": "金色渐变",
|
||||
"$$$/DefaultGradient/Silver=Silver": "银色渐变",
|
||||
"$$$/DefaultGradient/Copper=Copper": "铜色渐变",
|
||||
"$$$/DefaultGradient/Red, Yellow=Red, Yellow": "红黄渐变",
|
||||
"$$$/DefaultGradient/Yellow, Green=Yellow, Green": "黄绿渐变",
|
||||
"$$$/DefaultGradient/Green, Cyan=Green, Cyan": "绿青渐变",
|
||||
"$$$/DefaultGradient/Cyan, Blue=Cyan, Blue": "青蓝渐变",
|
||||
"$$$/DefaultGradient/Magenta, Purple=Magenta, Purple": "品紫渐变",
|
||||
"$$$/DefaultGradient/Orange, Red=Orange, Red": "橙红渐变",
|
||||
"$$$/DefaultGradient/Blue, Purple=Blue, Purple": "蓝紫渐变",
|
||||
"$$$/DefaultGradient/Foreground to Background=前景到背景渐变": "前景到背景渐变",
|
||||
"$$$/DefaultGradient/Black, Foreground=黑到前景色渐变": "黑到前景色渐变",
|
||||
"$$$/DefaultGradient/Foreground to Transparent=前景到透明渐变": "前景到透明渐变",
|
||||
"$$$/DefaultGradient/Neutral Density=Neutral Density": "中性密度渐变",
|
||||
"$$$/DefaultGradient/Noise=Noise": "噪点渐变"
|
||||
};
|
||||
|
||||
|
||||
|
||||
styles["外发光_渐变名称"] = gradientNameMap[gradientID] || gradientID;
|
||||
|
||||
// 颜色 stop
|
||||
if (gradient.hasKey(stringIDToTypeID("colors"))) {
|
||||
var colorsList = gradient.getList(stringIDToTypeID("colors"));
|
||||
var colorHexArr = [];
|
||||
for (var i = 0; i < colorsList.count; i++) {
|
||||
var colorObj = colorsList.getObjectValue(i).getObjectValue(stringIDToTypeID("color"));
|
||||
colorHexArr.push(colorDescToHex(colorObj));
|
||||
}
|
||||
styles["外发光_渐变色"] = colorHexArr;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ---- 光泽(Satin) ----
|
||||
if (effects.hasKey(stringIDToTypeID("satin"))) {
|
||||
var satin = effects.getObjectValue(stringIDToTypeID("satin"));
|
||||
@@ -696,11 +916,14 @@ function getLayerStyles(layer) {
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 辅助函数:描边位置
|
||||
function getStrokePositionName(posStringID) {
|
||||
switch(posStringID) {
|
||||
@@ -722,15 +945,8 @@ function getBevelStyleName(value) {
|
||||
default: return "未知";
|
||||
}
|
||||
}
|
||||
// 斜面和浮雕 方法
|
||||
function getBevelTechniqueName(value) {
|
||||
switch (value) {
|
||||
case stringIDToTypeID("smooth"): return "平滑";
|
||||
case stringIDToTypeID("chiselHard"): return "雕刻清晰";
|
||||
case stringIDToTypeID("chiselSoft"): return "雕刻柔和";
|
||||
default: return "未知";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 斜面和浮雕 方向
|
||||
function getBevelDirectionName(value) {
|
||||
switch (value) {
|
||||
@@ -742,27 +958,42 @@ function getBevelDirectionName(value) {
|
||||
|
||||
// 图层混合模式
|
||||
function getBlendModeName(value) {
|
||||
switch (value) {
|
||||
case stringIDToTypeID("normal"): return "正常";
|
||||
case stringIDToTypeID("multiply"): return "正片叠底";
|
||||
case stringIDToTypeID("screen"): return "滤色";
|
||||
case stringIDToTypeID("overlay"): return "叠加";
|
||||
case stringIDToTypeID("softLight"): return "柔光";
|
||||
case stringIDToTypeID("linearLight"): return "亮光";
|
||||
case stringIDToTypeID("hardLight"): return "强光";
|
||||
case stringIDToTypeID("vividLight"): return "亮光";
|
||||
case stringIDToTypeID("pinLight"): return "点光";
|
||||
case stringIDToTypeID("difference"): return "差值";
|
||||
case stringIDToTypeID("colorBurn"): return "颜色加深";
|
||||
case stringIDToTypeID("colorDodge"): return "颜色减淡";
|
||||
case stringIDToTypeID("lighten"): return "变亮";
|
||||
case stringIDToTypeID("darken"): return "变暗";
|
||||
case stringIDToTypeID("dissolve"): return "溶解";
|
||||
case stringIDToTypeID("hue"): return "色相";
|
||||
case stringIDToTypeID("saturation"): return "饱和度";
|
||||
case stringIDToTypeID("color"): return "颜色";
|
||||
case stringIDToTypeID("luminosity"): return "明度";
|
||||
default: return "其他";
|
||||
var map = {
|
||||
"normal": "正常",
|
||||
"multiply": "正片叠底",
|
||||
"screen": "滤色",
|
||||
"overlay": "叠加",
|
||||
"softLight": "柔光",
|
||||
"hardLight": "强光",
|
||||
"vividLight": "亮光",
|
||||
"linearLight": "线性加深/减淡",
|
||||
"pinLight": "点光",
|
||||
"difference": "差值",
|
||||
"exclusion": "排除",
|
||||
"colorBurn": "颜色加深",
|
||||
"linearBurn": "线性加深",
|
||||
"darkerColor": "深色",
|
||||
"colorDodge": "颜色减淡",
|
||||
"linearDodge": "线性减淡",
|
||||
"lighterColor": "浅色",
|
||||
"lighten": "变亮",
|
||||
"darken": "变暗",
|
||||
"dissolve": "溶解",
|
||||
"hue": "色相",
|
||||
"saturation": "饱和度",
|
||||
"color": "颜色",
|
||||
"luminosity": "明度",
|
||||
"subtract": "减去",
|
||||
"blendSubtraction": "减去", // 2025 新增
|
||||
"divide": "划分"
|
||||
};
|
||||
|
||||
try {
|
||||
// 可能是 stringID
|
||||
var strID = (typeof value === "number") ? typeIDToStringID(value) : value;
|
||||
return map[strID] || strID;
|
||||
} catch(e) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -919,6 +1150,8 @@ function hasOwnProperties(obj) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function isEmptyObject(obj) {
|
||||
for (var key in obj) {
|
||||
if (obj.hasOwnProperty(key)) return false;
|
||||
@@ -926,3 +1159,73 @@ function isEmptyObject(obj) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ======================
|
||||
// 获取蒙版信息
|
||||
// ======================
|
||||
function getMaskInfo(layer) {
|
||||
var maskInfo = {};
|
||||
|
||||
try {
|
||||
// 图层蒙版
|
||||
if (hasLayerMask(layer)) {
|
||||
maskInfo["图层蒙版"] = "存在";
|
||||
}
|
||||
|
||||
// 矢量蒙版
|
||||
if (hasVectorMask(layer)) {
|
||||
maskInfo["矢量蒙版"] = "存在";
|
||||
}
|
||||
|
||||
// 剪切蒙版
|
||||
if (layer.grouped) { // ExtendScript 属性,true 表示是剪切蒙版
|
||||
maskInfo["剪切蒙版"] = "存在";
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
maskInfo["错误"] = e.toString();
|
||||
}
|
||||
|
||||
return maskInfo;
|
||||
}
|
||||
|
||||
// ======================
|
||||
// 判断是否有图层蒙版
|
||||
// ======================
|
||||
function hasLayerMask(layer) {
|
||||
var ref = new ActionReference();
|
||||
ref.putEnumerated(charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt"));
|
||||
var desc = executeActionGet(ref);
|
||||
return desc.hasKey(stringIDToTypeID("hasUserMask")) && desc.getBoolean(stringIDToTypeID("hasUserMask"));
|
||||
}
|
||||
|
||||
// ======================
|
||||
// 判断是否有矢量蒙版
|
||||
// ======================
|
||||
function hasVectorMask(layer) {
|
||||
var ref = new ActionReference();
|
||||
ref.putEnumerated(charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt"));
|
||||
var desc = executeActionGet(ref);
|
||||
return desc.hasKey(stringIDToTypeID("hasVectorMask")) && desc.getBoolean(stringIDToTypeID("hasVectorMask"));
|
||||
}
|
||||
function getBevelStyleName(id) {
|
||||
var map = {
|
||||
"innerBevel": "内斜面",
|
||||
"outerBevel": "外斜面",
|
||||
"emboss": "浮雕",
|
||||
"pillowEmboss": "枕状浮雕"
|
||||
};
|
||||
return map[id] || "未知";
|
||||
}
|
||||
|
||||
function getBevelTechniqueName(id) {
|
||||
var map = {
|
||||
"smooth": "平滑",
|
||||
"softMatte": "平滑", // 别名
|
||||
"chiselSoft": "雕刻清晰",
|
||||
"preciseMatte": "雕刻清晰", // 别名
|
||||
"chiselHard": "雕刻深"
|
||||
};
|
||||
return map[id] || id || "未知";
|
||||
}
|
||||
|
||||
|
@@ -79,7 +79,7 @@ public class AutoForPsServiceImpl implements AutoForPsService {
|
||||
judgementStr += "<h4>试题编号:" + examQuestion.getQuNum() + "</h4>";
|
||||
judgementStr += "<h4>试题分数:" + Double.parseDouble(quScore) + "</h4>";
|
||||
judgementStr += "<h4>试题名称:" + name + "</h4>";
|
||||
judgementStr += "<p>✅ 开始QQ邮箱提判分</p>";
|
||||
judgementStr += "<p>✅ 开始PS判分</p>";
|
||||
SourceAndText wordpojo = psService.Judgement(Double.parseDouble(quScore), filePaths, wjFile.getPath(), examQuestion, judgementStr);
|
||||
score = score.add(new BigDecimal(wordpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
|
||||
judgementStr = wordpojo.getText();
|
||||
|
Reference in New Issue
Block a user