Debian Codegraph @

testcases/pattern.html

raw symbols SCIP
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>Pattern Test</title>
5 <style>
6
7 body {
8 text-align: center
9 }
10
11 </style>
12 <!--[if IE]><script src="../excanvas.js"></script><![endif]-->
13 <script>
14
15 var img;
16 function draw() {
17 var ctx = document.getElementById('c').getContext('2d');
18 var p = ctx.createPattern(img, 'repeat');
19 ctx.translate(50, 50);
20 ctx.fillStyle = p;
21 ctx.fillRect(0, 0, 300, 300);
22 }
23
24 window.onload = function() {
25 img = new Image;
26 img.onload = function() {
27 draw();
28 };
29 img.src = 'pattern.jpg';
30 };
31
32 </script>
33 </head>
34 <body>
35
36 <canvas id=c width=400 height=400></canvas>
37
38 <p>This tests patterns</p>
39
40 </body>
41 </html>