2 PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4 <html xmlns="http://www.w3.org/1999/xhtml">
8 <title>Context2D.quadraticCurveTo Test Case</title>
10 if (window.testRunner)
11 testRunner.dumpAsTextWithPixelResults();
20 current_point = [x,y];
21 current_center = [x,y];
24 function q (x1, y1, x, y) {
25 x1 += current_point[0];
26 y1 += current_point[1];
27 x += current_point[0];
28 y += current_point[1];
29 ctx.quadraticCurveTo(x1, y1, x, y);
30 current_point = [x,y];
31 current_center = [x1,y1];
35 var x1 = current_point[0] * 2 - current_center[0];
36 var y1 = current_point[1] * 2 - current_center[1];
37 x += current_point[0];
38 y += current_point[1];
39 ctx.quadraticCurveTo(x1, y1, x, y);
40 current_point = [x,y];
41 current_center = [x1,y1];
51 // setup canvas and context
52 var canvas = document.createElementNS('http://www.w3.org/1999/xhtml', 'canvas');
53 canvas.setAttribute('width', 480);
54 canvas.setAttribute('height', 360);
55 document.documentElement.appendChild(canvas);
56 ctx = canvas.getContext('2d');
58 // draw shapes equivalent to SVG path data "M 240 296 q 25 -100 47 0 t 47 0 t 47 0 t 47 0 t 47 0 z"
73 <body onload="runTest()">
76 This test case should produce a sine-wave stroked with 1px black.