<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no" />
<title></title>
<script type="text/javascript" src="js/jquery.js" ></script>
<style>
@font-face {
font-family:"sor";
src:url('fonts/FZZBHFW.TTF');
}
@font-face {
font-family:"sy";
src:url('fonts/gangbixingshu.TTF');
}
body{margin: 0; padding: 0; font-family:"sy";}
#canvas{display: block; margin: 0 auto;}
</style>
</head>
<body>
<canvas id="canvas"></canvas>
</body>
<script type="text/javascript">
var canvas=document.getElementById("canvas");
var context=canvas.getContext("2d");
var image=new Image();
window.onload=function(){
canvas.width=800
canvas.height=800
image.src="img/1-5.jpg"
image.onload=function(){
context.drawImage(image,0,0)
// context.drawImage(image,600,200,400,400,200,200,400,400)
}
context.font = "Bold 20px Arial";
// 设置对齐方式
context.textAlign = "left";
// 设置填充颜色
context.fillStyle = "#008600";
// 设置字体内容,以及在画布上的位置
context.fillText("Hello!", 10, 50);
// 绘制空心字
context.strokeText("Hello!", 10, 100);
}
</script>
</html>
qq_SL_2
狂飙的蜗牛_1