Text-auf-bild-schreiben-canvas.php


Quell Code


<span style="font-family: 'Lobster', cursive;">&nbsp;</span>
<canvas id=c width=500 height=500></canvas>
<script>
  

var ctx = document.getElementById('c').getContext('2d');
var kitty = new Image();
kitty.src = 'http://i954.photobucket.com/albums/ae30/rte148/891blog_keyboard_cat.gif';
kitty.onload = function(){
  ctx.drawImage(this, 0,0,this.width, this.height);
  ctx.font         = '68px Lobster';
  ctx.fillStyle = 'orangered';
  ctx.textBaseline = 'top';
  ctx.fillText  ('Keyboard Cat', 0, 270);
};

  
</script>