赞
踩
<html>
<script>
function watermark(str){
var img = document.getElementById("img");
var canvas=document.getElementById("cvs");
var ctx=canvas.getContext("2d");
ctx.drawImage(img,0,0);
ctx.font="20px microsoft yahei";
ctx.fillStyle = "rgba(255,255,255,0.5)";
ctx.fillText(str,100,100);
}
</script>
<canvas id="cvs" width="1000" height="500" >
Your browser does not support the HTML5 canvas tag.
</canvas>
<image id="img" src="test.png" > </image>
<button onclick="watermark('Hello world')">add watermark</button>
</html>

Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。