-
-
Save monjudoh/1465693 to your computer and use it in GitHub Desktop.
canvas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<body> | |
<canvas id="test" width="320" height="320"></canvas> | |
<script type="text/javascript"> | |
(function() { | |
var proto = document.createElement('canvas').getContext('2d').constructor.prototype; | |
var x = proto.fillText; | |
proto.fillText = function fillText(text) { | |
if (proto.fillText !== fillText) { | |
proto.fillText = fillText; | |
} | |
return x.apply(this, arguments); | |
}; | |
})(); | |
</script> | |
<script type="text/javascript"> | |
var c = document.getElementById('test'); | |
var ctx = c.getContext('2d'); | |
ctx.font = "20px Sans-Serif"; | |
ctx.fillStyle = 'rgb(0,0,0)'; | |
ctx.fillText("test2", 0, 20, 100); | |
ctx.fill(); | |
</script> | |
<script type="text/javascript"> | |
(function() { | |
var proto = document.createElement('canvas').getContext('2d').constructor.prototype; | |
var x = proto.fillText; | |
proto.fillText = function(text) { | |
console.log(text); | |
return x.apply(this, arguments); | |
}; | |
})(); | |
</script> | |
<script type="text/javascript"> | |
var c = document.getElementById('test'); | |
var ctx = c.getContext('2d'); | |
ctx.font = "20px Sans-Serif"; | |
ctx.fillStyle = 'rgb(0,0,0)'; | |
ctx.fillText("test3", 0, 20, 100); | |
ctx.fill(); | |
</script> | |
<script type="text/javascript"> | |
var c = document.getElementById('test'); | |
var ctx = c.getContext('2d'); | |
ctx.font = "20px Sans-Serif"; | |
ctx.fillStyle = 'rgb(0,0,0)'; | |
ctx.fillText("test4", 0, 20, 100); | |
ctx.fill(); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment