生成水印

  作者:chrispy

addWaterMarker(Text,Id);function addWaterMarker(str,id){var can = document.createElement('canvas');var id = document.getElementById(id);id.appendChild(can);can.width=200;can.height=200;can.style.display='none';var cans = can

addWaterMarker(Text,Id);

function addWaterMarker(str,id){

var can = document.createElement('canvas');

var id = document.getElementById(id);

id.appendChild(can);

can.width=200;

can.height=200;

can.style.display='none';

var cans = can.getContext('2d');

cans.rotate(-20*Math.PI/180);

cans.font = "16px Microsoft JhengHei";

cans.fillStyle = "rgba(17, 17, 17, 0.50)";

cans.textAlign = 'left';

cans.textBaseline = 'Middle';

cans.fillText(str,0,90);

id.style.backgroundImage="url("+can.toDataURL("image/png")+")";

}


有用  |  无用

猜你喜欢