0
請幫我計算圖像的「流血」。計算圖像3mm出血動態
第一個問題:如何獲取動態圖像的尺寸?
第二個問題: Sombody知道什麼是流血計算?
我將圖像合併+流血指標.. (如果圖片是動態的,我需要的出血是動態的太...)
eg x-3=x, y-3=x
我有這樣的代碼,代表我想達到的目標。
HTML:
<canvas id="c"></canvas>
<br>
<div>
<button onclick="blue_square_2();return true;">Inner Square</button>
<button onclick="red_stroke_2();return true;">Outer Square</button>
</div>
JS:
var canvas = new fabric.StaticCanvas('c');
canvas.setBackgroundImage('img/24-18-0.jpg', canvas.renderAll.bind(canvas));
this.__canvases.push(canvas);
var c2 = document.getElementById("c");
var c2_context = c2.getContext("2d");
function blue_square_2() { //Green color square
canvas.add(new fabric.Rect({
left: 250,
top: 300,
fill: "",
stroke: "green",
strokeWidth: 11.34,
width: 468,
height: 568,
opacity: 0.7
}));
}
function red_stroke_2() { //Blue color edges
canvas.add(new fabric.Rect({
left: 250,
top: 300,
fill: "",
stroke: "blue",
strokeWidth: 11.34,
width: 489,
height: 589,
opacity: 0.7
}));
}