diff --git a/plugins/index.json b/plugins/index.json index c82289d..fedad1e 100644 --- a/plugins/index.json +++ b/plugins/index.json @@ -13,9 +13,9 @@ }, { "id": "image-annotate", - "file": "plugin-image-annotate.2a8b070e9150.js", - "version": "1.20.5", - "integrity": "sha256-KosHDpFQs910KPsW1G91hhLX58Xh9oWcvyb8tbmYqnM=" + "file": "plugin-image-annotate.7a865c7c353c.js", + "version": "1.20.6", + "integrity": "sha256-eoZcfDU8P7yqxVGorrWs0b9iTKJfEE25b85JPDCEsk8=" }, { "id": "image-vectorize", diff --git a/plugins/runtime/plugin-image-annotate.2a8b070e9150.js b/plugins/runtime/plugin-image-annotate.7a865c7c353c.js similarity index 99% rename from plugins/runtime/plugin-image-annotate.2a8b070e9150.js rename to plugins/runtime/plugin-image-annotate.7a865c7c353c.js index 8bc1a13..689a839 100644 --- a/plugins/runtime/plugin-image-annotate.2a8b070e9150.js +++ b/plugins/runtime/plugin-image-annotate.7a865c7c353c.js @@ -9,7 +9,7 @@ var __IWB_ANNOTATE_MANIFEST__ = { id: 'image-annotate', name: '标注 / 修图', - version: '1.20.5', + version: '1.20.6', apiVersion: 1, capabilities: ['commands', 'nodeActions', 'canvas', 'canvasWrite'], settings: { @@ -3901,29 +3901,16 @@ var __IWB_ANNOTATE_MANIFEST__ = { render: (canvas, v) => { if (v <= 0) return; const k = v / 100; - if (!FILTER_SUPPORTED) { - const bright = 1 + 0.4 * k, contrast = 1 + 0.25 * k, sat = 1 + 0.2 * k; - mapPixels(canvas, (r, g, b) => { - const y = luma(r, g, b); - const out = [r, g, b].map((c) => { - let v2 = y + (c - y) * sat; - v2 = (v2 - 128) * contrast + 128; - return clamp255(v2 * bright); - }); - return out; - }); - return; - } if (FILTER_SUPPORTED) { filterCanvas(canvas, "invert(" + k + ")"); return; } - const okInv = mapPixels(canvas, (r, g, b) => [ + const ok = 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); + if (!ok) blendFallback(canvas, "invert", k); } }, gray: { @@ -3961,7 +3948,20 @@ var __IWB_ANNOTATE_MANIFEST__ = { render: (canvas, v) => { if (v <= 0) return; const k = v / 100; - filterCanvas(canvas, "brightness(" + (1 + 0.4 * k).toFixed(3) + ") contrast(" + (1 + 0.25 * k).toFixed(3) + ") saturate(" + (1 + 0.2 * k).toFixed(3) + ")"); + if (FILTER_SUPPORTED) { + filterCanvas(canvas, "brightness(" + (1 + 0.4 * k).toFixed(3) + ") contrast(" + (1 + 0.25 * k).toFixed(3) + ") saturate(" + (1 + 0.2 * k).toFixed(3) + ")"); + return; + } + const bright = 1 + 0.4 * k, contrast = 1 + 0.25 * k, sat = 1 + 0.2 * k; + mapPixels(canvas, (r, g, b) => { + const y = luma(r, g, b); + const out = [r, g, b].map((c) => { + let v2 = y + (c - y) * sat; + v2 = (v2 - 128) * contrast + 128; + return clamp255(v2 * bright); + }); + return out; + }); } }, contrast: {