chore(plugins): 同步标注插件 1.20.5(反白公式修正)
Verify (Gitea) / gate (build · unit · facts) (push) Successful in 3m11s
Verify (Gitea) / gate (build · unit · facts) (push) Successful in 3m11s
This commit is contained in:
1 parent
aff77cef75
commit
13a34073bd
2 files changed
+22
-8
No files matched your search
+3
-3
@@ -13,9 +13,9 @@
|
||||
},
|
||||
{
|
||||
"id": "image-annotate",
|
||||
"file": "plugin-image-annotate.10f2df918936.js",
|
||||
"version": "1.20.4",
|
||||
"integrity": "sha256-EPLfkYk2D1wgqeRslEy3lJs0ER3CmEyekS2FkP7BcaE="
|
||||
"file": "plugin-image-annotate.2a8b070e9150.js",
|
||||
"version": "1.20.5",
|
||||
"integrity": "sha256-KosHDpFQs910KPsW1G91hhLX58Xh9oWcvyb8tbmYqnM="
|
||||
},
|
||||
{
|
||||
"id": "image-vectorize",
|
||||
|
||||
+19
-5
@@ -9,7 +9,7 @@
|
||||
var __IWB_ANNOTATE_MANIFEST__ = {
|
||||
id: 'image-annotate',
|
||||
name: '标注 / 修图',
|
||||
version: '1.20.4',
|
||||
version: '1.20.5',
|
||||
apiVersion: 1,
|
||||
capabilities: ['commands', 'nodeActions', 'canvas', 'canvasWrite'],
|
||||
settings: {
|
||||
@@ -3918,8 +3918,12 @@ var __IWB_ANNOTATE_MANIFEST__ = {
|
||||
filterCanvas(canvas, "invert(" + k + ")");
|
||||
return;
|
||||
}
|
||||
const okInv = mapPixels(canvas, (r, g, b) => [clamp255(255 - (255 - r) * k), clamp255(255 - (255 - g) * k), clamp255(255 - (255 - b) * k)]);
|
||||
if (!okInv) blendFallback(canvas, "invert");
|
||||
const okInv = mapPixels(canvas, (r, g, b) => [
|
||||
clamp255(r + (255 - 2 * r) * k),
|
||||
clamp255(g + (255 - 2 * g) * k),
|
||||
clamp255(b + (255 - 2 * b) * k)
|
||||
]);
|
||||
if (!okInv) blendFallback(canvas, "invert", k);
|
||||
}
|
||||
},
|
||||
gray: {
|
||||
@@ -3942,7 +3946,7 @@ var __IWB_ANNOTATE_MANIFEST__ = {
|
||||
const y = luma(r, g, b);
|
||||
return [clamp255(r + (y - r) * k), clamp255(g + (y - g) * k), clamp255(b + (y - b) * k)];
|
||||
});
|
||||
if (!okGray) blendFallback(canvas, "gray");
|
||||
if (!okGray) blendFallback(canvas, "gray", k);
|
||||
}
|
||||
},
|
||||
boost: {
|
||||
@@ -4079,8 +4083,13 @@ var __IWB_ANNOTATE_MANIFEST__ = {
|
||||
ctx.putImageData(img, 0, 0);
|
||||
return true;
|
||||
}
|
||||
function blendFallback(canvas, mode) {
|
||||
function blendFallback(canvas, mode, strength) {
|
||||
const k = typeof strength === "number" ? Math.max(0, Math.min(1, strength)) : 1;
|
||||
const ctx = canvas.getContext("2d");
|
||||
const copy = document.createElement("canvas");
|
||||
copy.width = canvas.width;
|
||||
copy.height = canvas.height;
|
||||
copy.getContext("2d").drawImage(canvas, 0, 0);
|
||||
ctx.save();
|
||||
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
||||
ctx.globalAlpha = 1;
|
||||
@@ -4092,6 +4101,11 @@ var __IWB_ANNOTATE_MANIFEST__ = {
|
||||
ctx.fillStyle = "#808080";
|
||||
}
|
||||
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
||||
if (k < 1) {
|
||||
ctx.globalCompositeOperation = "source-over";
|
||||
ctx.globalAlpha = 1 - k;
|
||||
ctx.drawImage(copy, 0, 0);
|
||||
}
|
||||
ctx.restore();
|
||||
}
|
||||
function luma(r, g, b) {
|
||||
Reference in new issue
Block a user